Project Details
Funding Scheme : General Research Fund
Project Number : 611813
Project Title(English) : Diagnosing Energy Inefficiencies in Mobile Applications based on Observable Sensory Data Utilization 
Project Title(Chinese) : 基于傳感器數據使用率的移動應用程式中能源低效利用问题的诊断方法 
Principal Investigator(English) : Prof Cheung, Shing-chi 
Principal Investigator(Chinese) :  
Department : Dept of Computer Science & Engineering
Institution : The Hong Kong University of Science and Technology
E-mail Address : scc@cse.ust.hk 
Tel : 2358 7016 
Co - Investigator(s) :
Panel : Engineering
Subject Area : Computing Science & Information Technology
Exercise Year : 2013 / 14
Fund Approved : 500,000
Project Status : Completed
Completion Date : 30-6-2017
Project Objectives :
To tabulate the common energy inefficiency issues arising from mobile software and identify their causes.
To develop a framework that supports the analysis of energy inefficiency over mobile software.
To implement the proposed framework and evaluate it using real mobile applications.
Abstract as per original application

Realisation of objectives: Smartphone applications’ energy efficiency is vital, but many Android applications suffer from serious energy inefficiency. Locating these energy problems is labor-intensive and automated diagnosis is thus desirable. This motivates us to tabulate common energy inefficiency issues and developed a framework to analyze energy inefficiency of Android apps in this project. To achieve the first objective, we collected 608 candidates from Google Play Store [17] using a web crawler. These applications have release logs containing at least one of the following keywords: battery, energy, efficiency, consumption, power, and drain. We then performed manual examination to ensure that these applications indeed were infected with energy problems and developers have fixed these problems in the applications’ latest versions (note that we did not have access to their earlier versions containing energy problems). To find interesting open-source subjects, we first randomly selected 250 candidates GitHub and SourceForge. Since we are interested in applications with a certain level of development maturity, we refined our selection by retaining those applications that: (1) have at least 1,000 downloads, (2) have a public bug tracking system, and (3) have multiple versions. We studied our collected subjects’ real bug reports, commit logs, bug-fixing patches and release logs concerning energy problems occurring to open-source and commercial Android apps. Major causes leading to energy inefficiencies were identified. With these findings, we carried out studies for the second objective and developed a framework to automatically diagnosing such energy inefficiencies. A key challenge in diagnosing energy inefficiencies at mobile applications is that the absence of a decidable criterion that facilitates effective assessment on the occurrences of such inefficiencies. We developed a technique to address this challenge. Our approach explores an application’s state space by systematically executing the application using Java PathFinder (JPF). It monitors sensor and wake lock operations to detect missing deactivation of sensors and wake locks. It also tracks the transformation and usage of sensory data and judges whether they are effectively used by the application using our state-sensitive data utilization metric. By doing so, we can generate detailed reports with actionable in-formation to assist developers in validating detected energy inefficiencies. Another key challenge is that Android applications are event-driven and highly hinge on user interactions. Their program code comprises many loosely coupled event handlers, among which no explicit control flow is specified. At runtime, these event handlers are called by the An-droid framework, which builds on hundreds of native library classes. Automated diagnosis requires: (1) generation of valid user interaction events, and (2) correct scheduling of event handlers. To address this challenge, we developed technique to analyze an Android application’s GUI layout configuration files, and systematically enumerate all possible user interaction event sequences with a bounded length at runtime. We showed that such a bounded length does not impair the effectiveness of our analysis, but instead helps quickly explore different application states and identify energy problems. We developed an application execution model derived from Android specifications. This model captures application-generic temporal rules that specify calling relationships between event handlers. With this model, we are able to ensure an Android application to be exercised with correct control flows, rather than being randomly scheduled on its event handlers. To achieve the third objective, a tool called GreenDroid was built on top of Java PathFinder (JPF), a model checker for Java programs. All three proposed project objectives were successfully completed with a set of evaluation datasets and tools implementing the proposed framework made available to the public at: - GreenDroid: The major framework that automatically detects energy inefficiencies at Android apps. The tool and evaluation dataset are available at http://sccpu2.cse.ust.hk/greendroid/. - Elite: A framework component that supplements GreenDroid to automatically detect and locate wakelocks that induce both functional and non-functional issues in Android apps. The tool and its evaluation dataset are available at http://sccpu2.cse.ust.hk/elite/toc.html.
Summary of objectives addressed:
Objectives Addressed Percentage achieved
1.To tabulate the common energy inefficiency issues arising from mobile software and identify their causes.Yes100%
2.To develop a framework that supports the analysis of energy inefficiency over mobile software.Yes100%
3.To implement the proposed framework and evaluate it using real mobile applications.Yes100%
Research Outcome
Major findings and research outcome: The findings of this project were disseminated at five reputable journal articles (2xTSE, IEEE Software, IJSI, SCIS) and seven reputable conference publications (2xICSE, 2xASE, POPL, FSE and ISSTA). Two PhD students were trained. Our publication at ASE 2016 was were highly recognized by the software engineering community and received the ACM SIGSOFT Distinguished Paper award. We summarize selected findings as follows. - Although root causes of energy problems can vary with different applications, majority of them (over 60%) are closely related to two types of coding phenomena. The first phenomenon arises from missing sensor or wake lock deactivation. To use a smartphone sensor, an application needs to register a listener with the Android OS. The listener should be unregistered when the concerned sensor is no longer needed. Similarly, an application needs to acquire a wake lock from the Android OS. The acquired wake lock should be released as soon as the computation completes. The second phenomenon arises from sensory data underutilization. Smartphone sensors probe their environments and collect sensory data. These data are obtained at the cost of battery energy and therefore should be well utilized by applications. Poor sensory data utilization could result in energy waste. - Energy problems are serious. They have covered many types of Android applications and affected potentially millions of users. - It is relatively more difficult to diagnose and fix energy problems, as compared to non-energy bugs; user interaction con-texts and debugging logs can help problem diagnosis, but they require additional reporting efforts, which may not be desirable. - Two common patterns of energy inefficiencies can be identified: missing sensor or wake lock deactivation and sensory data underutilization. - Many energy-efficient mobile apps are written to adjust their behavior dynamically in response to changes in their runtime contexts (e.g., environmental conditions). We found that certain some context changes can result in unstable inconsistency detection of these changes. Such unstable detection can be effectively suppressed by pre-defined change patterns. - Over 27.2% of Android apps utilizes wake locks to protect critical computation. Computational tasks protected by wake locks are often run asynchronously and could be long running, and can bring users observable or perceptible benefits. - Eight patterns are found to commonly accountable for wake lock misuses: unnecessary wakeup, wake lock leakage, premature lock releasing, multiple lock acquisitions, inappropriate lock type, erroneous timeout setting, inappropriate flags, and permission errors.
Potential for further development of the research
and the proposed course of action:
We hope that in future more efforts from research communities and industries can be devoted to designing useful techniques to help developers combat energy and performance bugs in their smartphone applications. We believe that energy and performance diagnosis is becoming increasingly important as mobile applications continually integrate themselves into people’s daily lives. Our findings lead to the following future work. - Extend energy inefficiency diagnosis to other non-functional issues in mobile applications. - Extend energy inefficiency diagnosis to hybrid mobile applications such as those running on top of an Android Webview component. - Automatically locate the root cause of a detected energy inefficiency and repair it accordingly. - Further enrich our current dataset with new issues found in mobile apps launched over emerging Android OS. - Extend the framework to conduct diagnosis for new Android OS. - Adapt the framework to iOS applications.
Layman's Summary of
Completion Report:
The mobile app market is expanding rapidly. Many mobile applications are realized in an energy-inefficient or performance-ill way, seriously affecting user experience. There are a lack of powerful tools to combat energy inefficiency problems. In this project, we developed an effective framework for automated energy inefficiency diagnosis in mobile applications. We studied the characteristics of these bugs and developed automated techniques to address three major challenges: (a) how to trigger an energy bug, how to judge the occurrence of energy inefficiency, and how to determine the amount of diagnosis. We released our framework and experimental datasets to the public, and disseminate our research results in reputed research venues. Our results were well received and award-winning. Two PhD students were trained.
Research Output
Peer-reviewed journal publication(s)
arising directly from this research project :
(* denotes the corresponding author)
Year of
Author(s) Title and Journal/Book
2014 Yepang Liu, Chang Xu*, S.C. Cheung*, and Wenhua Yang  CHECKERDROID: Automated Quality Assurance for Smartphone Applications, International Journal of Software and Informatics (IJSI), vol. 8, no. 1, 2014, pp. 21-41. 
2014 Yepang Liu, Chang Xu*, S.C. Cheung, and Jian Lu  GreenDroid: Automated Diagnosis of Energy Inefficiency for Smartphone Applications, IEEE Transactions on Software Engineering 40(9), September 2014, pp. 911-940 
2015 Yepang Liu, Chang Xu and S.C. Cheung*  Diagnosing Energy Efficiency and Performance for Mobile Internetware Applications: Challenges and Opportunities, IEEE Software, Jan/Feb 2015, pp. 2-10 
2015 Wenhua Yang, Yepang Liu, Chang Xu and S.C. Cheung*  A Survey on Dependability Improvement Techniques for Pervasive Computing Systems, SCIENCE CHINA Information Sciences (SCIS) 58(5), May 2015, pp. 1-14 
2015 Chang Xu, Wang Xi, S.C. Cheung, Xiaoxing Ma, Chun Cao and Jian Lu  CINA: Suppressing the Detection of Unstable Context Inconsistency, IEEE Transactions on Software Engineering 41(9), September 2015, pp. 842-865 
Recognized international conference(s)
in which paper(s) related to this research
project was/were delivered :
Month/Year/City Title Conference Name
Florence RECONTEST: Effective Regression Testing of Concurrent Programs  International Conference on Software Engineering (ICSE 2015) 
St. Petersburg Casper: An Efficient Approach to Call Trace Collection  ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016) 
Austin Coverage-Driven Test Code Generation for Concurrent Classes  International Conference on Software Engineering (ICSE 2016) 
Saarbrücken CSNIPPEX: Automated Synthesis of Compilable Code Snippets from Q&A Sites  International Symposium on Software Testing and Analysis (ISSTA 2016) 
Singapore Locus: Locating Bugs from Software Changes  IEEE/ACM International Conference on Automated Software Engineering (ASE 2016) 
Singapore Taming Android Fragmentation: Characterizing and Detecting Compatibility Issues for Android Apps  IEEE/ACM International Conference on Automated Software Engineering (ASE 2016). ACM SIGSOFT Distinguished Paper Award 
Seattle Understanding and Detecting Wake Lock Misuses for Android Applications  ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE 2016) 
Other impact
(e.g. award of patents or prizes,
collaboration with other research institutions,
technology transfer, etc.):