Understanding Android Power Consumption: Fundamentals, Components, and Measurement Tools
This article explains the basic concepts of Android power consumption, the components that contribute to battery drain, the role of power_profile.xml, and various measurement methods such as PowerMonitor, dumpsys batterystats, system power ranking, and Battery Historian, providing practical steps and tools for developers to analyze and optimize app energy usage.
As smartphones become larger and higher‑refresh‑rate, power consumption and battery life have become critical to user experience; high drain causes anxiety and overheating, reducing willingness to use the device.
Fundamentals of Power Consumption
The article reviews why current (mA) represents power level and capacity (mAh) represents energy consumption, recalling the physics formulas P = I × U and E = P × T = I × U × T. Power (P) is measured in watts, energy (E) in joules, current (I) in milliamps, voltage (U) typically 3.7 V (charging up to 4.2 V, discharge down to 2.75 V), and battery capacity in mAh.
Composition of Power Consumption
Android’s developer documentation splits battery usage into statistical data collected by BatteryStats and a power configuration file (power_profile.xml). The framework tracks component state changes (Wi‑Fi, Bluetooth, GPS, screen, CPU, etc.) and estimates each component’s energy use based on timing information.
Key hardware consumers are CPU, screen, Wi‑Fi, data network, GPS, and audio/video calls. The power profile file, located at /frameworks/base/core/res/res/xml/power_profile.xml , provides per‑component current values that the Android framework multiplies by active time to compute mAh usage.
Developers can extract this file by exporting /system/framework/framework-res.apk , decompiling it, and locating power_profile.xml in the decompiled /res/xml/ directory.
Power Consumption Measurement Methods
The article lists common measurement approaches:
Number
Method
Applicable Scenario
Advantages
Disadvantages
1
Regulated Power Supply + Current Meter
Whole‑device current
Accurate, full‑device data
Requires hardware, cannot isolate individual app consumption
2
dumpsys batterystats
App‑level consumption
Detailed per‑app data
Hard to read output
3
System Power Ranking
App‑level consumption
Simple and visual
Lacks detailed numbers
4
Battery Historian
App‑level consumption
Visual, detailed data
Only works on Android 5.0+
1. PowerMonitor
The most precise method uses an external PowerMonitor to sample current at high frequency, suitable for detailed analysis of background, screen‑off, and other states, though it requires device disassembly.
2. dumpsys batterystats
Run the following commands to export and reset battery stats:
adb shell dumpsys batterystats > battery.txt adb shell dumpsys batterystats --resetBatteryStatsService collects data per UID, enabling per‑app resource monitoring.
3. System Power Ranking
Vendor‑provided rankings (e.g., Huawei) break down hardware and software consumption and list per‑app power usage.
4. Battery Historian
Battery Historian, a Google tool, visualizes batterystats data. Install via Docker image or source code, or use the hosted version at https://bathist.ef.lc/ . Typical workflow:
Connect the device via ADB.
Reset battery data with adb shell dumpsys batterystats --reset to avoid huge dumps.
Disconnect power so the device runs on battery.
Run the test scenario.
Reconnect and generate a bug report: adb bugreport [path/]bugreport.zip # Android 7.0+ adb bugreport [path/]bugreport.txt # Android 6.0 and below
Open Battery Historian in a browser, upload the bugreport, and submit to view charts.
The tool displays system‑wide metrics (battery level, CPU time, Wi‑Fi signal, temperature) and app‑specific sections such as estimated power use, network info, wakelocks, services, process info, and sensor usage.
Understanding these metrics allows targeted power‑optimisation, reducing high‑drain components and improving overall battery life.
JD Tech Talk
Official JD Tech public account delivering best practices and technology innovation.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.