如何通过Recovery、ADB等提取安卓电池使用统计数据
Hey there! Since you've got root access, let's dive right into where those battery stats live and how you can pull them. You’re totally right—older answers don’t cover modern Android versions properly, so we’ll focus on current implementations here.
Where Battery Usage Data is Stored
Battery stats are tucked away in system-level directories, and exact paths can vary a bit by Android version and OEM, but these are the most reliable spots:
Core Battery Stats File:
/data/system/batterystats.bin
This is the main binary file holding all battery usage records—including app-specific stats (like Chrome, Camera) and system components (Screen, BT, Idle). It’s a compiled database, so you can’t open it with a regular text editor directly.OEM-Specific Additional Data:
- Some manufacturers (Samsung, Xiaomi, etc.) store extra stats in
/data/system/usagestats/or/data/data/com.android.settings/databases/—these are often SQLite databases that you can inspect with tools like SQLite Browser once extracted. - For Android 12 and newer, you might also find related logs in
/data/misc/battery/, but the core usage data still lives inbatterystats.bin.
- Some manufacturers (Samsung, Xiaomi, etc.) store extra stats in
How to Extract the Data (3 Methods for Rooted Devices)
1. Using a Root File Manager
- Open a root-enabled file manager (like Solid Explorer or FX File Explorer—make sure you’ve granted root access to the app).
- Navigate to
/data/system/and findbatterystats.bin. - Copy the file to a non-system folder (like
/sdcard/Download/) so you can access it easily, then transfer it to your computer if needed. - For any OEM-specific databases, head to the paths mentioned above and copy those files the same way.
2. Using ADB
First, make sure your device is connected to your computer and ADB is set up. Then use these commands:
- Pull the main batterystats file:
adb root adb pull /data/system/batterystats.bin ~/Desktop/batterystats.bin - If
adb rootdoesn’t work (some devices restrict it), use this workaround:adb shell su cp /data/system/batterystats.bin /sdcard/Download/batterystats.bin exit adb pull /sdcard/Download/batterystats.bin ~/Desktop/batterystats.bin - Pull OEM-specific SQLite databases (example):
adb pull /data/data/com.android.settings/databases/battery.db ~/Desktop/battery.db
3. Using TWRP Recovery
- Boot your device into TWRP recovery.
- Go to Advanced > File Manager.
- Navigate to
/data/system/, selectbatterystats.bin, then tap Copy. - Navigate to
/sdcard/or your external storage, tap Paste to save the file. - Reboot your device, and you’ll find the file in your storage to transfer later.
Reading the Extracted Data
Since batterystats.bin is binary, you need to parse it to make sense of it:
- On your computer, use the Android SDK’s
batterystatstool (part of platform-tools) to convert it to a readable text file:batterystats batterystats.bin > battery_stats_readable.txt - Alternatively, if you’re still connected via ADB, you can parse it directly on the device:
adb shell dumpsys batterystats --read-bin /sdcard/Download/batterystats.bin > battery_stats.txt
For SQLite databases (like battery.db), use tools like SQLite Browser or the sqlite3 command-line tool to query and view the data in a human-friendly format.
内容的提问来源于stack exchange,提问作者SerVB




