Skip to content

About

Real 0.01% hardware decimal battery percentage Xposed / LSPosed module for Samsung One UI 9 (Android 17) & rooted Android — live Compose status bar pill, Lock Screen, AOD & Settings

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Decimal Battery

Real 0.01% hardware-precision decimal battery percentages (49.27% / 49,2%) across Android SystemUI, Lock Screen, Always On Display, and Settings.

Built natively for Samsung One UI 9 (Android 17) on Galaxy S26 Ultra, with multi-OEM hardware fuel-gauge probes and classic AOSP hooks.

Latest Release Build CI Android 13-17 Xposed API 82+ License: MIT


Live Hardware Screenshots (Galaxy S26 Ultra · One UI 9 / Android 17)

Live pill padding adjustment (-15% to +40%) resizes the native Jetpack Compose status-bar battery capsule in real time without restarting SystemUI:

Compact (-15% padding · 148 px) Default (0% padding · 162 px) Wide (+40% padding · 228 px)
Compact status bar battery pill showing 55.07 Default status bar battery pill showing 49.27 Wide status bar battery pill showing 55.07

Features

  • True Hardware Fuel-Gauge Precision (0.01%) — Reads raw capacity registers directly from kernel sysfs nodes (batt_read_raw_soc, capacity_raw, soc_decimal) rather than timer-guessing or faking decimals.
  • Native Samsung One UI 9 Compose Pill — Dynamically expands BatteryLayoutState.totalWidthPx, balances icon-to-text padding, optically centers Canvas typography, and flushes updates via Compose Snapshot.sendApplyNotifications() for sub-frame latency while the screen is on.
  • System-Wide Battery Coverage:
    • Status Bar & Quick Settings Header — SamsungBatteryComposeView, SamsungBatteryMeterDrawable, and AOSP BatteryMeterView.updatePercentText
    • Charging Popup Chip & Lock Screen Now Bar — SamsungBatteryStatusChip and ChargerNowBarView
    • Lock Screen & Notifications — KeyguardIndicationController and ChargingNotificationTextFormatter
    • Always On Display (AOD) — com.samsung.android.uniform.widget.battery.* and ChargingInfoView
    • Settings & Device Care — BatteryLevelPreferenceController, BatteryInfoProgressView (smooth float progress + Spanned text), AOSP BatteryInfo, and battery-scoped SettingsLib Utils.formatPercentage
  • Zero-Reboot Live Customization:
    • Switch between 0.1% tenths and 0.01% hundredths
    • Choose dot (49.27%) or comma (49,27%) decimal separator
    • Keep 100% clean at full charge (optional)
    • Adjust pill padding (-15% to +45%), pill font scale (75% to 105%), and screen-on refresh rate (250 ms, 500 ms, 1 s, 2 s)
  • One-Tap Root Setup & Diagnostic Inspector:
    • Live hardware telemetry dashboard (voltage, power wattage, temperature, OS vs. hardware delta sparkline, SOC rate %/min)
    • Auto-discovers fuel-gauge SELinux file labels and installs a persistent KernelSU / Magisk / APatch module (/data/adb/modules/decimal_battery_sysfs)
    • Exports a ready-to-paste Markdown diagnostic report (SYSTEM -> Copy Diagnostic Report)

How Hardware Precision Works

Decimal Battery selects the highest-resolution readable source on your kernel in priority order:

  1. Samsung sec_battery / max77775 (Primary on Samsung Galaxy) Applies the exact kernel scaling formula from max77775_fg_get_scaled_capacity:
    percent = clamp(batt_read_raw_soc * 10.0 / batt_capacity_max, 0.0, 100.0)
    
  2. Qualcomm / Maxim / Pixel / Multi-OEM capacity_raw & soc_decimal Probes /sys/class/power_supply/{battery,bms,maxfg,max1720x_battery,fg,fuelgauge,qcom-battery} and auto-calibrates raw register scaling (÷100.0, ÷256.0 for Q8.8 RepSOC, ÷10.0, or ÷1000.0) against Android's reported integer capacity.
  3. Universal charge_counter / charge_full Fallback Reads charge_counter (µAh) and charge_full via sysfs or BatteryManager when raw SOC registers are unavailable.

Device & ROM Compatibility

ROM / Device Status What Works Limitations / Notes
Samsung One UI 9 (Android 17)
Tested on Galaxy S26 Ultra (SM-S948B)
Verified Full Compose status bar & QS pill, live pill padding, charging chip, Now Bar, Lock Screen charging text, AOD, Settings & Device Care —
Samsung One UI 7 / 8 Experimental SamsungBatteryMeterDrawable, AOD, Device Care, Settings BatteryLevelPreferenceController Compose status bar classes are specific to One UI 9 builds and have not been tested on One UI 7/8
AOSP / LineageOS / Pixel (Android 13–17) Experimental (Hooks Unverified on Device) Classic BatteryMeterView.updatePercentText, BatteryInfo, SettingsLib Utils.formatPercentage, and capacity_raw / charge_counter readers Newer Pixel Compose UnifiedBattery glyph-path icons do not render a TextView percentage and are not hooked yet
HyperOS / MIUI / ColorOS / OxygenOS Partial / Untested Companion telemetry dashboard + generic capacity_raw / soc_decimal probing Heavily customized OEM SystemUI battery views usually need dedicated hook PRs — share your Diagnostic Report in an OEM Support Issue

Requirements & 3-Step Install

  • Root: KernelSU / KernelSU Next, Magisk, or APatch
  • Xposed Framework: Vector or LSPosed (API 82+)
  1. Install the latest APK from GitHub Releases (com.mahanytt.decimalbattery).
  2. Enable & Scope in Vector / LSPosed:
    • Enable Decimal Battery
    • Scope com.android.systemui (plus com.android.settings, and com.samsung.android.app.aodservice + com.samsung.android.lool on Samsung)
    • Or open Decimal Battery and tap Auto-Enable in Vector if /data/adb/lspd/cli is installed
  3. Unlock Sysfs & Restart SystemUI:
    • Tap Unlock Hardware Fuel Gauge inside the app (applies live SELinux read-only rules and installs /data/adb/modules/decimal_battery_sysfs so permissions survive reboots)
    • Tap Restart SystemUI in the SYSTEM tab

Troubleshooting & FAQ

  • Status pill shows whole numbers or integer fallback? Tap SYSTEM -> Unlock Hardware Fuel Gauge and check whether Direct Sysfs Access turns green (Unlocked (0.01%)). If your kernel stores raw SOC under a different node name, expand Power Supply Inspector and open an OEM Support Request.
  • Sliders or formatting toggles don't update immediately? Ensure Decimal Battery itself (com.mahanytt.decimalbattery) and com.android.systemui are both enabled in Vector/LSPosed so XSharedPreferences and ACTION_SETTINGS_CHANGED stay synced.
  • Note on APK Signatures: v1.1.0 was signed with the fallback build key until a dedicated release keystore secret is configured in GitHub Actions. Future releases signed with a dedicated keystore will require uninstalling and reinstalling once if Android reports a signature mismatch.

Building from Source

Requires JDK 21 and Android SDK 37.2 (minSdk 33, targetSdk 37).

git clone https://github.com/MahanYTT/DecimalBattery.git
cd DecimalBattery
./gradlew :app:assembleDebug :app:assembleRelease

Optional release signing environment variables (supported both locally and via GitHub Actions repository secrets):

Variable / Secret Purpose
KEYSTORE_BASE64 (CI only) Base64-encoded .jks / .keystore decoded to KEYSTORE_PATH on runner
KEYSTORE_PATH Path to local release keystore file
KEYSTORE_PASSWORD Keystore store password
KEY_ALIAS Signing key alias
KEY_PASSWORD Signing key password

License

Licensed under the MIT License.

About

Real 0.01% hardware decimal battery percentage Xposed / LSPosed module for Samsung One UI 9 (Android 17) & rooted Android — live Compose status bar pill, Lock Screen, AOD & Settings

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages