Kirin CURRENT_NOW misread: display floor for current + plausibility floor for charge power (#152 v1)#169
Merged
Merged
Conversation
Kirin/HiSilicon reports CURRENT_NOW in mA instead of uA, so a real ~800 mA draw arrives as raw -800 and displayed as a nonsense "Discharging -1 mA" in the ongoing notification (and intermittently in the details table). Require the displayed current to round to at least MIN_DISPLAY_CURRENT_MA (10): the misread values cap out at ~1-3 "mA" and disappear, while on genuine-uA devices a sub-10 mA draw only happens in deep sleep, where nothing is being read anyway. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The same Kirin mA-unit misread flows into ChargeSpeed.powerMilliwatts (uA x mV / 1e6): a raw ~1000 while fast charging yields ~3-4 mW, which passed the > 0 check and classified as a known Trickle tier. That mislabeled the charge-connected announcement and the notification's charging segment as "Slow charging" (#125), and made SlowChargeDetector (#123) fire a false "check the cable and port" warning on every wired charge below 80%. A phone that reports CHARGING is never genuinely taking in under ~0.1 W, so add MIN_PLAUSIBLE_MW (100) as the mirror of the existing MAX_PLAUSIBLE_MW guard. Unknown power makes the tier displays fall back to the plain label and keeps the slow-charge detector asleep (its powerKnown gate). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 17, 2026
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.
Fixes the user-visible fallout of the Kirin/HiSilicon
CURRENT_NOWunit bug (#152): the fuel gauge reports mA instead of µA, so real readings arrive 1000× too small and slipped through every gate that only guarded against too-large values.v1a — current display floor (
BatteryRateTracker)MIN_DISPLAY_CURRENT_MA = 10; thehasCurrentgate incomputeRatenow requires the rounded magnitude to reach it (was>= 1).v1b — charge power plausibility floor (
ChargeSpeed)MIN_PLAUSIBLE_MW = 100(0.1 W), mirror of the existingMAX_PLAUSIBLE_MWguard: a phone that reportsCHARGINGis never genuinely taking in less.SlowChargeDetector'spowerKnowngate keeps it asleep.Tests
fromMeasurements../gradlew :app:testDebugUnitTestand:app:lintDebugpass.On-device verification (Mate 10 Pro)
v2 (unit auto-calibration, showing the real current on Kirin) follows as a stacked PR.
Part of #152 — v1 of the two-stage fix; the stacked v2 PR closes it.
🤖 Generated with Claude Code