The Ohio State University
Detection of Energy-Inefficiency Patterns in Android Applications
Abstract
dc:descriptionAndroid has become the most widely used mobile platform. Android developers continuously introduce new features to their applications, which are consequently becoming increasingly complex. This complexity could lead to a variety of software defects. Due to the limited battery capacity of Android mobile devices, energy-related defects are of significant importance to developers and app users. This motivates our work to focus on detecting energy-inefficiency patterns on Android apps.One important source of energy inefficiency is missing deactivation of energy-related resources. Such resources are acquired during execution and continue to be held by the app even after they are not being used. As the first contribution of this dissertation, we present a static analysis to detect energy leaks caused by GPS listeners. Such listeners keep the GPS active and can cause considerable battery drain. Existing work on similar problems is mainly based on static or dynamic program analysis. For dynamic analysis, one shortcoming is that it is difficult to achieve high code coverage, and code regions that contain energy-related leaks might not be executed. For static analysis, one difficulty is that Android apps are event-driven and their run-time behavior depends on the sequence of callbacks from the Android framework to app. Such callback sequences are not modeled effectively by existing static analyses. We aim to solve this problem by using a comprehensive static model of Android GUI behavior, and paying careful attention to feasibility constraints for GUI event sequences and their related callback sequences. Based on this modeling of Android GUI control-flow paths, and the conditions for GPS listener leaks along such paths, we define two patterns of run-time energy-drain behaviors. Next, we develop a static detection algorithm targeting these patterns. The analysis considers valid interprocedural control-flow paths in a callback method and its transitive callees, in order to detect operations that add or remove GPS listeners. Sequences of callbacks are then analyzed for possible GPS listener leaks. Our evaluation considers the detection of GUI-related energy-drain defects reported in prior work, as well as new defects not discovered by prior approaches. The results from this evaluation demonstrate that the detection is very effective and precise, suggesting that the proposed analysis is suitable for practical use in static checking tools for Android.As the second contribution of this dissertation, we extend the static detection of missing deactivation to Android sensor resources. Similarly to GPS resources, a sensor resource held by an application will not be released by the Android system even if it has been idle for a long time, which will cause battery drain. To detect sensor leaksstatically in Android apps, we first perform static modeling of sensor-related objects and API calls. This information is integrated into a static graph model. Graph edges are labeled with symbols representing the opening/closing of UI windows and the acquiring/releasing of sensors. We then define a context-free-language reachability (CFL-R) problem over the graph. A CFL-R graph path is a “witness” of a sensor leak. Given this formulation, we describe an approach to identify leaking paths. The reported paths are then used to generate test cases. The execution of each test case tracks the run-time behavior of sensors and reports observed leaks. Our experimental results indicate that this approach effectively detects sensor leaks, while focusing the testing efforts on a very small subset of possible GUI event sequences.Another aspect of energy inefficiency comes from improper usage of energy-intensive Android system services. One such service is the AlarmManager service, which allows an application to execute tasks at specific times. This service is commonly used to perform periodic background tasks such as updating application contents and uploading user data. In normal conditions, these background tasks frequently wake the device from low power sleep. Recent Android releases introduce JobService, a new component that is better suited for such background tasks. While alarms scheduled by AlarmManager are fired at specific times set up by the application, a job definedby a JobService will be batched with other jobs to reduce device wake ups and save energy. As our third contribution, we propose a static analysis to detect energy-inefficient uses of AlarmManager. We define a static reference analysis to determine possible values of parameters used in each alarm scheduling call, which are then used to determine whether the alarm may have negative energy impact. The identified problematic alarms are processed by our automated code refactoring engine and are converted to jobs, while still retaining their original functionality. Our evaluation shows that this approach successfully reduces energy consumption.In conclusion, this dissertation presents several static analyses to uncover different types of energy-inefficiency patterns of Android applications, with automated test-ing to verify certain inefficiencies and automated code refactoring to improve energy usage. Our evaluation shows that these analyses are effective and efficient.
Degree
thesis:*- Name thesis:degree_name
- Doctor of Philosophy
- Level thesis:degree_level
- doctoral
- Discipline thesis:degree_discipline
- Computer Science and Engineering
- Grantor dc:publisher
- The Ohio State University
- Year dc:date
- 2018
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Wu , Haowei
- Advisor dc:contributor.advisor
-
- Rountev, Atanas
Subjects
dc:subject × 1Rights
dc:rights- Statement dc:rights
-
- unrestricted
- This thesis or dissertation is protected by copyright: some rights reserved. It is licensed for use under a Creative Commons license. Specific terms and permissions are available from this document's record in the OhioLINK ETD Center.
- Language dc:language
- English
Identifiers
dc:identifier.*- Repository record dc:identifier
- http://rave.ohiolink.edu/etdc/view?acc_num=osu1534341070203459