realizing api virtualization on androidesaule/nsf-pi-csr-2017... · realizing api virtualization on...

1
Realizing API Virtualization on Android Taeyeon 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. Propose q Injecting a replacement class that contains custom code for each platform API class that a third-party developer wants to replace q Rewriting the binary of an app so that the app code uses replace- ment classes instead of platform API classes q Distributing the new implementa- tion through standard app distri- bution channels 27 28 29 Call Average Time (us) Original App Instrumented App getLine1Number getDeviceId getCellLocation isWifiConnected getLastKnownLocation putValueInPreference getValueFromPreference putValueInFile getValueFromFile putValueInSQLite getValueFromSQLite 0 1 2 3 4 0 5 10 15 20 25 30 Time (s) 0 50 100 150 Total Heap Size (Mb) Original App Instrumented 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.5 790.3 20.0 17.4 The Weather Channel (Weather) The Weather Channel * 170.2 181.4 13.6 8.9 TempleRun (Game) TempleRun* 991.5J 992.95J 29.5J 22.3J q Samsung Galaxy Nexus Devices running Android 4.4 q Enabling stay-awake mode q 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. Contribution q Mitigating the lack of openness in mobile systems by proposing API Virtualization q 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* 7192 9388 9.7M 11M N/A 133.1 (sec) The Weather Channel (Weather) The Weather Channel * 8377 10724 14M 16M N/A 146.2 (sec) TempleRun (Game) TempleRun* 1213 2689 23.8M 24.7M N/A 26.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 AirBnb on an Amazon device Instrumented AirBnb on an Amazon device Original Twitter Instrumented Twitter with a runtime Internet permission VI. Conclusion API Virtualization enables open innovation in Android. Also, it allows third-party developers to inject custom code into an app binary. Through API virtualization prototype on Android, we show the feasibility and practicality of our API virtualization, and the low overhead that API virtualization imposes. Injecting a runtime Internet permission

Upload: others

Post on 25-May-2020

32 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Realizing API Virtualization on Androidesaule/NSF-PI-CSR-2017... · Realizing API Virtualization on Android Taeyeon Ki, Alexander Simeonov, Bhavika Pravin Jain, Chang Min Park, Keshav

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