FullCharge: Switch charge modes from the gesture notification - #50
Merged
Conversation
…ication The reconnect-gesture notification was display-only. It now carries two actions on its standing states: the adapter's declared protective default (named after defaultProtectivePolicy, so Adaptive-default adapters aren't mislabelled as a percentage limit) and "Always 100%". Both route through the existing serialized ACTION_SET_PERSISTENT_POLICY command, the same path the widget uses, so they inherit its writability guard, recovery-target persistence before the risky write, session cancel-without-restore, forced re-write and surface updates. No new write path and no change to the writable-setting allowlist. Actions are attached on IDLE and ARMED only — an explicit allowlist rather than "not the countdown", because TRIGGER also reaches the builder and a tick that is starting a full charge must not offer a competing persistent write. The two PendingIntents differ only in an extra, which does not factor into PendingIntent equality, so they use distinct request codes. setPersistentPolicy's refusal branch now posts the recovery notification: the widget and tile pre-check writability and open the app instead of dispatching, but a notification action cannot, so its tap would otherwise be a silent no-op.
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
Technical Context
ACTION_SET_PERSISTENT_POLICYservice command the widget's ∞80%/∞100% buttons already use (cancels a running session without restoring, force-writes so same-value writes still re-trigger the HAL, updates all surfaces). No new write path, no allowlist or capability-gate change.SessionNotifications.gesture()takes the protect policy as a required parameter fed from the adapter's declareddefaultProtectivePolicy, so the action follows the capability surface instead of hardcoding the Pixel limit. Label handlesFixedLimit/Adaptivewith a generic fallback, mirroring the widget'sprotectButtonLabel.IDLE || ARMEDallowlist rather than!= WAITING_FOR_RECONNECT, becauseTRIGGERalso reaches the builder and must not offer a competing persistent write.TRIGGER), labels per policy, policy-to-extra wiring, foreground-service PendingIntent semantics/distinctness, andsend()dispatch into the started-service record.