Mobile Development 7 min read

Using Battery Historian for Android Power Consumption Analysis

Battery Historian, a Google-provided visual tool for Android bugreport analysis, lets developers generate bugreports via ADB, examine system and app statistics such as screen‑on/off, wake‑locks, and charging behavior, and diagnose common power issues like slow charging, overheating, and unexplained drain.

OPPO Kernel Craftsman
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Using Battery Historian for Android Power Consumption Analysis

Battery Historian is a Google‑provided visual tool for analyzing Android bugreport files. Introduced at Google I/O 2015, it helps developers inspect system‑level and app‑level power events on devices running Android 5.0 (Lollipop) or later.

Installation: the source code and usage instructions are available on GitHub at https://github.com/google/battery-historian/ . A ready‑to‑use web instance can be accessed at https://bathist.ef.lc/ .

Generating a bugreport

1. Enable Developer Options on the device (Settings → About phone → tap Build number repeatedly) and connect via ADB.

2. Reset the batterystats database to clear old data:

adbshell dumpsys batterystats –reset

3. Use the device normally to collect power usage.

4. Export the bugreport (the operation takes 2‑5 minutes and the device must stay connected):

adbbugreport > bugreport.txt

The resulting bugreport.txt file can be opened in Battery Historian.

Key tabs and metrics

• SystemStats : shows overall device statistics such as screen‑on/off rates, signal strength, and brightness.

• AppStats : displays per‑application data. Users can select an app from the left‑hand pane to view its specific statistics, including SyncManager, Foreground process, Userspace WakeLock, Top app, JobScheduler, and Activity Manager Proc.

General analysis workflow

1. Examine screen‑on/off rates in SystemStats to detect abnormal power consumption caused by the display.

2. Observe battery level drop rates to pinpoint time intervals with high drain and correlate them with foreground apps, network state, or background jobs.

3. Combine brightness, network type, background jobs, and foreground app information to determine whether the issue stems from configuration, environment, or a misbehaving app.

Common scenarios

1. Slow charging : check charging current, temperature, and any long‑running jobs that may limit current.

2. Overheating : use batterystats to locate temperature spikes and assess whether high power draw matches the observed heat.

3. Screen‑on drain : verify network type (5G > 4G > Wi‑Fi), brightness, and high‑consumption apps (e.g., games).

4. Wake‑lock drain during screen‑off : look for audio or partial wake‑locks held by apps that prevent the device from sleeping.

5. Unexplained screen‑off drain : consider possible hardware leakage; further kernel‑level analysis may be required.

6. Battery‑level “catch‑up” : when reported current exceeds realistic limits without excessive heat, the battery meter may be correcting a discrepancy (often called “virtual battery” behavior).

Conclusion

Battery Historian provides an intuitive graphical view of historical power usage, allowing developers to trace consumption back to specific events or components. For simple power‑related issues it is sufficient for most users; deeper investigations may require additional logs and expertise from power‑engineering specialists.

mobile developmentperformanceAndroidpower analysisbattery-historianbugreport
OPPO Kernel Craftsman
Written by

OPPO Kernel Craftsman

Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.