🟡 Flag unreliable battery readings — "Unknown" capacity on home, warning on insights (#94)#95
Merged
Merged
Conversation
Some devices (notably certain Kirin/HiSilicon chipsets) report a charge counter that bears no relation to the real capacity, so the measured health came out as an absurd figure (e.g. 21% on a healthy 4000 mAh battery). Cross-check the current-full-capacity estimate against the user-entered design capacity and, when it lands outside a plausible window (40%-115% of design), show an explicit "Unknown" state with a tappable amber info icon instead of a misleading number. The info dialog explains the likely cause (a hardware/counter quirk) and also flags the genuine edge case that the battery may be wearing out, with signs to watch for (shutdowns under load, the level collapsing near the bottom, faster drain). - BatteryHealthTracker.isMeasuredHealthUnreliable() + pure, unit-tested isEstimateImplausible() helper - BatteryInsightsActivity: split health rendering into resolved vs. unreliable states; amber "?" + "Unknown" + info dialog - New ic_info_amber vector; EN strings + Arabic drafts (pending review) Closes #94 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The unreliable-reading case belongs on the home screen's Capacity value (the misleading "855 mAh"), not on the insights health figure. Per review: - Home: the Capacity row now shows "Unknown" with a tappable amber info icon when the reading can't be trusted; the dialog explains why. - Insights: reverted to showing the real health number + grade; when the reading is unreliable it keeps the figure but adds a tappable amber warning icon that opens the same explanation. - Rename isMeasuredHealthUnreliable() -> isBatteryReadingUnreliable(), now shared by both screens (same getBatteryCapacity-vs-design check). - Generic battery_reading_unreliable_* strings (EN + Arabic drafts); new ic_warning_amber; drop the now-unused health_unreliable_* strings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review follow-ups on #94: - Use the same amber warning icon on both screens (home Capacity row now matches the insights health figure); drop the now-unused ic_info_amber. - Grammar pass on the Arabic dialog copy (maintainer review): "رغم وجود شحن كافٍ", "لا تُطابق", "بصورة غير صحيحة", drop redundant trailing phrase, reword the 20%/2% line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
On devices whose charge counter is unreliable — notably certain Kirin/HiSilicon chipsets that report a small fixed µAh regardless of actual capacity — the home screen showed a bogus Capacity (e.g.
855 mAh) and the insights screen a bogus health figure (e.g.21%on a healthy 4000 mAh battery).This flags those readings honestly, in the right place on each screen:
How
BatteryHealthTracker.isBatteryReadingUnreliable(context)— shared by both screens — flags when the current-full-capacity estimate falls outside 40%–115% of the user-entered design capacity, backed by a pure, unit-testedisEstimateImplausible(currentFullMah, designMah)helper. (HomebatteryDO.getCapacity()and insights health both derive from the samegetBatteryCapacity()estimate, so the two screens always agree.)BatteryDetailsFragment: the capacity value cell gets a compound info icon + click → dialog, only when unreliable.BatteryInsightsActivity:updateHealthData()always renders the resolved figure; toggles the warning icon on/off by the same check.ic_warning_amber(insights) + existingic_info_amber(home); genericbattery_reading_unreliable_*strings, EN + Arabic drafts (pending maintainer review).Notes
testDebugUnitTest+assembleDebuggreen; installed on the Mate 10 Pro.Closes #94