Skip to content

Charging notification: show tier + wattage instead of %/h (#125)#149

Merged
almothafar merged 2 commits into
masterfrom
feat/125-charging-wattage-notification
Jul 14, 2026
Merged

Charging notification: show tier + wattage instead of %/h (#125)#149
almothafar merged 2 commits into
masterfrom
feat/125-charging-wattage-notification

Conversation

@almothafar

Copy link
Copy Markdown
Owner

Closes #125. Part of the charger-notification redesign.

Stacked on #148 (#124), which is stacked on #147 (lint). Base retargets down the stack as each merges.

What

While charging, the ongoing status notification now shows the estimated charge speed instead of %/h:

85% · Fast charging · ~18 W · 32.0 °C

%/h is the right unit while discharging ("how fast am I losing battery") but a weird one while charging — people think in charger speed there. Discharging is unchanged (Discharging 9%/h).

How

statusWithRate gains a charging-only branch: it reads SystemService.getChargeSpeed (CURRENT_NOW × voltage, from #122) and, when the speed is known, renders tier + wattage via the existing tierLabelRes mapping (reused, not duplicated). Since the tier label already reads as "… charging", it replaces the plain "Charging" word rather than doubling it ("Charging · Fast charging").

Falls back cleanly to the existing %/h → mA → plain chain when the speed cant be estimated. The ChargeSpeed read is charging-only, so the discharging hot path is untouched.

  • Still gated by the existing key_show_rate_in_notification preference — no new setting.
  • One new string (notification_status_charge_power), Western digits (Battery details table: fix RTL alignment + use Western digits for numbers #96), localized in values-ar (Arabic drafted — pending your review).
  • Skipped the issues optional details-table charging-speed row to keep scope tight — can revisit.

Verified

  • testDebugUnitTest + assembleDebug + lintDebug all green. The ChargeSpeed math is covered by the existing ChargeSpeedTest; the new segment is Context glue like statusWithRate itself.
  • Installed on the Mate 10 Pro. On-device check pending (your step): while charging, confirm the notification shows tier + wattage. ⚠️ If this device doesnt report a usable CURRENT_NOW while charging, the speed is unknown and it correctly falls back to Charging 30%/h — that fallback is expected behaviour, not a bug.

🤖 Generated with Claude Code

almothafar and others added 2 commits July 14, 2026 19:10
A single "Time to full · ~1h 20m" row directly below the charge rate,
shown only while charging with a trustworthy rate and below the taper
top (level < 99%) — hidden otherwise, so it never shows a garbage 0m.

Capacity-free linear projection from #108's smoothed charge rate:
(100 - level) / ratePercentPerHour, so it works on devices with an
unreliable charge counter (Kirin) too. Deliberately simple: no taper
modeling, precision is a non-goal (the OS owns the accurate figure).

New pure BatteryRateTracker.estimateMinutesToFull + a Western-digit
duration formatter. The estimate is unit-tested (level 99/100, rate 0/1,
rounding); the formatter is tested under Robolectric (~1h 20m / ~45m,
and Western digits even under the Arabic locale). New strings localized
in values-ar (units stay Latin like the other rate values).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
While charging, the ongoing status notification now shows the estimated
charge speed instead of %/h — "85% · Fast charging · ~18 W · 32.0 °C".
Charger speed is what people think in while plugged in; %/h stays the
right unit while discharging (unchanged).

statusWithRate gains a charging-only branch that reads getChargeSpeed
(CURRENT_NOW × voltage, from #122) and, when known, renders the tier +
wattage via the existing tierLabelRes mapping. The tier label already
reads as "… charging", so it replaces the plain "Charging" word rather
than doubling it. Falls back cleanly to the existing %/h → mA → plain
chain when the speed can't be estimated (e.g. a device without
CURRENT_NOW), so the discharging hot path is untouched.

Still gated by the existing show-rate preference — no new setting. One
new string (Western digits, #96) localized in values-ar. The ChargeSpeed
math is already covered by ChargeSpeedTest.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@almothafar almothafar force-pushed the feat/124-time-to-full-row branch from 90124b5 to d5971a2 Compare July 14, 2026 16:12
@almothafar almothafar force-pushed the feat/125-charging-wattage-notification branch from 3f5d8e3 to 0181454 Compare July 14, 2026 16:12
Base automatically changed from feat/124-time-to-full-row to master July 14, 2026 23:05
@almothafar almothafar merged commit ea04c6f into master Jul 14, 2026
1 check passed
@almothafar almothafar deleted the feat/125-charging-wattage-notification branch July 14, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charging: show tier + wattage (not %/h) in the ongoing notification while charging (shrunk scope)

1 participant