0% found this document useful (0 votes)
55 views28 pages

2 Mobile

The document discusses techniques for efficiently accessing cellular networks without excessive battery drain. It describes the LTE protocol stack and RRC states, and how radio usage impacts battery life. It then covers the AT&T Application Resource Optimizer tool for analyzing app network usage, and best practices like text compression, cache control, and minimizing unnecessary data transfers. Monitoring battery status and connectivity is also discussed. Case studies demonstrate removing unnecessary traffic, TCP retries, and redirecting to mobile-optimized pages.

Uploaded by

Raheel Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views28 pages

2 Mobile

The document discusses techniques for efficiently accessing cellular networks without excessive battery drain. It describes the LTE protocol stack and RRC states, and how radio usage impacts battery life. It then covers the AT&T Application Resource Optimizer tool for analyzing app network usage, and best practices like text compression, cache control, and minimizing unnecessary data transfers. Monitoring battery status and connectivity is also discussed. Case studies demonstrate removing unnecessary traffic, TCP retries, and redirecting to mobile-optimized pages.

Uploaded by

Raheel Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Accessing Cellular Network

Efficiently Without the Battery


Drain
Lee, Chang Hwan, SK Telecom
lipisoft at gmail dot com
Kandroid: Lipi(리피)
Contents
● Wired vs Cellular
● Cellular Network
● LTE Protocol Stack
● LTE RRC state
● AT&T ARO
● Monitor Battery status and Connectivity
● Case Study
○ Remove unnessary traffic
○ TCP FIN Retry
○ Redirect to Mobile Web page
● Additional Readings
Wired vs Cellular(Protocol Stack)
User Plane
Application layer

Presentation layer Application HTTP


HTTP

Session layer

Transport layer Transport TCP/UDP Control Plane TCP/UDP

NAS
Network layer Internet IP IP
RRC
PDCP
Data link layer
RLC
Link Ethernet / Wi-Fi
MAC
Physical layer
Physical

OSI model DoD model TCP/IP suite LTE UE model

PDCP: Packet Data Convergence Protocol NAS: Non Access Stratum


RLC: Radio Link Control RRC: Radio Resource Control
MAC: Medium Access Control
Cellular Network(LTE)
Uu S1-U S5 SGi
UE eNB SGW PGW Internet

S1-MME S11

MME
S8

User Plane
[Roaming]
Control Plane
Uu S1-U
UE eNB SGW

UE: User Equipment


S1-MME S11
eNB: eNodeB
MME MME: Mobility Management Entity
SGW: Serving Gateway
PGW: PDN Gateway
PDN: Packet Data Network
LTE Protocol Stack
Control Plane
LTE Protocol Stack
User Plane
LTE RRC State and Time
Consumption

RRC CONNECTED
RRC IDLE
Continuous
0.1 sec Reception

IDLE
0.1 sec < 0.05 sec

10 sec
Tail

Data Transfer
Timer Expiration
Power states of LTE

● Radio is the second most expensive component after screen


● Radio use is expensive regardless of transfer size
Download a HTML page in your App
1. Launch the Application
2. RRC IDLE -> RRC CONNECTED
a. It takes 2 seconds at 3G network
3. DNS Query to DNS Server and Response
4. TCP SYN, SYN/ACK, ACK
5. HTTP GET Request/200 OK
AT&T ARO
● Application Resource Optimizer
● Latest Version: 2.4
● Open Source(https://github.com/attdevsupport/ARO), Apache License 2.0
● Data Collector
○ must be Rooted(su command is required) in Android
○ tcpdump is used for packet capture in Android
○ NetMon in Windows
● Data Analyzer
○ Windows & Mac OSX(Java based)
● Filter per an application/IP address
● Flurry is used but can be removed from source code and
rebuild it
● Limitation
○ HTTP Header in HTTPS can’t be analyzed
AT&T ARO Data Analyzer
ARO Best Practice
● Text File Compression ● Offloading to Wi-Fi
● Duplicate Content ● Third-Party Scripts
● Cache Control ● HTTP 400 and 500 Error Codes
● Cach Expiration ● HTTP 300 Status Codes
● Content Prefetch ● Asynchronous Load of JavaScript in
● Combine JavaScript and CSS HTML
requests ● HTTP 1.0 Usage
● Resize Images for Mobile ● File Order of External Style Sheets
● Minify CSS, JS, and HTML and Scripts
● Managing Imags with CSS Sprites ● Empty Source and Link Attributes
● Opening Connections ● Flash Files
● Multiple Simultaneous TCP ● Displaying None in CSS
Connections ● Accessing Peripherals
● Periodic Transfer ● Comparing LTE and 3G Energy
● Screen Rotations Consumption
● Closing Connections ● Content Optimazation for Mobile
Devices
Text File Compression

● No encoding method
is specified in HTTP
header
Text File Compression
● HTML, CSS, JavaScript, Text is used
● HTTP 1.1 can support gzip, DEFLATE
● Limitation
○ image format and media format
○ very small files
● How to
○ App send Accept-Encdoing:gzip, deflate in HTTP
request header
○ Server send Content-Encoding:gzip or deflate in
HTTP response header
Periodic Data Transfer

● Minimize the periodic data transfers


● Avoid polling, leverage server push such as GCM(Google Cloud Message)
● coalesce, defer requests
Closing Connections

FIN Handshaking Only


No Data(Payload)
Cache Control/Expiration

Same contents
Cache should be used
Optimizing Battery Life
● Monitoring the Battery Level and Charging
State
● Determining and Monitoring the Docking
State and Type
● Determining and Monitoring the Connectivity
Status
● Manipulation Broadcast Receivers On
Demand
Monitoring the Battery Level and
Charging State
● Determine the Current Charging State

IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);


Intent batteryStatus = context.registerReceiver(null, ifilter);

// Are we charging / charged?


int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
status == BatteryManager.BATTERY_STATUS_FULL;

// How are we charging?


int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB;
boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC;
Monitoring the Battery Level and
Charging State
<receiver android:name=".PowerConnectionReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
</intent-filter>
</receiver>

public class PowerConnectionReceiver extends BroadcastReceiver {


@Override
public void onReceive(Context context, Intent intent) {
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
status == BatteryManager.BATTERY_STATUS_FULL;

int chargePlug = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);


boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB;
boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC;
}
}
Monitoring the Battery Level and
Charging State
● Determine the Current Battery Level
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);

float batteryPct = level / (float)scale;

● Monitor Significant Changes in Battery Level


<receiver android:name=".BatteryLevelReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_BATTERY_LOW"/>
<action android:name="android.intent.action.ACTION_BATTERY_OKAY"/>
</intent-filter>
</receiver>
Determining and Monitoring the
Connectivity Status
● Check an Internet Connection
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.
CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();

● Check the Type of Internet Connection


boolean isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;
boolean isMobile = activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE;

● Monitor for Changes in Connectivity


<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
Manipulating Broadcast Receivers
On Demand
● wake the device each time any of these
receivers is triggered
● enable or disable the broadcast receivers at
runtime

ComponentName receiver = new ComponentName(context, myReceiver.class);


PackageManager pm = context.getPackageManager();
pm.setComponentEnabledSetting(receiver,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
Case Study
Bank Application

ELAPSED_WAKEUP #10: Alarm{42885370 type 2 com.sc.danb.scbankapp}


type=2 when=+4m39s363ms repeatInterval=300000 count=1
operation=PendingIntent{431152f8: PendingIntentRecord{43bd0570 com.sc.danb.scbankapp broadcastIntent}}

● The trial of useless connection should be removed in your app.


netstat

● /proc/net/tcp, udp, tcp6, udp6 is used in netstat command


● After half closed server triggers, later Android’s FIN is not acknolwledged
from server
● The FIN is retried to the app’s server about 8 times
● The server’s last ACK for FIN should be sent to Android handset
No redirection to mobile pages

● HTTP Request should be redirected to mobile


page
○ Loading time too long
● But \(root)page can be redirected to mobile
page
Addintional Readings
● 2013 AT&T Developer Summit - Turbocharge Your
Mobile App (http://soc.att.com/W0Kv6h), Doug Sillars
● Google IO 2013 - Mobile Performance from Radio Up
(http://bit.ly/11fZTNA), Ilya Grigorik
● High Performance Browser Networking(http://bit.
ly/12kia3y), Ilya Grigorik
● DevBytes: Efficient Data Transfers(http://bit.
ly/1guF8eR), Reto Meier

You might also like