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.
- Free Today: September Issue of Linux Journal (Retail value: $5.99)
- The Tiny Internet Project, Part I
- Bitcoin on Amazon! Sort of...
- Machine Learning with Python
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Android Browser Security--What You Haven't Been Told
- Epiq Solutions' Sidekiq M.2
- Returning Values from Bash Functions
- Securing the Programmer
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide