Detection and Correction of Android-specific Code Smells and Energy Bugs: An Android Lint Extension

Context: While Android applications suffer from code smells and energy drain issues there is still a lack of tools that help developers improve energy consumption and maintainability of Android applications. Objective: Our research aims to provide tool support to Android developers helping them to create greener and more maintainable applications by eliminating Android-specific code smells/energy bugs. The proposed tool support integrates routine code smell detection with energy bug detection so that developers can do both at the same time. Method: We extend ‘Android Lint’ (AL) with custom rules to detect and correct 12 code smells (nine are new and three are improved) and three energy bugs (two are new and one is improved). In addition, for the improved and newly introduced code smells, we compared the performance of our tool with the open version of the ’PAPRIKA’ tool. Result: We evaluated our tool on nine open-source Android applications. Our tool detects the specified code smells and energy bugs with an average precision, average recall and F1 score of 0.93, 0.96, and 0.94, respectively. It accurately corrects 84% of selected code smells and energy bugs. The performance of the new and improved code smell detection is better than that achieved by ‘PAPRIKA’. Conclusion: Our tool is a useful extension to the existing ‘AL’ tool with better performance than ‘PAPRIKA’.

[1]  P ? ? ? ? ? ? ? % ? ? ? ? , 1991 .

[2]  Andrea De Lucia,et al.  Lightweight detection of Android-specific code smells: The aDoctor project , 2017, 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[3]  Olivier Le Goaër Enforcing Green Code With Android Lint , 2020, 2020 35th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW).

[4]  Hao Jiang,et al.  Detecting Energy Bugs in Android Apps Using Static Analysis , 2017, ICFEM.

[5]  Alejandro Zunino,et al.  An Analysis of the Effects of Bad Smell-Driven Refactorings in Mobile Applications on Battery Usage , 2016 .

[6]  Dietmar Pfahl,et al.  Tool Support for Green Android Development: A Systematic Mapping Study , 2020, ICSOFT.

[7]  Dietmar Pfahl,et al.  Evaluating the Impact of Code Smell Refactoring on the Energy Consumption of Android Applications , 2019, 2019 45th Euromicro Conference on Software Engineering and Advanced Applications (SEAA).

[8]  Romain Rouvoy,et al.  Investigating the energy impact of Android smells , 2017, 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[9]  Shengchao Qin,et al.  State-Taint Analysis for Detecting Resource Bugs , 2016, 2016 10th International Symposium on Theoretical Aspects of Software Engineering (TASE).

[10]  Lori L. Pollock,et al.  How do code refactorings affect energy usage? , 2014, ESEM '14.

[11]  Marco Couto,et al.  Energy Refactorings for Android in the Large and in the Wild , 2020, 2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[12]  Romain Rouvoy,et al.  On the Survival of Android Code Smells in the Wild , 2019, 2019 IEEE/ACM 6th International Conference on Mobile Software Engineering and Systems (MOBILESoft).

[13]  Steve McConnell,et al.  Code complete - a practical handbook of software construction, 2nd Edition , 1993 .

[14]  Romain Rouvoy,et al.  Detecting Antipatterns in Android Apps , 2015, 2015 2nd ACM International Conference on Mobile Software Engineering and Systems.

[15]  Duc-Man Nguyen,et al.  Improve the Performance of Mobile Applications Based on Code Optimization Techniques Using PMD and Android Lint , 2016, IUKM.

[16]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.