APIM IGRATOR : An API-Usage Migration Tool for Android Apps Mattia Fazzini Qi Xin Alessandro Orso
Mobile Applications
Platform
Platform Tight Coupling
Platforms Change
Platforms Change Frequently Android Petit Four Cupcake Donut 1.1 Eclair Froyo Gingerbread Honeycomb Ice Cream Jelly Bean KitKat Lollipop Marshmallow Nougat Oreo Pie Android 10
Adaptive Maintenance Platform New Platform App App Developer
Platform Fragmentation Ice Cream Android 10 Jelly Bean KitKat Pie Lollipop Marshmallow Oreo Nougat
Intuition Developer B App B Developer A App A Developer C App C
Intuition Developer B App B Developer A App A Developer C App C
Intuition Developer B App B Developer A App A Developer C App C
API-Usage Migrations API-Usage Changes public NetworkInfo[] getAllNetworkInfo() Old API Usage public NetworkInfo[] getAllNetworkInfo() New API Usage public Network[] getAllNetworks() public NetworkInfo getNetworkInfo(Network network)
API Updates API-Usage Changes public NetworkInfo[] getAllNetworkInfo() Old API Usage public NetworkInfo[] getAllNetworkInfo () New API Usage public Network[] getAllNetworks () public NetworkInfo getNetworkInfo ( Network network )
API Updates API-Usage Changes public NetworkInfo[] getAllNetworkInfo() Old API Usage public NetworkInfo[] getAllNetworkInfo() New API Usage public Network[] getAllNetworks() public NetworkInfo getNetworkInfo(Network network)
Migration Example Migration Example Before Migration Example After public boolean isConnected(Context cont) { public boolean isConnected(Context cont) { ConnectivityManager cm = ...; ConnectivityManager cm = ... ; NetworkInfo[] info = cm.getAllNetworkInfo(); if (VERSION.SDK_INT >= VERSION_CODES.M) { for (int i = 0; i < info.length; i++) { Network[] networks = cm.getAllNetworks(); if(info[i].isConnected()) { for (Network mNetwork : networks) { return true; NetworkInfo networkInfo = } } cm.getNetworkInfo(mNetwork); Toast.makeText(R.s.noNet).show(); if(networkInfo.isConnected()) { return false; 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 Example Migration Example Before Migration Example After public boolean isConnected(Context cont) { public boolean isConnected(Context cont) { ConnectivityManager cm = ...; ConnectivityManager cm = ... ; NetworkInfo[] info = cm.getAllNetworkInfo(); if (VERSION.SDK_INT >= VERSION_CODES.M) { for (int i = 0; i < info.length; i++) { Network[] networks = cm.getAllNetworks(); if(info[i].isConnected()) { for (Network mNetwork : networks) { return true; NetworkInfo networkInfo = } } cm.getNetworkInfo(mNetwork); Toast.makeText(R.s.noNet).show(); if(networkInfo.isConnected()) { return false; 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 Example Migration Example Before Migration Example After public boolean isConnected(Context cont) { public boolean isConnected(Context cont) { ConnectivityManager cm = ...; ConnectivityManager cm = ... ; NetworkInfo[] info = cm.getAllNetworkInfo(); if (VERSION.SDK_INT >= VERSION_CODES.M) { for (NetworkInfo anInfo : info) { Network[] networks = cm.getAllNetworks(); if(info[i].isConnected()) { for (Network mNetwork : networks) { return true; NetworkInfo networkInfo = } } cm.getNetworkInfo(mNetwork); Toast.makeText(R.s.noNet).show(); if(networkInfo.isConnected()) { return false; 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; }
APIM IGRATOR Overview API-Usage API-Usage Migration Examples Update Examples Generic Migration Analysis Search Analysis Migration Migration Examples Patches API-Usage Migration Report Migrate and Find migration Abstract migration Identify API validate API usages requiring examples for examples into migration in usages in target identified API generic migration target app app based on usages patches and rank patches them
APIM IGRATOR Overview API-Usage API-Usage Migration Examples Update Examples Generic Migration Analysis Search Analysis Migration Migration Examples Patches API-Usage Migration Report Migrate and Find migration Abstract migration Identify API validate API usages requiring examples for examples into migration in usages in target identified API generic migration target app app based on usages patches and rank patches them
APIM IGRATOR Overview API-Usage API-Usage Migration Examples Update Examples Generic Migration Analysis Search Analysis Migration Migration Examples Patches API-Usage Migration Report Migrate and Find migration Abstract migration Identify API validate API usages requiring examples for examples into migration in usages in target identified API generic migration target app app based on usages patches and rank patches them
APIM IGRATOR Overview API-Usage API-Usage Migration Examples Update Examples Generic Migration Analysis Search Analysis Migration Migration Examples Patches API-Usage Migration Report Migrate and Find migration Abstract migration Identify API validate API usages requiring examples for examples into migration in usages in target identified API generic migration target app app based on usages patches and rank patches them
APIM IGRATOR Overview API-Usage API-Usage Migration Examples Update Examples Generic Migration Analysis Search Analysis Migration Migration Examples Patches API-Usage Migration Report Migrate and Find migration Abstract migration Identify API validate API usages requiring examples for examples into migration in usages in target identified API generic migration target app app based on usages patches and rank patches them
Empirical Evaluation Research Questions RQ1 (E FFECTIVENESS ) : Can APIM IGRATOR migrate API usages in real-world apps? RQ2 (E FFICIENCY ) : What is the cost of running APIM IGRATOR ? RQ2 (E FFICIENCY ) : What is the cost of running APIM IGRATOR ?
Evaluation RQ1 (E FFECTIVENESS ) : Can APIM IGRATOR migrate API usages in real-world apps? • 17/20 (85%) successful update rate (for API usages) • 37/41 (90%) successful update rate (for API-usage occurrences) • 25/37 (68%) automatic validation rate (for API-usage occurrences) A PP E VOLVE is effective in automatically updating API usages. RQ2 (E FFICIENCY ) : What is the cost of running APIM IGRATOR ? Average Execution Time API-Usage Update Examples Update Examples API-Usage Analysis Search Analysis Update 28s 10h27m 2s204ms 20s The cost of the update examples search phase dominates the cost of the other phases.
Summary
Summary APIM IGRATOR VM https://zenodo.org/record/3668385
Recommend
More recommend