Charging notification: show tier + wattage instead of %/h (#125)#149
Merged
Conversation
almothafar
force-pushed
the
feat/124-time-to-full-row
branch
from
July 14, 2026 15:31
6a7e596 to
90124b5
Compare
almothafar
force-pushed
the
feat/125-charging-wattage-notification
branch
from
July 14, 2026 15:31
1e2715a to
3f5d8e3
Compare
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
force-pushed
the
feat/124-time-to-full-row
branch
from
July 14, 2026 16:12
90124b5 to
d5971a2
Compare
almothafar
force-pushed
the
feat/125-charging-wattage-notification
branch
from
July 14, 2026 16:12
3f5d8e3 to
0181454
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #125. Part of the charger-notification redesign.
What
While charging, the ongoing status notification now shows the estimated charge speed instead of
%/h:%/his 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
statusWithRategains a charging-only branch: it readsSystemService.getChargeSpeed(CURRENT_NOW × voltage, from #122) and, when the speed is known, renders tier + wattage via the existingtierLabelResmapping (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
ChargeSpeedread is charging-only, so the discharging hot path is untouched.key_show_rate_in_notificationpreference — no new setting.notification_status_charge_power), Western digits (Battery details table: fix RTL alignment + use Western digits for numbers #96), localized invalues-ar(Arabic drafted — pending your review).Verified
testDebugUnitTest+assembleDebug+lintDebugall green. TheChargeSpeedmath is covered by the existingChargeSpeedTest; the new segment is Context glue likestatusWithRateitself.CURRENT_NOWwhile charging, the speed is unknown and it correctly falls back toCharging 30%/h— that fallback is expected behaviour, not a bug.🤖 Generated with Claude Code