Abstract
Mobile operating systems, especially Android, expose apps to a volatile runtime environment. The app state that reflects past user interaction and system environment updates (e.g., battery status changes) can be destroyed implicitly, in response to runtime configuration changes (e.g., screen rotations) or memory pressure. Developers are therefore responsible for identifying app state affected by volatility and preserving it across app lifecycles. When handled inappropriately, the app may lose state or end up in an inconsistent state after a runtime configuration change or when users return to the app.
To free developers from this tedious and error-prone task, we propose a systematic solution, LiveDroid, which precisely identifies the necessary part of the app state that needs to be preserved across app lifecycles, and automatically saves and restores it. LiveDroid consists of: (i) a static analyzer that reasons about app source code and resource files to pinpoint the program variables and GUI properties that represent the necessary app state, and (ii) a runtime system that manages the state saving and recovering. We implemented LiveDroid as a plugin in Android Studio and a patching tool for APKs. Our evaluation shows that LiveDroid can be successfully applied to 966 Android apps. A focused study with 36 Android apps shows that LiveDroid identifies app state much more precisely than an existing solution that includes all mutable program variables but ignores GUI properties. As a result, on average, LiveDroid is able to reduce the costs of state saving and restoring by 16.6X (1.7X - 141.1X) and 9.5X (1.1X - 43.8X), respectively. Furthermore, compared with the manual state handling performed by developers, our analysis reveals a set of 46 issues due to incomplete state saving/restoring, all of which can be successfully eliminated by LiveDroid.
Supplemental Material
- 2020. Glucosio for Android. https://github.com/Glucosio/glucosio-android. Accessed: 2020-07-22.Google Scholar
- 2020. K-9 Mail. https://github.com/k9mail/k-9. Accessed: 2020-07-22.Google Scholar
- 2020. MapBox. https://github.com/mapbox/mapbox-gl-native. Accessed: 2020-09-08.Google Scholar
- 2020. Open MF. https://github.com/openMF/android-client. Accessed: 2020-09-08.Google Scholar
- 2020. StackOveflow Question 456211. https://stackoverflow.com/questions/456211/activity-restart-on-rotation-android. Accessed: 2020-09-08.Google Scholar
- 2020. TileView Library. https://github.com/moagrius/TileView. Accessed: 2020-09-08.Google Scholar
- 2020. WordPress-Android. https://github.com/wordpress-mobile/WordPress-Android. Accessed: 2020-09-08.Google Scholar
- Christofer Quist Adamsen, Gianluca Mezzetti, and Anders Møller. 2015. Systematic execution of android test suites in adverse conditions. In Proceedings of the 2015 International Symposium on Software Testing and Analysis. ACM, 83-93.Google Scholar
Digital Library
- Alfred V Aho, Monica S Lam, Ravi Sethi, and Jefrey D Ullman. 2006. Compilers: Principles Techniques and Tools. 2007. Google Scholar Google Scholar Digital Library Digital Library ( 2006 ).Google Scholar
- Elvira Albert, Samir Genaim, and Miguel Gómez-Zamalloa Gil. 2009. Live heap space analysis for languages with garbage collection. In Proceedings of the 2009 international symposium on Memory management. 129-138.Google Scholar
Digital Library
- alliedmarketresearch. 2020. Mobile Application Market by Marketplace. https://www.alliedmarketresearch.com/mobileapplication-market. Accessed: 2020-04-30.Google Scholar
- Apple. 2020a. About the Virtual Memory System. https://developer.apple.com/library/archive/documentation/Performance/ Conceptual/ManagingMemory/Articles/MemoryAlloc.html. Accessed: 2020-09-08.Google Scholar
- Apple. 2020b. Preserving Your App's UI Across Launches. https://developer.apple.com/documentation/uikit/view_controllers/preserving_your_app_s_ui_across_launches. Accessed: 2020-10-06.Google Scholar
- Apple. 2020c. Reducing Disk Writes. https://developer.apple.com/documentation/xcode/improving_your_app_s_performance/reducing_disk_writes. Accessed: 2020-09-08.Google Scholar
- Apple. 2020d. Reducing Your App's Memory Use. https://developer.apple.com/documentation/xcode/improving_your_app_s_performance/reducing_your_app_s_memory_use. Accessed: 2020-09-08.Google Scholar
- Niaz Arijo, Reiko Heckel, Mirco Tribastone, and Stephen Gilmore. 2011. Modular performance modelling for mobile applications. In ACM SIGSOFT Software Engineering Notes, Vol. 36. ACM, 329-334.Google Scholar
Digital Library
- Steven Arzt, Siegfried Rasthofer, Christian Fritz, Eric Bodden, Alexandre Bartel, Jacques Klein, Yves Le Traon, Damien Octeau, and Patrick McDaniel. 2014. FlowDroid: Precise Context, Flow, Field, Object-sensitive and Lifecycle-aware Taint Analysis for Android Apps. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '14). ACM, New York, NY, USA, 259-269. https://doi.org/10.1145/2594291.2594299 Google Scholar
Digital Library
- Gabriele Bavota, Bernardino De Carluccio, Andrea De Lucia, Massimiliano Di Penta, Rocco Oliveto, and Orazio Strollo. 2012. When does a refactoring induce bugs? an empirical study. In Source Code Analysis and Manipulation (SCAM), 2012 IEEE 12th International Working Conference on. IEEE, 104-113.Google Scholar
Digital Library
- Luca Berardinelli, Vittorio Cortellessa, and Antinisca Di Marco. 2010. Performance modeling and analysis of context-aware mobile software systems. Fundamental Approaches to Software Engineering ( 2010 ), 353-367.Google Scholar
- Sam Blackshear, Nikos Gorogiannis, Peter W O'Hearn, and Ilya Sergey. 2018. RacerD: compositional static race detection. Proceedings of the ACM on Programming Languages 2, OOPSLA ( 2018 ), 1-28.Google Scholar
Digital Library
- Eric Bodden. 2012. Inter-procedural data-flow analysis with ifds/ide and soot. In Proceedings of the ACM SIGPLAN International Workshop on State of the Art in Java Program analysis. ACM, 3-8.Google Scholar
Digital Library
- Arnab De and Deepak D'Souza. 2012. Scalable Flow-Sensitive Pointer Analysis for Java with Strong Updates. In ECOOP 2012-Object-Oriented Programming-26th European Conference, Beijing, China, June 11-16, 2012. Proceedings (Lecture Notes in Computer Science), James Noble (Ed.), Vol. 7313. Springer, 665-687. https://doi.org/10.1007/978-3-642-31057-7_29 Google Scholar
Digital Library
- F-Droid. 2020. F-Droid. https://f-droid.org/. Accessed: 2020-07-22.Google Scholar
- Umar Farooq and Zhijia Zhao. 2018. RuntimeDroid: Restarting-Free Runtime Change Handling for Android Apps. In Proceedings of the 16th ACM International Conference on Mobile Systems, Applications, and Services (MobiSys '18). ACM, New York, NY, USA, 110-122. https://doi.org/10.1145/3210240.3210327 Google Scholar
Digital Library
- George Fourtounis and Yannis Smaragdakis. 2019. Deep Static Modeling of invokedynamic. In 33rd European Conference on Object-Oriented Programming.Google Scholar
- Github. 2020. Github. https://github.com/. Accessed: 2020-09-10.Google Scholar
- Google. 2020a. Android AsyncTask. https://developer.android.com/reference/android/os/AsyncTask. Accessed: 2020-08-30.Google Scholar
- Google. 2020b. Android Developer Guides: Handle Configuration Changes. https://developer.android.com/guide/topics/ resources/runtime-changes. Accessed: 2020-04-30.Google Scholar
- Google. 2020c. Android NativeActivity. https://developer.android.com/reference/android/app/NativeActivity. Accessed: 2020-08-30.Google Scholar
- Google. 2020d. Android Processes and Application Lifecycle. https://developer.android.com/guide/components/activities/ process-lifecycle. Accessed: 2020-04-30.Google Scholar
- Google. 2020e. Android Saving UI States. https://developer.android.com/topic/libraries/architecture/saving-states. Accessed: 2020-04-30.Google Scholar
- Google. 2020f. IntentService. https://developer.android.com/reference/android/app/IntentService. Accessed: 2020-09-10.Google Scholar
- Google. 2020g. A Java serialization/deserialization library to convert Java Objects into JSON and back. https://github.com/ google/gson. Accessed: 2020-4-30.Google Scholar
- Google. 2020h. Overview of memory management. https://developer.android.com/topic/performance/memory-overview. Accessed: 2020-04-30.Google Scholar
- Google. 2020i. Services overview. https://developer.android.com/guide/components/services. Accessed: 2020-09-10.Google Scholar
- Google. 2020j. ViewModel Overview. https://developer.android.com/topic/libraries/architecture/viewmodel. Accessed: 2020-09-08.Google Scholar
- GooglePlay. 2020. Google Play. https://play.google.com/. Accessed: 2020-07-22.Google Scholar
- Chun-Hung Hsiao, Jie Yu, Satish Narayanasamy, Ziyun Kong, Cristiano L Pereira, Gilles A Pokam, Peter M Chen, and Jason Flinn. 2014. Race detection for event-driven mobile applications. ACM SIGPLAN Notices 49, 6 ( 2014 ), 326-336.Google Scholar
- Cuixiong Hu and Iulian Neamtiu. 2011. Automating GUI testing for Android applications. In Proceedings of the 6th International Workshop on Automation of Software Test. ACM, 77-83.Google Scholar
Digital Library
- Gang Hu, Xinhao Yuan, Yang Tang, and Junfeng Yang. 2014. Eficiently, efectively detecting mobile app bugs with appdoctor. In Proceedings of the Ninth European Conference on Computer Systems. ACM, 18.Google Scholar
Digital Library
- Niel Lebeck, Arvind Krishnamurthy, Henry M. Levy, and Irene Zhang. 2020. End the Senseless Killing: Improving Memory Management for Mobile Operating Systems. In 2020 USENIX Annual Technical Conference (USENIX ATC 20). USENIX Association, 873-887. https://www.usenix.org/conference/atc20/presentation/lebeckGoogle Scholar
- K Rustan M Leino and Peter Müller. 2004. Object invariants in dynamic contexts. In European Conference on Object-Oriented Programming. Springer, 491-515.Google Scholar
Cross Ref
- Ondřej Lhoták and Laurie Hendren. 2003. Scaling Java Points-to Analysis Using Spark. In Compiler Construction, 12th International Conference (LNCS), G. Hedin (Ed.), Vol. 2622. Springer, Warsaw, Poland, 153-169.Google Scholar
- Chieh-Jan Mike Liang, Nicholas D Lane, Niels Brouwers, Li Zhang, Börje F Karlsson, Hao Liu, Yan Liu, Jun Tang, Xiang Shan, Ranveer Chandra, et al. 2014. Caiipa: Automated large-scale mobile app testing through contextual fuzzing. In Proceedings of the 20th annual international conference on Mobile computing and networking. ACM, 519-530.Google Scholar
Digital Library
- Max Lillack, Christian Kästner, and Eric Bodden. 2014. Tracking load-time configuration options. In Proceedings of the 29th ACM/IEEE international conference on Automated software engineering. ACM, 445-456.Google Scholar
Digital Library
- Yu Lin, Cosmin Radoi, and Danny Dig. 2014. Retrofitting concurrency for android applications through refactoring. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. ACM, 341-352.Google Scholar
Digital Library
- Yepang Liu, Chang Xu, and Shing-Chi Cheung. 2014. Characterizing and detecting performance bugs for smartphone applications. In Proceedings of the 36th International Conference on Software Engineering. ACM, 1013-1024.Google Scholar
Digital Library
- Pallavi Maiya, Aditya Kanade, and Rupak Majumdar. 2014. Race detection for android applications. In ACM SIGPLAN Notices, Vol. 49. ACM, 316-325.Google Scholar
Digital Library
- Henry Muccini, Antonio Di Francesco, and Patrizio Esposito. 2012. Software testing of mobile applications: Challenges and future research directions. In Proceedings of the 7th International Workshop on Automation of Software Test. IEEE Press, 29-35.Google Scholar
Cross Ref
- Semih Okur, David L Hartveld, Danny Dig, and Arie van Deursen. 2014. A study and toolkit for asynchronous programming in C. In Proceedings of the 36th International Conference on Software Engineering. ACM, 1117-1127.Google Scholar
Digital Library
- Thomas Reps, Susan Horwitz, and Mooly Sagiv. 1995. Precise interprocedural dataflow analysis via graph reachability. In Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages. ACM, 49-61.Google Scholar
Digital Library
- Cagri Sahin, Lori Pollock, and James Clause. 2014. How do code refactorings afect energy usage?. In Proceedings of the 8th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement. ACM, 36.Google Scholar
Digital Library
- Malavika Samak, Murali Krishna Ramanathan, and Suresh Jagannathan. 2015. Synthesizing racy tests. ACM SIGPLAN Notices 50, 6 ( 2015 ), 175-185.Google Scholar
- Malavika Samak, Omer Tripp, and Murali Krishna Ramanathan. 2016. Directed synthesis of failing concurrent executions. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications. 430-446.Google Scholar
Digital Library
- Max Schäfer, Julian Dolby, Manu Sridharan, Emina Torlak, and Frank Tip. 2010. Correct refactoring of concurrent java code. ECOOP 2010-Object-Oriented Programming ( 2010 ), 225-249.Google Scholar
Cross Ref
- Max Schafer, Manu Sridharan, Julian Dolby, and Frank Tip. 2011. Refactoring Java programs for flexible locking. In Software Engineering (ICSE), 2011 33rd International Conference on. IEEE, 71-80.Google Scholar
Digital Library
- Zhiyong Shan, Tanzirul Azim, and Iulian Neamtiu. 2016. Finding resume and restart errors in Android applications. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications. ACM, 864-880.Google Scholar
Digital Library
- Soot. 2020. Soot: a Java Optimization Framework. https://www.sable.mcgill.ca/soot/. Accessed: 2020-07-01.Google Scholar
- Manu Sridharan, Satish Chandra, Julian Dolby, Stephen J Fink, and Eran Yahav. 2013. Alias analysis for object-oriented programs. In Aliasing in Object-Oriented Programming. Types, Analysis and Verification. Springer, 196-232.Google Scholar
- Manu Sridharan, Denis Gopan, Lexin Shan, and Rastislav Bodík. 2005. Demand-Driven Points-to Analysis for Java. SIGPLAN Not. 40, 10 (Oct. 2005 ), 59-76. https://doi.org/10.1145/1103845.1094817 Google Scholar
Digital Library
- Statista. 2020. Mobile operating systems' market share worldwide from January 2012 to July 2020. https://www.statista. com/statistics/272698/global-market-share-held-by-mobile-operating-systems-since-2009 /. Accessed: 2020-09-08.Google Scholar
- statista. 2020. Number of smartphone users worldwide 2016-2021. https://www.statista.com/statistics/330695/number-ofsmartphone-users-worldwide/. Accessed: 2020-04-30.Google Scholar
- Omer Tripp, Marco Pistoia, Patrick Cousot, Radhia Cousot, and Salvatore Guarnieri. 2013. Andromeda: Accurate and Scalable Security Analysis of Web Applications. In Proceedings of the 16th International Conference on Fundamental Approaches to Software Engineering (Lecture Notes in Computer Science), Vol. 7793. Springer International Publishing, 210-225. https://doi.org/10.1007/978-3-642-37057-1_15 Google Scholar
Digital Library
- Guoqing Xu, Atanas Rountev, and Manu Sridharan. 2009. Scaling CFL-reachability-based points-to analysis using contextsensitive must-not-alias analysis. In European Conference on Object-Oriented Programming. Springer, 98-122.Google Scholar
- Dacong Yan, Guoqing Xu, and Atanas Rountev. 2011. Demand-Driven Context-Sensitive Alias Analysis for Java (ISSTA '11). Association for Computing Machinery, New York, NY, USA, 155-165. https://doi.org/10.1145/2001420.2001440 Google Scholar
Digital Library
- Dacong Yan, Shengqian Yang, and Atanas Rountev. 2013. Systematic testing for resource leaks in Android applications. In Software Reliability Engineering (ISSRE), 2013 IEEE 24th International Symposium on. IEEE, 411-420.Google Scholar
Cross Ref
- Razieh Nokhbeh Zaeem, Mukul R Prasad, and Sarfraz Khurshid. 2014. Automated generation of oracles for testing userinteraction features of mobile apps. In Software Testing, Verification and Validation (ICST), 2014 IEEE Seventh International Conference on. IEEE, 183-192.Google Scholar
Index Terms
LiveDroid: identifying and preserving mobile app state in volatile runtime environments
Recommendations
An Explorative Study of the Mobile App Ecosystem from App Developers' Perspective
WWW '17: Proceedings of the 26th International Conference on World Wide WebWith the prevalence of smartphones, app markets such as Apple App Store and Google Play has become the center stage in the mobile app ecosystem, with millions of apps developed by tens of thousands of app developers in each major market. This paper ...
Finding resume and restart errors in Android applications
OOPSLA '16Smartphone apps create and handle a large variety of ``instance'' data that has to persist across runs, such as the current navigation route, workout results, antivirus settings, or game state. Due to the nature of the smartphone platform, an app can ...
Finding resume and restart errors in Android applications
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsSmartphone apps create and handle a large variety of ``instance'' data that has to persist across runs, such as the current navigation route, workout results, antivirus settings, or game state. Due to the nature of the smartphone platform, an app can ...






Comments