realizing api virtualization on androidesaule/nsf-pi-csr-2017... · realizing api virtualization on...
TRANSCRIPT
Realizing API Virtualization on AndroidTaeyeon Ki, Alexander Simeonov, Bhavika Pravin Jain, Chang Min Park, Keshav Sharma
Karthik Dantu, Steven Y. Ko, Lukasz Ziarek
I. Motivation
Mobile vendors control platform distribution channels.
Unlike mobile platforms, mobile apps are open for third parties.
II. Proposeq Injecting a replacement class
that contains custom code foreach platform API class that athird-party developer wants toreplace
q Rewriting the binary of an app sothat the app code uses replace-ment classes instead of platformAPI classes
q Distributing the new implementa-tion through standard app distri-bution channels
272829
Call
Aver
ageT
ime(
us)
Original AppInstrumented App
getL
ine1
Num
ber
getD
evic
eId
getC
ellL
ocat
ion
isWifi
Conn
ecte
d
getL
astK
now
nLoc
atio
n
putV
alue
InPr
efer
ence
getV
alue
From
Pref
eren
ce
putV
alue
InFi
le
getV
alue
From
File
putV
alue
InSQ
Lite
getV
alue
From
SQLi
te
01234
0 5 10 15 20 25 30Time (s)
0
50
100
150
Tot
alH
eap
Siz
e(M
b)
Original AppInstrumented App
Call Latency to Invoke Platform Methods Heap Usage of Temple Run
Power Consumption Measurement
App Name Average Consumption (10 minutes / 5 runs) Std. Deviation
WatchESPN (Sports)WatchESPN*
781.5790.3
20.017.4
The Weather Channel (Weather) The Weather Channel *
170.2181.4
13.68.9
TempleRun (Game)TempleRun*
991.5J992.95J
29.5J22.3J
q Samsung Galaxy Nexus Devices running Android 4.4q Enabling stay-awake modeq Set CPU governor to “Performance”
q To measure call latency, we use a micro-benchmark app that calls eleven platform methods from four categories: device information, network, storage, and sensing (GPS).
q To measure runtime memory usage, we use one popular game that uses accelerometer and gyroscopes on a mobile phone for game play, and contains a heavy UI component.
IV. Initial Results
III. Contributionq Mitigating the lack of openness in mobile systems by proposing API Virtualizationq Exploring and addressing a unique set of challenges that API Virtualization brings in
order to correctly and completely handle all features of Android and Java.q Realizing API Virtualization prototype, and showing its feasibility and practicality
App Name #Class APK Size Inst. Time
WatchESPN (Sports)WatchESPN*
71929388
9.7M11M
N/A133.1 (sec)
The Weather Channel (Weather) The Weather Channel *
837710724
14M16M
N/A146.2 (sec)
TempleRun (Game)TempleRun*
12132689
23.8M24.7M
N/A26.44 (sec)
() denotes application category and * denotes an instrumented app.
Instrumentation Statistics
V. Use Cases
1. Vendor-Tied Library Switching: Google Maps to Amazon Maps
2. Runtime Permissions: Runtime Internet Permission
Transformation
with API virtualization
Transformation
with API virtualization
Original AirBnb with Google Play Services on a Google device
Original AirBnbon an Amazon device
Instrumented AirBnbon an Amazon device
Original Twitter Instrumented Twitter witha runtime Internet permission
VI. Conclusion
API Virtualization enables open innovation in Android. Also, it allowsthird-party developers to inject custom code into an app binary. ThroughAPI virtualization prototype on Android, we show the feasibility andpracticality of our API virtualization, and the low overhead that APIvirtualization imposes.
Injecting a runtime Internet permission