Skip to main content
QUICK REVIEW

[Paper Review] Using Automatic Refactoring to Improve Energy Efficiency of Android Apps

Luís Cruz, Rui Abreu|arXiv (Cornell University)|Mar 15, 2018
Green IT and SustainabilityEngineering25 references6 citations
TL;DR

This paper proposes Leafactor, an open-source tool that automatically refactors Android apps to fix energy-inefficient code smells, improving energy efficiency. It analyzed 140 open-source Android apps, fixed 222 anti-patterns in 45 apps, and successfully merged changes into 18 official repositories, demonstrating that automated refactoring significantly enhances energy efficiency without altering app functionality.

ABSTRACT

The ever-growing popularity of mobile phones has brought additional challenges to the software development lifecycle. Mobile applications (apps, for short) ought to provide the same set of features as conventional software, with limited resources: such as, limited processing capabilities, storage, screen and, not less important, power source. Although energy efficiency is a valuable requirement, developers often lack knowledge of best practices. In this paper, we study whether or not automatic refactoring can aid developers ship energy efficient apps. We leverage a tool, Leafactor, with five energy code smells that tend to go unnoticed. We use Leafactor to analyze code smells in 140 free and open source apps. As a result, we detected and fixed code smells in 45 apps, from which 40% have successfully merged our changes into the official repository.

Motivation & Objective

  • To address the growing challenge of mobile app energy inefficiency due to limited battery life.
  • To investigate whether automatic refactoring can help developers implement energy-efficient coding practices.
  • To evaluate the real-world impact of automated refactoring on open-source Android applications.
  • To provide a tool that detects and fixes energy-related code smells, reducing manual effort and improving software quality.

Proposed method

  • The authors developed Leafactor, an automatic refactoring tool targeting five specific energy-related code smells in Android apps.
  • The tool uses static code analysis to detect anti-patterns such as inefficient View recycling, redundant resource usage, and improper use of timers.
  • Refactorings are based on established Android best practices known to reduce energy consumption, including the ViewHolder pattern and optimized resource management.
  • The tool was applied to a dataset of 140 free and open-source Android apps to detect and fix energy-inefficient code patterns.
  • Changes were proposed via pull requests to official repositories, and success was measured by merge acceptance rate.
  • The tool was validated through real-world integration, with energy improvements measured via code quality and merge statistics.

Experimental results

Research questions

  • RQ1Can automatic refactoring tools effectively detect and fix energy-inefficient code patterns in Android applications?
  • RQ2To what extent do developers accept and merge automated refactoring suggestions for energy efficiency?
  • RQ3How many real-world Android apps contain detectable energy-related code smells, and what is the potential impact of fixing them?
  • RQ4Can automated refactoring tools serve as both development aids and educational tools for energy-efficient coding?

Key findings

  • Leafactor detected and fixed 222 energy-related anti-patterns across 45 out of 140 analyzed open-source Android apps.
  • 40% of the apps that received refactoring suggestions successfully merged the changes into their official repositories, with 18 apps accepting the patches.
  • The tool successfully improved energy efficiency in 18 official releases, demonstrating real-world impact.
  • The ViewHolder pattern was the most complex refactoring, requiring up to 35 lines of code to implement correctly, yet it delivered a 4.5% energy efficiency improvement.
  • A significant 32% of the analyzed apps contained at least one energy-inefficient code smell, highlighting the prevalence of the problem.
  • The study confirms that automated refactoring can be a scalable and effective solution for improving energy efficiency in mobile software.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.