电池统计
1.9.10.3 · GitHub
More about this app
Battery health and hardware analysis; Shizuku provides the elevated shell for deep battery parameter reads.
๐ Battery (Battery Health & Hardware Analysis)
A lightweight, accurate, and modern battery health and hardware analysis tool crafted for Android.
๐ฑ Screenshots
| ๐ Power Usage & Timeline | ๐ System API Detection | โก Shizuku Privileged Reading | ๐ History Trend & Decay Stats | โ๏ธ Settings & Backup |
|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
๐ Key Features
1. ๐ Triple Data Collection & Deep Parsing Engine
- System Standard API (BatteryManager): Zero barrier to reading system broadcast and standard API data (battery level, charging status, health state, temperature, voltage, current, etc.).
- Shizuku Privileged Deep Reading (Rootless ADB):
- No root required; obtains underlying shell permissions via Shizuku authorization;
- Directly reads
/sys/class/power_supply/driver nodes anddumpsysbattery services; - Extracts real full charge capacity (FCC), cycle count, microampere-level real-time current, and dual-cell battery architecture;
- Specially adapted for HONOR private battery drivers and node services.
- Lightning-Fast Bugreport Stream Parsing:
- Supports directly importing system bugreport files (
bugreport-*.zipor.txt) ranging from tens to hundreds of megabytes; - Employs native byte stream sliding window fast scanning to locate and parse the
getHealthInfostructure within milliseconds; - Automatically extracts and displays the actual capture/generation timestamp of the bugreport.
- Supports directly importing system bugreport files (
Warning
โ ๏ธ Device Compatibility Notice: Currently, Shizuku Privileged Reading and Bugreport Parsing have been deeply adapted primarily for HONOR devices. Other brands (such as Xiaomi, OPPO, vivo, Samsung, etc.) have not been extensively tested, and compatibility differences may exist in private kernel driver nodes and bugreport formats. System Standard API detection works on all general Android devices.
2. ๐ Battery Health Degradation Trend & Multi-period Loss Statistics
- Smooth Bezier Health Trend Chart: Canvas hardware-accelerated curve fitting for historical snapshot data, supporting touch gestures to inspect details of each snapshot node.
- Multi-dimensional Degradation Rate Estimation:
- ๐ Daily Average Degradation (%/day);
- ๐ Monthly Average Degradation (%/month);
- ๐๏ธ Estimated Yearly Degradation (%/year).
- Periodic Loss Breakdown: Automatically groups and aggregates data by calendar day, month, and year to review starting/ending health percentage changes and charge cycle count increments for each period.
3. ๐ 15 Comprehensive Battery Hardware Parameters
Every parameter is carefully sanitized, validated, and converted into standard physical units:
| Parameter | Description | Source |
|---|---|---|
| ๐ Battery Level | Remaining battery percentage (e.g., 85%) |
System API / Kernel Nodes |
| โก Status | Charging / Discharging / Not Charging / Full | Power Management IC (PMIC) |
| ๐ฉบ Health State | Android diagnostic state (Good / Overheat / Dead / Over Voltage, etc.) | Android Diagnostic API |
| โค๏ธ Battery Health | Actual health percentage (FCC รท Design Capacity) | Precise Algorithmic Calculation |
| ๐ Cycle Count | Equivalent charge/discharge cycles recorded by fuel gauge | Hardware Fuel Gauge Counter |
| ๐ก๏ธ Temperature | Real-time Celsius temperature (accurate to 0.1ยฐC) |
Internal Battery Thermistor |
| ๐ Voltage | Real-time terminal voltage (mV / V) |
Analog-to-Digital Converter (ADC) |
| โก Current | Real-time charge/discharge current (mA, with clear +/- direction) |
Coulomb Counter Sensing Resistor |
| โก Power | Real-time instantaneous operating power (W) |
Dynamic Power Calculation Formula |
| ๐ Design Capacity | Factory nominal design capacity (mAh) |
PowerProfile / Kernel Parameters |
| ๐ Full Charge Capacity (FCC) | Estimated maximum capacity when battery is fully charged (mAh) |
Fuel Gauge Learned Capacity |
| ๐ Current Capacity | Remaining available capacity (mAh) |
Coulomb Counter Charge Tally |
| ๐ Dual Cell | Identification of dual-cell (series/parallel) architecture | Hardware Topology Detection |
| ๐ฌ Technology | Battery chemistry/material type (e.g., Li-ion, Li-poly) |
Hardware Properties |
| ๐ Capture Time | Exact date and time when the detection or bugreport was taken | Automatic Timestamp |
4. ๐จ Modern Material 3 UI & Fluid Interactions
- Material 3 Bottom Navigation: Three core sections: "Detection", "History", and "Settings".
- Gestures & Pull-to-Refresh: Integrated
SwipeRefreshLayoutwith smooth pull-down refresh animations. - Grouped Card Settings:
- Categorized cards for User Interface, Data & Refresh, Shizuku Privilege, and About;
- Consistent
56dpphysical height with auto-centering alignment; - Precision right-aligned compact popup menu that smoothly unfolds from top-right (supporting 1s / 2s / 3s / 5s / 10s refresh intervals).
- System-wide Dark Theme & Rounded Ripple Effects:
- Flawlessly supports light and dark (AMOLED true black/dark grey) themes;
- Rounded mask-clipped ripple feedback for refined aesthetics without clipping overflow.
๐ ๏ธ Technical Architecture
- Programming Language: 100% Kotlin
- Architecture Pattern: MVVM (Model-View-ViewModel) + Unidirectional Reactive Data Flow
- Asynchronous & Concurrency: Kotlin Coroutines + Flow / StateFlow
- View Binding: Android Jetpack ViewBinding
- Component Libraries:
- Google Material Components 3 (
com.google.android.material:material:1.11.0) - AndroidX SwipeRefreshLayout (
androidx.swiperefreshlayout:swiperefreshlayout:1.1.0) - Rikka Shizuku API (
dev.rikka.shizuku:api:13.1.5/provider:13.1.5) - AndroidX Lifecycle & ViewModel KTX (
2.7.0) - Kotlinx Coroutines Android (
1.7.3)
- Google Material Components 3 (
๐ฆ Project Structure
Battery/
โโโ app/
โ โโโ src/main/
โ โ โโโ java/com/battery/analysis/
โ โ โ โโโ model/ # Battery parameters and result models (BatteryInfo, HealthInfoItem)
โ โ โ โโโ provider/ # Data providers (NormalApi, Shizuku, BugreportParser, Fusion)
โ โ โ โโโ ui/ # UI layer (Fragments, ViewPager2 adapters, ViewBinder)
โ โ โ โโโ viewmodel/ # Business logic & state flow ViewModels
โ โ โ โโโ MainActivity.kt # Main Activity (navigation & lifecycle coordination)
โ โ โโโ res/
โ โ โโโ anim/ # Popup animation resources
โ โ โโโ color/ # State color selectors
โ โ โโโ drawable/ # Vector icons and card backgrounds
โ โ โโโ layout/ # Layout XML files
โ โ โโโ values/ # Theme styles, strings, and light color palette
โ โ โโโ values-en/ # English string resources
โ โ โโโ values-night/ # Dark theme and high contrast color palette
โโโ .github/workflows/ # CI/CD automated build and release workflows
โโโ build.gradle.kts # Top-level and module-level build configurations
๐ Build & Setup
1. Prerequisites
- Android Studio: Hedgehog (2023.1.1) or higher
- JDK: OpenJDK 17 or higher
- Android SDK: API 34 (Android 14)
2. Local Build Steps
# Clone the repository
git clone https://github.com/zhyang18/Battery.git
cd Battery
# Build Debug APK
./gradlew assembleDebug
# Build Release APK
./gradlew assembleRelease
Compiled APK artifacts are located in the app/build/outputs/apk/ directory.
๐ฑ Usage Guide
- Standard Detection: Open the app, navigate to the "Detection" tab, and swipe down to refresh all battery metrics fetched via standard APIs.
- Shizuku Privileged Detection:
- Install and start Shizuku on your device (pair via Wireless Debugging or PC ADB);
- In the app's "Settings" tab, click "Request Auth" or switch directly to the "Shizuku" tab. Once granted, real fuel gauge cycle counts and low-level parameters will be parsed in real time.
- Bugreport Analysis:
- In "Developer options" on your device, tap "Take bugreport";
- Once completed, go to the "Bugreport" tab and click "Import Bugreport", select the generated
.zipor.txtfile, and the app will instantly parse and present the capture time along with detailed battery health metrics.
๐ License & Terms
This project is open-source software licensed under the MIT License.
1. Terms of Use & Redistribution
- Freedom of Use: Individuals and developers are free to use, modify, study, fork, or incorporate this software into personal or academic solutions.
- Attribution Requirement: All substantial copies or redistributions of the source code or binary distributions must include the original copyright notice (
Copyright (c) 2024-2026 zhyang18) and the MIT License text.
2. Disclaimer & Limitation of Liability
- The software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
- Real-time metrics and battery statistics rely on Android public APIs, low-level Linux kernel
sysfspower supply nodes (/sys/class/power_supply), Shizuku privileged interfaces, and Android Bugreport parsing. Due to architectural heterogeneity across different device manufacturers (HONOR, Xiaomi, OPPO, vivo, Huawei, Samsung, etc.), chipsets, and firmware versions, the authors and contributors make no warranties regarding absolute precision, and shall not be held liable for any claims, damages, hardware/software malfunctions, or data discrepancies arising from the use of this application.
3. Data Authenticity Principle
- This project strictly adheres to the principle of authenticity, objectivity, and transparency. Generating fabricated, dirty, mocked, or artificially clamped fallback data is strictly prohibited.
- If a sensor or kernel driver does not supply a specific metric (e.g., USB input wattage, precise NTC cell temperature, physical FCC), the app will honestly display it as unknown or unacquired rather than producing deceptive mock readings.
4. Third-Party Acknowledgements
We express our sincere appreciation to the open-source community and the following key libraries that make this project possible:
- Shizuku / Shizuku-API: Rootless privileged system API execution framework (Apache License 2.0).
- MPAndroidChart: High-performance and flexible Android charting library (Apache License 2.0).
- Material Components for Android: Modern Material Design 3 UI component system (Apache License 2.0).
- Kotlin Coroutines: Reactive asynchronous concurrency framework (Apache License 2.0).
- AndroidX: Official Android Jetpack architecture and foundation libraries (Apache License 2.0).
How Shizuku is used
Can read battery health, per-app power use, foreground app, grant usage access, reset stats and keep monitor alive via `Shizuku newProcess and privileged binders`.
This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.
How this app uses Shizuku
Shizuku provides an elevated shell and privileged system binders for deeper battery and power analysis than normal system APIs allow.
- Read battery health: Shows design, full and current capacity, cycle count, level, temperature, voltage, current, power and technology by reading protected battery nodes, system battery output and vendor data through Shizuku.
- Show per-app drain: Shows per-app power use, discharge time, screen time and hardware use such as CPU, network, wake locks and sensors by querying power statistics output and package UID mapping through Shizuku.
- Show single-app details: Shows CPU, wake lock, GPS and foreground service use for a chosen app by querying power statistics for that package through Shizuku.
- Detect foreground app: Attributes power use to the app on screen by asking the privileged activity task service for the focused task and top activity through Shizuku, with activity and window output as fallback.
- Enable usage access: Grants its own usage access in one tap with system grant commands through Shizuku so power attribution works without manual settings steps.
- Reset discharge stats: Clears the system discharge ledger when a new discharge session starts through Shizuku.
- Keep monitor alive: Starts a persistent battery monitor helper process with an elevated shell launch through Shizuku so sampling continues in the background, and stops it with privileged termination commands.
Android APIs or commands used
cat /sys/class/power_supply/battery/ueventdumpsys batterydumpsys batterystatsdumpsys batterystats --chargeddumpsys batterystats --historydumpsys batterystats --checkindumpsys batterystats --resetdumpsys activity broadcastsdumpsys activity activitiesdumpsys windowdumpsys miui.batterygetpropgetprop vendor.battery.charge_nowpm list packages -Uappops setpm grant android.permission.PACKAGE_USAGE_STATSIActivityTaskManager.getFocusedRootTaskInfoIActivityTaskManager.getTasksIActivityManager.getTasksapp_processkill -9pkill -f
Notable details
Without Shizuku active or authorized, battery health falls back to normal system APIs with less detail and power statistics run in standard mode.
Changelog
What's new for version 1.9.10.3
๐ฆ ๅบ็จๅฎ่ฃ ๅ
- ๐ Release APK: ็ป็ฑๆญฃๅผ็ญพๅ๏ผๆจ่ๆฅๅธธไฝฟ็จ
- ๐ ๏ธ Debug APK: ่ฐ่ฏๅผๅๅ
๐ ็ๆฌ่ฏดๆ
ไฟฎๅคappๅดฉๆบ้ฎ้ข
๐ ๆไบคๆดๆฐ่ฎฐๅฝ (Changelog)
็ป่ฎก่ๅด๏ผ
v1.9.10.2\(\rightarrow\)v1.9.10.3
- ไฟฎๅคappๅดฉๆบ้ฎ้ข (86e1b4a)
ๆๅปบ็ผๅท: #297 | ่งฆๅๆไบค: 86e1b4acc68ebbca1f3b4e295d9446b3295b1c0d
Permissions
12 permissions requested
Sources
3 sources
Sources
3 sources




