Advertisement

Detecting Energy Bugs in Android Apps Using Static Analysis

  • Hao Jiang
  • Hongli YangEmail author
  • Shengchao Qin
  • Zhendong Su
  • Jian Zhang
  • Jun Yan
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10610)

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.

Notes

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.

References

  1. 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. 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. 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. 4.
  5. 5.
  6. 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. 7.
  8. 8.
  9. 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. 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. 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. 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. 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. 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 2013Google Scholar
  15. 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. 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 2014Google Scholar
  17. 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 2016Google Scholar
  18. 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)CrossRefGoogle Scholar
  19. 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 2015Google Scholar
  20. 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. 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)CrossRefGoogle Scholar
  22. 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. 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. 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. 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. 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

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  • Hao Jiang
    • 1
  • Hongli Yang
    • 1
    Email author
  • Shengchao Qin
    • 2
  • Zhendong Su
    • 3
  • Jian Zhang
    • 4
  • Jun Yan
    • 4
  1. 1.Beijing University of TechnologyBeijingChina
  2. 2.Teesside UniversityMiddlesbroughUK
  3. 3.University of CaliforniaDavisUSA
  4. 4.State Key Laboratory of Computer Science, Institute of SoftwareChinese Academy of SciencesBeijingChina

Personalised recommendations