Skip to main content

Detecting Energy Bugs in Android Apps Using Static Analysis

  • Conference paper
  • First Online:
Formal Methods and Software Engineering (ICFEM 2017)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 10610))

Included in the following conference series:

Abstract

Energy bugs in Android apps are defects that can make Android systems waste much energy as a whole. Energy bugs detection in Android apps has become an important issue since smartphones usually operate on a limited amount of battery capacity and the existence of energy bugs may lead to serious drain in the battery power. This paper focuses on detecting two types of energy bugs, namely resource leak and layout defect, in Android apps. A resource leak is a particular type of energy wasting phenomena where an app does not release its acquired resources such as a sensor and GPS. A layout defect refers to a poor layout structure causing more energy consumption for measuring and drawing the layout. In this paper, we present a static analysis technique called SAAD, that can automatically detect energy bugs in a context-sensitive way. SAAD detects the energy bugs by taking an inter-procedural anaysis of an app. For resource leak analysis, SAAD decompiles APK file into Dalvik bytecodes files and then performs resource leak analysis by taking components call relationship analysis, inter-procedure and intra-procedure analysis. For detecting layout defect, SAAD firstly employs Lint to perform some traditional app analysis, then filters energy defects from reported issues. Our experimental result on 64 publicly-available Android apps shows that SAAD can detect energy bugs effectively. The accuracies of detecting resource leak and layout energy defect are \(87.5\%\) and \(78.1\%\) respectively.

Supported by National Natural Science Foundation of China (No. 61672505) and the CAS/SAFEA International Partnership Program for Creative Research Teams.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Pathak, A., Hu, Y.C., Zhang, M.: Bootstrapping energy debugging on smartphones: a first look at energy bugs in mobile devices. In: Proceeding of The 10th ACM Workshop on Hot Topics in Networks, HotNets-X (2011)

    Google Scholar 

  2. Banerjee, A., Chong, L.K., Chattopadhyay, S., et al.: Detecting energy bugs and hotspots in mobile apps. In: Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 588–598. ACM (2014)

    Google Scholar 

  3. Zhang, J., Musa, A., Le, W.: A comparison of energy bugs for smartphone platforms. In: Engineering of Mobile-Enabled Systems (MOBS), pp. 25–30. IEEE (2013)

    Google Scholar 

  4. APKTool. https://code.google.com/p/android-apktool/

  5. Lint. http://tools.android.com/tips/lint

  6. Hoffmann, J., Ussath, M., Holz, T., et al.: Slicing droids: program slicing for smali code. Automated Software Engineering (ASE), Coimbra, Portugal, 18–22 March 2013, pp. 1844–1851. IEEE (2013)

    Google Scholar 

  7. Dalvik. https://en.wikipedia.org/wiki/Dalvik

  8. Hierarchy Viewer. http://developer.android.com/tools/help/hierarchy-viewer.html

  9. Ferrari, A., Gallucci, D., Puccinelli, D., et al.: Detecting energy leaks in Android app with POEM. In: Pervasive Computing and Communication Workshops (PerCom Workshops). IEEE (2015)

    Google Scholar 

  10. Liu, Y., Xu, C., Cheung, S.C.: Where has my battery gone? Finding sensor related energy black holes in smartphone applications. In: Pervasive Computing and Communications (PerCom), pp. 2–10. IEEE (2013)

    Google Scholar 

  11. Liu, Y., Xu, C., Cheung, S.C.: Characterizing and detecting performance bugs for smartphone applications. In: Proceedings of the 36th International Conference on Software Engineering, pp. 1013–1024 (2014)

    Google Scholar 

  12. Wu, H., Yang, S., Rountev, A.: Static detection of energy defect patterns in Android applications. In: Proceedings of the 25th International Conference on Compiler Construction, pp. 185–195. ACM (2016)

    Google Scholar 

  13. Kim, P., Kroening, D., Kwiatkowska, M.: Static program analysis for identifying energy bugs in graphics-intensive mobile apps. In: Proceedings of the 24th IEEE International Conference on Modelling, Analysis and Simulation of Computer and Telecommunication Systems, MASCOTS 2016. IEEE CS Press (2016)

    Google Scholar 

  14. Hao, S., Li, D., Halfond, W.G.J., Govindan, R.: Estimating mobile application energy consumption using program analysis. In: Proceedings of the 35th International Conference on Software Engineering (ICSE), May 2013

    Google Scholar 

  15. Li, D., Hao, S., Halfond, W.G.J., Govindan, R.: Calculating source line level energy information for Android applications. In: ISSTA (2013)

    Google Scholar 

  16. Li, D., Tran, A.H., Halfond, W.G.J.: Making web applications more energy efficient for OLED smartphones. In: Proceedings of the International Conference on Software Engineering (ICSE), June 2014

    Google Scholar 

  17. Li, D., Lyu, Y., Gui, J., Halfond, W.G.J.: Automated energy optimization of HTTP requests for mobile applications. In: Proceedings of the 38th International Conference on Software Engineering (ICSE), May 2016

    Google Scholar 

  18. Liu, Y., Chang, X., Cheung, S.C., Lu, J.: GreenDroid: automated diagnosis of energy inefficiency for smartphone applications. IEEE Trans. Software Eng. 40(9), 911–940 (2014)

    Article  Google Scholar 

  19. Wan, M., Jin, Y., Li, D., Halfond, W.G.J.: Detecting display energy hotspots in Android apps. In: Proceedings of the 8th IEEE International Conference on Software Testing, Verification and Validation (ICST), April 2015

    Google Scholar 

  20. Vsquez, M.L., Bavota, G., Bernal-Crdenas, C., et al.: Mining energy-greedy API usage patterns in Android apps: an empirical study. In: 11th Working Conference on Mining Software Repositories, MSR 2014, pp. 2–11 (2014)

    Google Scholar 

  21. Tianyong, W., Liu, J., Zhenbo, X., Guo, C., Zhang, Y., Yan, J., Zhang, J.: Light-weight, inter-procedural and callback-aware resource leak detection for Android apps. IEEE Trans. Software Eng. 42(11), 1054–1076 (2016)

    Article  Google Scholar 

  22. Lu, Q., Wu, T., Yan, J., Yan, J., Ma, F., Zhang, F.: Lightweight method-level energy consumption estimation for Android applications. In: TASE 2016, pp. 144–151 (2016)

    Google Scholar 

  23. Wu, T., Liu, J., Deng, X., Yan, J., Zhang, J.: Relda2: an effective static analysis tool for resource leak detection in Android apps. In: ASE 2016, pp. 762–767 (2016)

    Google Scholar 

  24. Banerjee, A., Chong, L.K., Chattopadhyay, S., Roychoudhury, A.: Detecting energy bugs and hotspots in mobile apps. In: SIGSOFT FSE 2014, pp. 588–598 (2014)

    Google Scholar 

  25. Pathak, A., Hu, Y.C., Zhang, M.: Where is the energy spent inside my app?: Fine grained energy accounting on smartphones with Eprof. In: Proceedings of the 7th ACM European Conference on Computer Systems, EuroSys 2012, pp. 29–42 (2012)

    Google Scholar 

  26. Guo, C., Zhang, J., Yan, J., Zhang, Z., Zhang, Y.: Characterizing and detecting resource leaks in Android applications. In: IEEE/ACM 28th International Conference on Automated Software Engineering, ASE 2013, pp. 389–398 (2013)

    Google Scholar 

Download references

Acknowledgment

We thank the ICFEM reviewers for their valuable feedback, and also thank Dr. Yuting Chen and Dr. Zhoulai Fu for many useful comments on the presentation.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Hongli Yang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this paper

Cite this paper

Jiang, H., Yang, H., Qin, S., Su, Z., Zhang, J., Yan, J. (2017). Detecting Energy Bugs in Android Apps Using Static Analysis. In: Duan, Z., Ong, L. (eds) Formal Methods and Software Engineering. ICFEM 2017. Lecture Notes in Computer Science(), vol 10610. Springer, Cham. https://doi.org/10.1007/978-3-319-68690-5_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-68690-5_12

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-68689-9

  • Online ISBN: 978-3-319-68690-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics