Mobile Development 8 min read

Android Battery Power Consumption Testing Guide

This article explains why battery usage is critical for mobile apps, describes hardware‑based power measurement and the use of Google’s Battery Historian tool—including installation, command‑line data collection, parameter interpretation, and methods to improve test data validity.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Android Battery Power Consumption Testing Guide

Background

Battery life is a key concern for mobile users; an app that drains power excessively is likely to be uninstalled. Testers therefore need targeted power‑consumption testing.

Android Battery Testing

1. Using a hardware power meter

Devices such as the Agilent N6705B can provide precise current measurements. The method requires disassembling the phone, removing the battery, and inserting the power meter between the phone and an external power source so that the current flowing through the meter can be recorded.

Advantages: accurate current data. Disadvantages: requires hardware investment, phone disassembly, and only yields total device current without per‑app breakdown.

2. Using Battery Historian

Battery Historian, released by Google at I/O 2015, visualizes battery‑related events from a bugreport file for Android 5.0+ devices. It shows system‑level and app‑level events on a timeline, allowing developers to select an app and inspect its impact on battery.

Two versions exist: Historian 1.0 (Python script to HTML) and Historian 2.0 (improved reports, faster execution). The newer 2.0 version is recommended.

Installation

Install Battery Historian 2.0 following online tutorials (not detailed here).

Usage

1. Restart ADB to avoid conflicts:

adb kill-server adb start-server

2. Enable full‑wake‑history and reset stats:

adb shell dumpsys batterystats --enable full-wake-history adb shell dumpsys batterystats --reset

After these steps, disconnect the USB cable.

3. Perform the test scenario.

4. Reconnect the phone and export the bugreport:

adb bugreport > bugreport.txt

5. Open Battery Historian (e.g., http://localhost:9999) and import the bugreport.

Parameter Meaning

Battery Historian reports many fields, such as:

battery_level : current charge level.

plugged : charging state and duration.

Screen : whether the screen is on.

Top : foreground app at each moment.

wake_lock and wake_lock_in : wake‑lock usage.

running : UI idle state.

Gps : GPS status.

phone_in_call : call activity.

Sync : background sync activity.

Job : background jobs/services.

data_conn : network type (2G/3G/4G/Wi‑Fi).

Status : battery health status.

phone_signal_strength : signal strength.

Health : overall battery health.

Plug : charging method (USB or AC).

Advantages: intuitive results with detailed consumption data. Disadvantages: not supported on Android versions below 5.0.

Data Validity Tips

To improve the reliability of power‑consumption data, use either:

Horizontal comparison : first measure hardware‑only power draw, then measure hardware + software draw, and compare the two.

Vertical comparison : run the same test on two identical phones, one with the app installed and one without, then compare their power usage.

Be aware of variations caused by network conditions and hardware differences; using the same phone model and batch reduces error.

mobile developmentAndroidtestingHardwarebattery-historianbatterypower-testing
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

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.