Giter VIP home page Giter VIP logo

ecoandroid's Introduction

EcoAndroid

EcoAndroid logo

EcoAndroid is an Android Studio plugin that suggests automated refactorings for reducing energy consumption of Java android applications. It is also compatible with IntelliJ.

Installation

For users of the plugin

EcoAndroid can be installed from the JetBrains Plugin Repository.

Alternatively, you can install the plugin manually by following these steps:

  1. Clone this repository
  2. Run gradle buildPlugin.
  3. The plugin file is available in the folder build/distributions/. You can now install it.

For developers

If you are interested in changing or exploring the source code of the plugin, follow these steps:

  1. Clone this repository
  2. Open the project in your favourite IDE
  3. Once you made the desired changes, run gradle runIde. An IntelliJ IDE with the plugin activated will open.

If you wish to add a new refactoring to the plugin, follow these steps:

  1. Add a <localInspection> element to the plugin.xml file present in src/main/resources, following the specifications in the other inspections
  2. Create a subclass of com.intellij.codeInspection.LocalInspectionTool (the one stated in the previous step) in the folder of the corresponding energy pattern
  3. Create a subclass of com.intellij.codeInspection.LocalQuickFix to apply the refactoring to the source code

EcoAndroid in Practice

EcoAndroid has been used to improve the energy efficiency of several Android applications. Examples include:

Have you used EcoAndroid to improve your application? Please let us know so that we can add it to the list above!

Energy Patterns

The energy patterns that are currently detected by EcoAndroid are:

  1. Dynamic Retry Delay, with the following cases:

    • Switching the time a thread goes to sleep from constant to dynamic (only considering the cases where variables are used to put the thread to sleep)
    • Giving information to the developer about a package to aid while dealing with the retry of work
    • Checking the network connection before processing a thread
  2. Push over Poll, with the following case:

    • Giving information to the developer about the possibility of implementing push notifications through Firebase Cloud Messaging (FCM) instead of a polling service
  3. Reduce Size, with the following case:

    • Asking for the response to be received compressed by the gzip scheme, if possible
  4. Cache, with the following cases:

    • Checking the metadata before reloading information
    • Verifying the size of a view before resetting said view
    • Switching to LocationManager.PASSIVE_PROVIDER when invoking the method requestLocationUpdates from the class android.location.LocationManager
    • Increasing the size of the cache on a SSL Session
    • Creating a TODO in the source code for when nothing is different since the last update from an URL connection
  5. Avoid Graphics and Animations, with the following case:

    • Switching the rendering mode to GLSurfaceView.RENDERMODE_WHEN_DIRTY

The examples in the folder src/test are retrieved from real-life mobile applications. In order to make the files more readable, parts of the original source code are either removed or commented.

Resources

For more information about energy patterns, we recommend Cruz and Abreu's open catalogue of energy-related patterns in mobile applications.

ecoandroid's People

Contributors

anasofiagribeiro avatar asfmendes avatar jff avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ecoandroid's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.