You are on page 1of 4

Implementation of multiple PDP contexts on Android

Li Wenfeng, Wang Ying, Xue Yingyi, Yang Jianxiang, Li Rong School of communication Xian University of Science and Technology Xian, China
liwenfeng@xust.edu.cn phoebe.y.wang@gmail.com

AbstractAim: To resolve the constraint of single PDP context on Google Android. Methods: To support multiple PDP contexts in mobile devices through adding data connection manager module and virtual network devices. Result: Multiple applications can open different network connection using different network profiles at the same time. Conclusion: The solution resolves the constraints of single PDP context on Google Android. Keywords-Android; Multiple PDP Contexts; Data Connection

communication, because there are several different data connections, we also need a data connection supervisor, which we called Data Connection Manager (DCM) here to monitor and manage these data connection status.

I.

INTRODUCTION

Android is an operating system and software stack for mobile devices that includes middleware and key applications, and uses a modified version of the Linux kernel. Just like other mobile phone platform, Android only supports single PDP (package data protocol) context, that means only one data connection is active at the same time. But this design does restrict end users in some use scenarios, e.g. if user wants to send a MMS message, he/she has to turn off active data connection firstly, and then actives a data connection specific for MMS provided by telecommunication carriers, only on which the MMS message can be sent/received. So in this case, the user has to lose all data transferring on previous data connection. Single PDP context limitation decreases the user experience highly. This paper introduces a way to implement multiple PDP contexts on middleware layer on Android. II. PRINCIPLE OF MULTI-PDP DATA CONNECTION

Figure 1. The structure of Multi-PDP Data connection

III.

REQUIREMENT OF MODULES AND INTERFACE

Based on the framework above, we study several essential modules and the requirement of their interfaces in this section: Data Connection Manager, Virtual Network Device, Ioctl interface. A. Data Connection Manager(DCM) The major function of DCM is responsible to establish and to maintain the PDP data connection as well as the corresponding virtual network device. The data connection manager will send AT command to manufacturers modem to setup Data connection PDP, when modem setup the Data connection in signaling layer, it shall create and active a virtual network device for this connection with the appropriate configuration. Then, the IP packet can be sent and received via this network device, and the Data connection Manager can get some status information from this Network Device by Ioctl method. After each PDP connect with its corresponding virtual network device in this way, applications can normally followed the TCP/IP protocol to transfer IP data with virtual network devices.

The data connection establishment actually is a process of activating the PDP context. Each data connection has the respective PDP text, and the PDP text has preserved all parameters for the data connection, containing the IP address, the network mask, the route disposition, as well as the corresponding virtual network device. Figure 1 has given the framework of multi-PDP data communication based on Android the platform. In the framework, the level AP (Application Processor) could be understood as user programs in the terminal, while the bottommost level CP (Communication Processor) could be understood as the Modem procedure in terminal. The communication between AP and CP are through RIL (Radio Interface Layer) to realize, which module can receive, dispatch and process the AT commands. In multi-PDP data

978-1-4244-7874-3/10/$26.00 2010 IEEE

B. Virtual Network Device For the IP data transmission, the PDP data connection must have the corresponding network device. Android produces the virtual network devices through the Linux system's built-in command, which may be regarded as the real network device. Figure 2 is the function description of virtual network device.

address, Net mask ) which are obtained from the signaling Network into the virtual network device to enable it. Then, the application can send and receive the IP packet via the network device.

Figure 3. Operation Sequence of Setup Data Connection Figure 2. Figure 2 Function Description of Virtual Network Device

The Virtual Network Device need work as a normal network device from the perspective of the platform, and its responsibility was described in the below diagram. The Network Device Driver handles the sending/receiving IP Data with the TCP/IP stack; the data structure shall be sk_buff according to the Linux standard. Sending: The Net Device shall handle the IP packet which is from TCP/IP stack; convert it into the format applying the modem if need and forward to the Modem layer via the Modem internal interface. Receiving: The Net device shall convert the receiving packet from Modem internal interface into the IP packet if need and transmit it to the TCP/IP stack.

B. Operation Sequence of Disconnect Data Connection The Android platform will send AT command to RIL adaptor to disconnect the data connection PDP, the RIL adaptor shall disconnect the connection of the signaling layer and remove the virtual network device.

C. Ioctl interface Meanwhile, the Device Driver shall support the ioctl system call, Data Connection Manager Module can obtain the Data transmit/receiving status by calling it. It shall support: Data meter which provides the Network Device status needs to be implemented in the Network Device Driver. Socket ioctl operations, which are needed by Data Connection Manager module to configure the network context. IV. OPERATION OF DATA CONNECTION

Figure 4. Operation Sequence of Disconnect Data Connection

A. Operation Sequence of Setup Data Connection The Android platform will send AT command to RIL adaptor to setup data connection PDP, after the RIL adaptor established the Data connection, the RIL adaptor shall create the virtual network device, and configure the net parameter (IP

C. AT Commands for Data Connection The step in the above diagrams setup data connection and Disconnect data connection contains a serial of AT command about Data connection. The Setup success and disconnect success are the AT command response. For example, to setup a GPRS connection with APN cmnet, the AT command list shall be: AT+CGDCONT=1,"IP","CMNET","",0,0 AT+CGDATA="M-IP",1 AT+CGDCONT? Disconnect GPRS connection is: AT+CGACT=0,1

The complete AT command list about Data Connection can be referred to the Modem AT Command List. V. IMPLEMENTATION OF MULTIPLE PDP DATA CONNECTION

A. The principle of Multiple PDP According to above operation of data connection, we know each PDP context should correspond with a virtual network device. As shown in Figure 5, if multiple PDP contexts are activated simultaneously, there should be matching virtual network devices. To implement such multiple PDP data connection, a corresponding virtual network device should be created when each PDP is activated. Similar or related ID n

use the default network type internet); After DCM knowing the network type, it will inquire all the APN settings under this type. Then, it will try to setup the PDP connection with the first APN setting. If connection establishment defeat, it will choose the second APN setting attempt to setup the PDP connection. It will continue in this way until PDP connection setup successfully. In view of the APN type concept's introduction, the class ApnSetting in Android needs to expand which is used for to save APN settings. The actual implementation is that the APN type support is increased in the class ApnSetting, namely increased a character string variable to express this APN type: public class ApnSetting { final static String DEFAULT_APNTYPE = internet; // internet/wap/mms/cmmail/custom private String apnType = DEFAULT_APNTYPE; //Get the APN type public String getApnType() { return this.apnType; } //Set APN type public void setApnType(String apnType) { this.apnType = apnType; } //Get default APN type public static String getDefaultApnType() { return DEFAULT_APNTYPE }; // internet } 2) PDP connection maintenance: As above mentioned, DCM will setup the PDP connection through the method in which it attempt all APN settings in turn. As a result of the APN type's introduction, in fact, each APN type will most can establish one PDP connection, otherwise, the application could not know which PDP connection in this APN type should be used. Thus, it can be seen, DCM merely needs to maintain a PDP connection for each APN type. Android has realized the PDP connection management in the class com.android.internal.telephony.gsm.GsmDataConnectionTra cker. So, this class should be modified to realize the multiPDP support. Simultaneously, it is also needs to increase a variable in the class DataConnection ,which is the parent class of PdpConnection. This increased variable is to record the banded network interface. The main modification is as follows: public class DataConnection { //increased a variable to record the banded network interface //when setup connection,get the APN via RIL message private String networkInterface;

Figure 5. The Framework of Multi-PDP Data connection

In the above data connection setup procedure, the first parameter of AT commands AT+CGDCONT is the PDP ID number. We may see in the figure above, when DCM activates each PDP through this AT command, it will provides only one ID number for this PDP; RIL will send a corresponding AT command to Modem though AT command server. After Modem setup the data connection successfully with network, it will return an activation response for AT command server, and then AT command server will automatically call the Linux built-in command to create a corresponding virtual network device, and assign an ID number to this network device. AT command server also will return this ID number to DCM. Thus, DCM may maintain a table for these activation PDP and corresponding virtual network devices to provide the correct routes for their IP data packet. And during data transmission, DCM will carry on the monitor through the Ioctl interface to the status of these network devices. B. Implementation of DCM on JAVA 1) Network connection type: The different operator service are using dissimilar network configuration. Network configuration on handsets mainly contains APN (Access Point Name), Proxy and Port, User, Password, MMSC (Multi-media Message Service Center) and so on. APN are the most important parameter, therefore, on handsets, network setting is also called the APN setting. On handsets, applications must provide the network connection type. When this application carries on the network operation, DCM firstly obtains its corresponding network connections type through the application's setting (if this application has not assigned network connection type, it will

public getNetworkInterface() { return networkIntercace; }; public setNetworkInterface(String networkInterface){ this.networkInterface = networkInterface; } } public class GsmDataConnectionTracker { private List<ApnSetting> activeApns = new ArrayList<ApnSetting>(); private List<PdpConnection> pdpList = new ArrayList<PdpConnection>(); //Get the active APN types public String[] getActiveApnTypes() { // Get the active APN type via activeApns String[] types = new String[activeApns.size()]; for (int i = 0; i < types.length; i++) { types[i] = activeApns.get(i).getApnType(); } return types; } //Get the setting of specified active APN type public String getActiveApnString(String type) { for (ApnSetting as : activeApns) { if (as.getApnType().equal(type)) return as.getApn(); } return null; } // Get the setting of default active APN type public String getActiveApnString() { return getActiveApnString( ApnSetting.getDefaultApnType()); } //Get specified PDP connection public PdpConnection getActivePdp(String type) { for (PdpConnection pc: PdpList) { if (pc.getApnSetting().getApnType().equal(type)) return pc; } return null; }

} VI.
CONCLUSION

Based on the study at implementation of data connection on Google Android platform, this article proposed one kind of multiple PDP data connection implementation, which solved one defect in Google Android platform that different applications cannot use the different network configuration simultaneously to carry on the data communication. This implementation has succeeded applies to OPhone OS Smartphone platform which research project is leaded by China Mobile Communications Corporation. On the OPhone OS platform, this implementation improved the user experience on mobile network applications on Smartphone. The entire project which this paper based on has won The Innovation Award of TD Terminal Application Platform prize, which is awarded by TD Industry Alliance, in February, 2010. ACKNOWLEDGMENTS This work is supported by CMCC and by HEGAOJI 2009 special fund. We would like to thank them for their contributions. Technology Innovation Support Scheme of Xian in 2010Intrinsically Safe Industrial Ethernet equipment for mine (CY1008)
[1]

[2]

[3] [4] [5] [6] [7] [8]

REFERENCES 3GPP TS 27007: 3rd Generation Partnership Project; Technical Specification Group Terminals; AT command set for User Equipment (UE) 3GPP TS 11.11: "Digital cellular telecommunications system (Phase 2+); Specification of the Subscriber Identity Module Mobile Equipment (SIM ME) interface". GSM MoU SE.13, GSM MoU Permanent Reference Document SE.13: "GSM Mobile Network Codes and Names". 3GPP TS 23.060: "3rd Generation Partnership Project; General Packet Radio Service (GPRS) Service description; Stage 2". 3GPP TS 24.008: "3rd Generation Partnership Project; Mobile Radio Interface Layer 3 specification; Core Network Protocols-Stage 3". Hui Li, OMS Network Interface Requirement specification V1.0, unpublished. Android Developer Web Site: http://developer.android.com/ Android Framework Group: http://groups.google.com/group/androidframework