On Gingerbread users can report apps for their battery usage, by going to Settings -> About phone -> Battery use, and then tap on a specific app.
My question is, as a developer where can I see these reports?
They seem very useful because they contain information on what type of wake locks you might be leaking.
The Battery Historian tool provides insight into a device's battery consumption over time. At a system-wide level, the tool visualizes power-related events from the system logs in an HTML representation.
Sorry I don't think this information is currently available. It is being collected, but at this point there is no UI for developers to retrieve it. (This is also true for reports coming about running services.)
Check out PowerUsageSummary and PowerUsageDetail from the subdir fuelgauge in the Settings package. The relevant methods are reportBatteryUse()
in PowerUsageDetail and processAppUsage()
in PowerUsageSummary.
Most of the information comes from an mstats object which is created by an internal API call:
import com.android.internal.os.BatteryStatsImpl;
...
mStats = com.android.internal.os.BatteryStatsImpl.CREATOR
.createFromParcel(parcel);
mStats.distributeWorkLocked(BatteryStats.STATS_SINCE_CHARGED);
I never tried to call these methods from your own non-system app, so you have to find out if it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With