Abstract
The Android operating system is frequently updated, with each version bringing a new set of APIs. New versions may involve API deprecation; Android apps using deprecated APIs need to be updated to ensure the apps’ compatibility with old and new Android versions. Updating deprecated APIs is a time-consuming endeavor. Hence, automating the updates of Android APIs can be beneficial for developers. CocciEvolve is the state-of-the-art approach for this automation. However, it has several limitations, including its inability to resolve out-of-method variables and the low code readability of its updates due to the addition of temporary variables. In an attempt to further improve the performance of automated Android API update, we propose an approach named AndroEvolve, that addresses the limitations of CocciEvolve through the addition of data flow analysis and variable name denormalization. Data flow analysis enables AndroEvolve to resolve the value of any variable within the file scope. Variable name denormalization replaces temporary variables that may present in the CocciEvolve update with appropriate values in the target file. We have evaluated the performance of AndroEvolve and the readability of its updates on 372 target files containing 565 deprecated API usages. Each target file represents a file from an Android application that uses a deprecated API in its code. AndroEvolve successfully updates 481 out of 565 deprecated API invocations correctly, achieving an accuracy of 85.1%. Compared to CocciEvolve, AndroEvolve produces 32.9% more instances of correct updates. Moreover, our manual and automated evaluation shows that AndroEvolve updates are more readable than CocciEvolve updates.
Similar content being viewed by others
Notes
We use the Sample Size Calculator from the Australia Bureau of Statistics that supports stratified random sampling. The calculator is available from: https://www.abs.gov.au/websitedbs/D3310114.nsf/Home/Sample+Size+Calculator+Stratification+Examples
Landis and Koch (1977) define a kappa score in the range of 0.00-0.20 as slight agreement, 0.21-0.40 as fair agreement, 0.41-0.60 as moderate agreement, 0.61 and 0.80 as substantial agreement, and 0.81-1.00 as almost perfect agreement, respectively.
References
Asyrofi MH, Thung F, Lo D, Jiang L (2020) AUSearch: Accurate API usage search in GitHub repositories with type resolution. In: IEEE International Conference on Software Analysis, Evolution and Reengineering
Bakeman R, Gottman J (1986) Observing interaction: An introduction to sequential analysis
Bodík R, Gupta R (1997) Partial dead code elimination using slicing transformations. In: Proceedings of the ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation, PLDI ’97. Association for Computing Machinery, New York, pp 159–170
Brito G, Hora A, Valente MT, Robbes R (2016) Do developers deprecate APIs with replacement messages? a large-scale analysis on Java systems. In: SANER, vol 1. IEEE, pp 360–369
Brunel J, Doligez D, Hansen RR, Lawall JL, Muller G (2009) A foundation for flow-based program matching: using temporal logic and model checking. In: Principles of Programming Languages (POPL). ACM, pp 114–126
Buse R, Weimer W (2010) Learning a metric for code readability. IEEE Trans Softw Eng 36:546–558
Cohen J (1968) Weighted kappa: nominal scale agreement with provision for scaled disagreement or partial credit. Psychol Bullet 70 4:213–20
Cui Z, Jia M, Chen X, Zheng L, Liu X (2020) Improving software fault localization by combining spectrum and mutation. IEEE Access 8:172296–172307. https://doi.org/10.1109/ACCESS.2020.3025460
Fazzini M, Xin Q, Orso A (2019) Automated API-usage update for Android apps. In: ISSTA. ACM, pp 204–215
Ghandour WJ, Akkary H, Masri W (2010) The potential of using dynamic information flow analysis in data value prediction. In: Proceedings of the 19th International Conference on Parallel Architectures and Compilation Techniques, PACT ’10. Association for Computing Machinery, New York, pp 431–442
Gokhale A, Ganapathy V, Padmanaban Y (2013) Inferring likely mappings between APIs. In: Proceedings of the 2013 International Conference on Software Engineering, ICSE ’13. IEEE Press, pp 82–91
Gupta R, Benson DA, Fang JZ (1997) Path profile guided partial dead code elimination using predication. In: Proceedings 1997 International Conference on Parallel Architectures and Compilation Techniques, pp 102–113
Han D, Zhang C, Fan X, Hindle A, Wong K, Stroulia E (2012) Understanding Android fragmentation with topic analysis of vendor-specific bugs. In: 2012 19th Working Conference on Reverse Engineering. IEEE, pp 83–92
Haryono SA, Thung F, Kang HJ, Serrano L, Muller G, Lawall J, Lo D, Jiang L (2020) Automatic Android deprecated-API usage update by learning from single updated example. In: IEEE International Conference on Program Comprehension
Hoffmann J, Ussath M, Holz T, Spreitzenbarth M (2013) Slicing droids: Program slicing for Smali code. In: Proceedings of the 28th Annual ACM Symposium on Applied Computing, SAC ’13. Association for Computing Machinery, New York, pp 1844–1851
Hoffmann J, Ussath M, Holz T, Spreitzenbarth M (2013) Slicing Droids: Program slicing for Smali code. In: Proceedings of the 28th Annual ACM Symposium on Applied Computing, SAC ’13. https://doi.org/10.1145/2480362.2480706. Association for Computing Machinery, New York, pp 1844–1851
Hora A, Robbes R, Anquetil N, Etien A, Ducasse S, Valente MT (2015) How do developers react to API evolution? The Pharo ecosystem case. In: 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp 251–260
Jacobellis J, Meng N, Kim M (2013) LASE: An example-based program transformation tool for locating and applying systematic edits. In: 2013 35th International Conference on Software Engineering (ICSE), pp 1319–1322
Kang HJ, Thung F, Lawall J, Muller G, Jiang L, Lo D (2019) Semantic patches for Java program transformation (experience report). In: 33rd European Conference on Object-Oriented Programming (ECOOP 2019). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik
Khedker U, Sanyal A, Karkare B (2009) Data flow analysis: Theory and practice, 1st edn. CRC Press, Inc., USA
Kim Y, Mun S, Yoo S, Kim M (2019) Precise learn-to-rank fault localization using dynamic and static features of target programs. ACM Trans Softw Eng Methodol 28:1–34. https://doi.org/10.1145/3345628
Landis JR, Koch GG (1977) The measurement of observer agreement for categorical data. Biometrics 33(1):159–174
Lawall J, Muller G (2018) Coccinelle: 10 years of automated evolution in the Linux kernel. In: USENIX Annual Technical Conference, pp 601–614
Li J, Wang C, Xiong Y, Hu Z (2015) SWIN: Towards type-safe Java program adaptation between apis, pp 91–102
Li L, Bissyandé TF, Wang H, Klein J (2018) Cid: Automating the detection of API-related compatibility issues in Android apps. In: ISSTA. ACM, pp 153–163
Li L, Gao J, Bissyandé TF, Ma L, Xia X, Klein J (2018) Characterising deprecated Android APIs. In: Proceedings of the 15th International Conference on Mining Software Repositories (MSR). ACM, pp 254–264
McDonnell T, Ray B, Kim M (2013) An empirical study of API stability and adoption in the Android ecosystem. In: 2013 IEEE International Conference on Software Maintenance. IEEE, pp 70–79
Meng N, Kim M, McKinley KS (2013) LASE: Locating and applying systematic edits by learning from examples. In: ICSE. IEEE Press, pp 502–511
Mi Q, Keung J, Xiao Y, Mensah S, Gao Y (2018) Improving code readability classification using convolutional neural networks, vol 104. https://doi.org/10.1016/j.infsof.2018.07.006
Padioleau Y, Lawall J, Hansen RR, Muller G (2008) Documenting and automating collateral evolutions in Linux device drivers. In: European Conference on Computer Systems (EuroSys). ACM, pp 247–260
Pandita R, Jetley R, Sudarsan S, Menzies T, Williams L (2017) TMAP: Discovering relevant API methods through text mining of api documentation. J Softw Evol Process 29:e1845. https://doi.org/10.1002/smr.1845
Posnett D, Hindle A, Devanbu P (2011) A simpler model of software readability, pp 73–82. https://doi.org/10.1145/1985441.1985454
Robbes R, Lungu M, Röthlisberger D (2012) How do developers react to API deprecation?: the case of a Smalltalk ecosystem. In: FSE. ACM, p 56
Rolim R, Soares G, D’Antoni L, Polozov O, Gulwani S, Gheyi R, Suzuki R, Hartmann B (2017) Learning syntactic program transformations from examples. In: ICSE. IEEE Press, pp 404–415
Sawant AA, Robbes R, Bacchelli A (2018) On the reaction to deprecation of clients of 4 + 1 popular Java APIs and the JDK. EMSE 23(4):2158–2197
Scalabrino S, Bavota G, Vendome C, Linares-Vásquez M, Poshyvanyk D, Oliveto R (2017) Automatically assessing code understandability: How far are we?. In: 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE), pp 417–427
Scalabrino S, Linares-Vásquez M, Poshyvanyk D, Oliveto R (2016) Improving code readability models with textual features. In: 2016 IEEE 24th International Conference on Program Comprehension (ICPC), pp 1–10
Scalabrino S, Linares-Vásquez M, Oliveto R, Poshyvanyk D (2018) A comprehensive model for code readability. J Softw Evol Process 30
Thung F, Haryono SA, Serrano L, Muller G, Lawall J, Lo D, Jiang L (2020) Automated deprecated-API usage update for Android apps: How far are we?. In: IEEE International Conference on Software Analysis, Evolution and Reengineering
Strobl R, Troníc~ek Z (2013) Migration from deprecated API in Java, pp 85–86. https://doi.org/10.1145/2508075.2508093
Upton G (1992) Fisher’s exact test. J R Stat Soc Ser A (Stat Soc) 192:395–402. https://doi.org/10.2307/2982890
van Bruggen D, Tomassetti F, Howell R, Langkabel M, Smith N, Bosch A, Skoruppa M, Maximilien C, ThLeu, Panayiotis, (@skirsch79) SK, Simon, Beleites J, Tibackx W, LJP, Rouél A, edefazio, Schipper D, Mathiponds, you want to know W, Beckett R, ptitjes, kotari4u, Wyrich M, Morais R, bresai, Ty, Lebouc R, Implex1v, Haumacher B (2020) javaparser/javaparser: Release javaparser- parent-3.15.22
Visser E (2001) Stratego: A language for program transformation based on rewriting strategies. In: Proceedings of the 12th International Conference on Rewriting Techniques and Applications, RTA ’01. Springer, pp 357–362
Wei L, Liu Y, Cheung S-C (2016) Taming Android fragmentation: Characterizing and detecting compatibility issues for Android apps. In: ASE. IEEE, pp 226–237
Weiser M (1984) Program slicing. IEEE Trans Softw Eng SE-10(4):352–357
Xi Y, Shen L, Gui Y, Zhao W (2019) Migrating deprecated api to documented replacement: Patterns and tool, pp 1–10. https://doi.org/10.1145/3361242.3361246
Yang G, Jones J, Moninger A, Che M (2018) How do Android operating system updates impact apps?. In: Proceedings of the 5th International Conference on Mobile Software Engineering and Systems. ACM, pp 156–160
Zhang M, Li Y, Li X, Chen L, Zhang Y, Zhang L, Khurshid S (2019) An empirical study of boosting spectrum-based fault localization via pagerank. IEEE Trans Softw Eng PP:1–1. https://doi.org/10.1109/TSE.2019.2911283
Zhou J, Walker RJ (2016) API deprecation: a retrospective analysis and detection method for code examples on the web. In: ICSE. ACM, pp 266–277
Zhou X, Lee Y, Zhang N, Naveed M, Wang X (2014) The peril of fragmentation: Security hazards in Android device driver customizations. Proc - IEEE Symp Secur Privacy:409–423
Funding
This research is supported by the Singapore National Research Foundation (award number: NRF2016-NRF-ANR003) and the ANR ITrans project.
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by: Gabriele Bavota
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Haryono, S.A., Thung, F., Lo, D. et al. AndroEvolve: automated Android API update with data flow analysis and variable denormalization. Empir Software Eng 27, 73 (2022). https://doi.org/10.1007/s10664-021-10096-0
Accepted:
Published:
DOI: https://doi.org/10.1007/s10664-021-10096-0