The Java API to Android's Telephony Stack
Android is a software stack for mobile phones. It includes a modified version of the Linux OS, middleware (which is the topic of this article) and some applications. The SDK is available free of charge and can be downloaded from the Google Web site. The Android sources also are available and can be fetched from a GIT repository, although some important parts are missing.
As shown in Figure 2, Android consists of a runtime, libraries and application framework modules.
Figure 2 shows only the modules that implement telephony functionality; for a more detailed diagram, refer to the Google Android overview page.
Telephony manager, which is part of the Android application framework, provides a telephony API to user applications. It consists of the android.telephony and android.telephony.gsm Java packages. This official telephony API is fully documented in the Android developer reference guide, so I don't describe it here in detail. It is far more interesting to check what important functionality is not included in this API, which turns out to be quite a lot. The current Telephony Manager API is mostly limited to providing phone and network status information, such as call state (idle, offhook or ringing), network operator name, roaming state and so on. The only parameters you can change are network operator name and selection mode, using the setOperatorName() and setIsManualSelection() calls, respectively. And, the only action you can perform is SMS, using sendDataMessage() and sendTextMessage(). This API is rather spartan to say the least, and it lacks many important functions. For instance, it is hard not to notice that all voice-call-related functionality is missing, yet some (platform) applications, such as Phone, manage to implement it.
Not only is this API not sufficient to create any useful telephony applications, it also is rather inconsistent. There is no clear architecture behind the class structure, and it is not obvious how support for other RATs (radio-access technologies) apart from GSM, such as CDMA200 and LTE, will work.
The first thing you discover when you look at the Android telephony API in detail is that it is not fully open. There is a lot of important functionality in the com.android.internal.telephony package. For instance, the Phone application uses this internal API to make/answer a call and access the SIM. This API is not documented. It can and probably will change in the future, and generally, it is not intended for use by applications that are not part of the Android platform—so much for the “All applications are created equal” motto. Fortunately, this API is documented pretty well in the source code of the Base framework module, which can be found under the frameworks/base/telephony/java/com/android/internal/telephony directory inside the Android sources.
The architecture block diagram shown in Figure 2 implies that privilege—that is, platform telephony applications use the com.android.internal.telephony package, although mortals are stuck with android.telephony.
This internal framework module communicates via UNIX domain sockets with the RIL (Radio Interface Layer) dæmon rild, which is written in C as one would expect (not Java). The majority of the telephony functionality of the RIL dæmon is implemented in the RIL library. Both the RIL dæmon and the library sources, along with a reference RIL driver, can be found under the hardware/ril directory. The RIL dæmon communicates using AT commands with either the RIL kernel driver (via the read/write interface when it is running on real hardware) or with the SDK emulator (via the socket interface). The RIL kernel driver is probably just a dumb pipe that forwards AT commands to the baseband processor via the appropriate hardware interface. Unfortunately, this part of Android telephony is neither documented nor open source. There is only a so-called reference RIL implementation in the hardware/ril/reference-ril directory. So, one has to guess what exactly goes on down there on real hardware. The reason this part is not open source is probably the same reason as the one that prevents some companies from releasing Wi-Fi firmware—regulations in many countries do not allow for manufacturers to provide direct access to radio hardware to end users.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Devuan Beta Release
- May 2016 Issue of Linux Journal
- EnterpriseDB's EDB Postgres Advanced Server and EDB Postgres Enterprise Manager
- The US Government and Open-Source Software
- The Humble Hacker?
- BitTorrent Inc.'s Sync
- Open-Source Project Secretly Funded by CIA
- The Death of RoboVM
- New Container Image Standard Promises More Portable Apps
- Tech Tip: Really Simple HTTP Server with Python
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide