FullCharge: Cancel a session only on a real native settings change - #65
Merged
Conversation
The session service's native-change observer cancelled without restoring on ANY notification for the adapter's setting URIs. Notifications are dispatched asynchronously, so the session's own override write can arrive after the observer registers, and an OEM provider can notify without a value change — both observed on HyperOS 3 tanzanite (issue #48), where the session ended mid-charge and the protective policy was never restored. NativeChangeGuard now verifies the change where the configuration is synchronously readable: a readback still decoding to the session's override policy is noise and keeps the session; a different, foreign, or unreadable value cancels as before. Adapters without sync readback (Pixel) keep the blanket cancel. A Shizuku readback timeout counts as unreadable instead of silently dropping the notification. Also records the tanzanite beta verification results in the qualification ledger: absent key decodes as Intelligent (confirmed), app-context three-mode control works over direct WSS, and the mode-2 cap is fixed at 80%.
This was referenced Aug 15, 2026
d4rken
added a commit
that referenced
this pull request
Aug 16, 2026
…71) The 2026-08-14 beta run on the Redmi Note 14 (tanzanite) failed its temporary-session check: the native-change observer cancelled on a notification carrying no value change, so the device charged to 100% with Battery protection never restored. That was fixed by NativeChangeGuard (#65), which shipped in v0.3.4-beta0. The contributor re-ran the session test on that build (issue #48): the session reached 100% and Battery protection was re-written automatically with the cable still connected. RESTORE_FULL therefore fires without a disconnect, and the guard holds against the exact notification pattern that produced the bug. Ledger row and known-gaps bullet updated; the remaining unrun items on this device are the disconnect-early restore, the Shizuku tier, boot recovery, and an R8 smoke.
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 changed
A temporary full-charge session could silently end mid-charge without restoring the protective policy: the battery then charged to 100% and protection stayed off until changed manually. Reported from the HyperOS 3 verification run in #48, where the session's cancel-on-native-change watcher fired on a settings notification that carried no actual value change. Sessions now end without restoring only when the charging setting really changed outside the app.
Technical Context
NativeChangeGuard(pure, unit-tested) ignores a notification whose sync readback still decodes to the session's override policy; a different, unrecognized, or unreadable value cancels as before, and adapters without sync readback (Pixel) keep the blanket cancel.TimeoutCancellationException, aCancellationExceptionsubclass — it is caught as "unreadable → cancel" rather than rethrown, which would silently drop the notification and keep a session alive past a genuine native change.