Search code examples
androidbattery

How to add values to the battery consuming page


I’m trying to understand how the settings -> battery page works (The one where it shows the different features that consume the battery, for example “screen – 70%, Bluetooth – 20%”). Are those default values or real-time calculated ones? Can anybody direct me to the class / classes that are building that page?

And one last question: If I want to install a new feature that will consume battery life (not a user app, but more of a system app that is a CPU consuming feature) , will it be shown there without me inserting it into the list programmatically?

Thanx a lot!


Solution

  • First of all Settings is an app that is written like normal application http://developer.android.com/design/patterns/settings.html.

    screen – 70%, Bluetooth – 20% It is not harcoded, It is based on some calculation on battery consumption, For eg: If you change your brightness your screen consumption should reduce. In emulator it is hardcoded.

     If I want to install a new feature that will consume battery life (not a user app, but more  of a system app that is a CPU consuming feature) , will it be shown there without me inserting it into the list programmatically?
    

    I think you know that each and every app in the device is consuming battery , If your app should be listed under battery consumption seperately , then you should create a settings app for the phone.

    UPDATE

    As far i understood battery usage is associated with the internal package "com.android.os.internal"

    Since you are rooted: you can access that and verify the code as you need :) ,Not sure about that , any way that's the way i found till now. Will give you update if anything better is found.