apimigrator: an api-usage migration tool for android appsmfazzini/slides/2020... · android eclair...
TRANSCRIPT
![Page 1: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/1.jpg)
APIMIGRATOR: An API-Usage Migration Tool for Android Apps
Mattia Fazzini Qi Xin Alessandro Orso
![Page 2: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/2.jpg)
Mobile Applications
![Page 3: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/3.jpg)
Platform
![Page 4: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/4.jpg)
PlatformTight Coupling
![Page 5: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/5.jpg)
Platforms Change
![Page 6: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/6.jpg)
Platforms Change FrequentlyAndroid
Eclair
Ice Cream
Marshmallow
DonutPetit Four Cupcake
HoneycombFroyo Gingerbread
LollipopJelly Bean KitKat
PieNougat Oreo
1.1
Android 10
![Page 7: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/7.jpg)
AppDeveloper
Adaptive Maintenance
Platform
App
New Platform
![Page 8: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/8.jpg)
Platform FragmentationAndroid 10
Ice CreamJelly Bean
KitKat
Lollipop
Marshmallow
Oreo
Pie
Nougat
![Page 9: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/9.jpg)
App C
Developer C
App B
Developer B
App A
Intuition
Developer A
![Page 10: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/10.jpg)
App C
Developer C
App B
Developer B
App A
Intuition
Developer A
![Page 11: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/11.jpg)
App C
Developer C
App B
Developer B
App A
Intuition
Developer A
![Page 12: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/12.jpg)
API-Usage Migrations
API-Usage Changespublic NetworkInfo[] getAllNetworkInfo()
public Network[] getAllNetworks()
New API Usage
public NetworkInfo getNetworkInfo(Network network)
public NetworkInfo[] getAllNetworkInfo()Old API Usage
![Page 13: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/13.jpg)
API Updates
API-Usage Changespublic NetworkInfo[] getAllNetworkInfo()
public Network[] getAllNetworks()
New API Usage
public NetworkInfo getNetworkInfo(Network network)
public NetworkInfo[] getAllNetworkInfo()Old API Usage
![Page 14: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/14.jpg)
API Updates
API-Usage Changespublic NetworkInfo[] getAllNetworkInfo()
public Network[] getAllNetworks()
New API Usage
public NetworkInfo getNetworkInfo(Network network)
public NetworkInfo[] getAllNetworkInfo()Old API Usage
![Page 15: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/15.jpg)
Migration ExampleMigration Example Before Migration Example After
public boolean isConnected(Context cont) { ConnectivityManager cm = ...; NetworkInfo[] info = cm.getAllNetworkInfo(); for (int i = 0; i < info.length; i++) { if(info[i].isConnected()) { return true; } } Toast.makeText(R.s.noNet).show(); return false; }
public boolean isConnected(Context cont) { ConnectivityManager cm = ... ; if (VERSION.SDK_INT >= VERSION_CODES.M) { Network[] networks = cm.getAllNetworks(); for (Network mNetwork : networks) { NetworkInfo networkInfo = cm.getNetworkInfo(mNetwork); if(networkInfo.isConnected()) { Log.d(networkInfo.getTypeName()); return true; } } } else { NetworkInfo[] info = cm.getAllNetworkInfo(); for (NetworkInfo anInfo : info) { if(anInfo.isConnected()) { Log.d(anInfo.getTypeName()); return true; } } } Toast.makeText(cont.getString(...)).show(); return false; }
![Page 16: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/16.jpg)
public boolean isConnected(Context cont) { ConnectivityManager cm = ...; NetworkInfo[] info = cm.getAllNetworkInfo(); for (int i = 0; i < info.length; i++) { if(info[i].isConnected()) { return true; } } Toast.makeText(R.s.noNet).show(); return false; }
public boolean isConnected(Context cont) { ConnectivityManager cm = ... ; if (VERSION.SDK_INT >= VERSION_CODES.M) { Network[] networks = cm.getAllNetworks(); for (Network mNetwork : networks) { NetworkInfo networkInfo = cm.getNetworkInfo(mNetwork); if(networkInfo.isConnected()) { Log.d(networkInfo.getTypeName()); return true; } } } else { NetworkInfo[] info = cm.getAllNetworkInfo(); for (NetworkInfo anInfo : info) { if(anInfo.isConnected()) { Log.d(anInfo.getTypeName()); return true; } } } Toast.makeText(cont.getString(...)).show(); return false; }
Migration ExampleMigration Example Before Migration Example After
![Page 17: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/17.jpg)
public boolean isConnected(Context cont) { ConnectivityManager cm = ... ; if (VERSION.SDK_INT >= VERSION_CODES.M) { Network[] networks = cm.getAllNetworks(); for (Network mNetwork : networks) { NetworkInfo networkInfo = cm.getNetworkInfo(mNetwork); if(networkInfo.isConnected()) { Log.d(networkInfo.getTypeName()); return true; } } } else { NetworkInfo[] info = cm.getAllNetworkInfo(); for (NetworkInfo anInfo : info) { if(anInfo.isConnected()) { Log.d(anInfo.getTypeName()); return true; } } } Toast.makeText(cont.getString(...)).show(); return false; }
public boolean isConnected(Context cont) { ConnectivityManager cm = ...; NetworkInfo[] info = cm.getAllNetworkInfo(); for (NetworkInfo anInfo : info) { if(info[i].isConnected()) { return true; } } Toast.makeText(R.s.noNet).show(); return false; }
Migration ExampleMigration Example Before Migration Example After
![Page 18: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/18.jpg)
APIMIGRATOR Overview
Identify API usages requiring
migration in target app
Find migration examples for identified API
usages
Abstract migration examples into
generic migration patches and rank
them
Migrate and validate API
usages in target app based on
patches
API-UsageAnalysis
Migration ExamplesSearch
Update ExamplesAnalysis
API-UsageMigrationMigration
Examples
GenericMigrationPatches
API-UsageMigration
Report
![Page 19: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/19.jpg)
APIMIGRATOR Overview
Identify API usages requiring
migration in target app
Find migration examples for identified API
usages
Abstract migration examples into
generic migration patches and rank
them
Migrate and validate API
usages in target app based on
patches
API-UsageAnalysis
Migration ExamplesSearch
Update ExamplesAnalysis
API-UsageMigrationMigration
Examples
GenericMigrationPatches
API-UsageMigration
Report
![Page 20: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/20.jpg)
APIMIGRATOR Overview
Identify API usages requiring
migration in target app
Find migration examples for identified API
usages
Abstract migration examples into
generic migration patches and rank
them
Migrate and validate API
usages in target app based on
patches
API-UsageAnalysis
Migration ExamplesSearch
Update ExamplesAnalysis
API-UsageMigrationMigration
Examples
GenericMigrationPatches
API-UsageMigration
Report
![Page 21: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/21.jpg)
APIMIGRATOR Overview
Identify API usages requiring
migration in target app
Find migration examples for identified API
usages
Abstract migration examples into
generic migration patches and rank
them
Migrate and validate API
usages in target app based on
patches
API-UsageAnalysis
Migration ExamplesSearch
Update ExamplesAnalysis
API-UsageMigrationMigration
Examples
GenericMigrationPatches
API-UsageMigration
Report
![Page 22: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/22.jpg)
APIMIGRATOR Overview
Identify API usages requiring
migration in target app
Find migration examples for identified API
usages
Abstract migration examples into
generic migration patches and rank
them
Migrate and validate API
usages in target app based on
patches
API-UsageAnalysis
Migration ExamplesSearch
Update ExamplesAnalysis
API-UsageMigrationMigration
Examples
GenericMigrationPatches
API-UsageMigration
Report
![Page 23: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/23.jpg)
![Page 24: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/24.jpg)
![Page 25: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/25.jpg)
Empirical Evaluation
RQ2 (EFFICIENCY): What is the cost of running APIMIGRATOR?
Research Questions
RQ1 (EFFECTIVENESS): Can APIMIGRATOR migrate API usages in real-world apps?
RQ2 (EFFICIENCY): What is the cost of running APIMIGRATOR?
![Page 26: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/26.jpg)
EvaluationRQ1 (EFFECTIVENESS): Can APIMIGRATOR migrate API usages in real-world apps?
• 37/41 (90%) successful update rate (for API-usage occurrences)• 25/37 (68%) automatic validation rate (for API-usage occurrences)
• 17/20 (85%) successful update rate (for API usages)
APPEVOLVE is effective in automatically updating API usages.
RQ2 (EFFICIENCY): What is the cost of running APIMIGRATOR?
API-UsageAnalysis
Update ExamplesSearch
Update ExamplesAnalysis
API-UsageUpdate
28s 10h27m 2s204ms 20s
The cost of the update examples search phase dominates the cost of the other phases.
Average Execution Time
![Page 27: APIMIGRATOR: An API-Usage Migration Tool for Android Appsmfazzini/slides/2020... · Android Eclair Ice Cream Marshmallow Petit Four Cupcake Donut Froyo Gingerbread Honeycomb Jelly](https://reader033.vdocument.in/reader033/viewer/2022051811/60263e12d91e6262792ba012/html5/thumbnails/27.jpg)
Summary