Repository navigation
feat(settings): keep-awake on and off on Android #4290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9fd6560
feat(settings): add keep-awake to hold the screen on Android and Harm…
strzhao f058c06
docs(settings): disclose keep-awake reboot semantics and pin its daem…
strzhao 1ab1758
fix(android): write the stay-on mask explicitly and report the read-b…
strzhao 73d04eb
feat(settings): lower Android keep-awake to svc stayon with mask read…
strzhao b2f9bec
docs(evidence): record both keep-awake live runs and the restore defect
strzhao abbba3a
fix(settings)!: land Android keep-awake alone — HarmonyOS half moves …
strzhao dd45e0f
docs(evidence): match the Android-only scope in the keep-awake eviden…
strzhao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # Android keep-awake end-to-end run and the svc-true no-op, 2026-11-08 | ||
|
|
||
| Evidence for #4290 (keep-awake on and off on Android): the | ||
| first backend draft lowered `on` to `svc power stayon true`, and a live run | ||
| proved that a no-op on real hardware — the command answers and the stored | ||
| value never moves when the mask already covers the plugged-in sources. The | ||
| shipped backend writes the setting itself and reports the read-back state. | ||
|
|
||
| ## Device | ||
|
|
||
| - Xiaomi Redmi K60 (`2312DRAABC` model code), Android 14 (SDK 34), adb serial | ||
| `5p4hqglvpzxshiuw`, USB connected. | ||
|
|
||
| ## The svc-true no-op (discovered live) | ||
|
|
||
| With the user's stored mask at `15`, the draft command changed nothing while | ||
| the CLI still acked the write: | ||
|
|
||
| ```sh | ||
| $ adb -s 5p4hqglvpzxshiuw shell "settings get global stay_on_while_plugged_in" | ||
| 15 | ||
| $ adb -s 5p4hqglvpzxshiuw shell "svc power stayon true; settings get global stay_on_while_plugged_in" | ||
| 15 | ||
| $ adb -s 5p4hqglvpzxshiuw shell "svc power stayon usb; settings get global stay_on_while_plugged_in" | ||
| 2 | ||
| ``` | ||
|
|
||
| `stayon true` does not rewrite a mask that already covers the plugged-in | ||
| sources; `stayon usb` rewrites to `2`. A write that skips no-op spellings is | ||
| the only reliable form. | ||
|
|
||
| ## The shipped backend, end to end through the public CLI | ||
|
|
||
| Branch build of #4290, one command per state, device state read back with raw | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
|
||
| `settings get` between the calls: | ||
|
|
||
| ```sh | ||
| $ node bin/agent-device.mjs settings keep-awake on --platform android --serial 5p4hqglvpzxshiuw | ||
| Updated setting: keep-awake | ||
| $ adb -s 5p4hqglvpzxshiuw shell "settings get global stay_on_while_plugged_in" | ||
| 7 | ||
| $ node bin/agent-device.mjs settings keep-awake off --platform android --serial 5p4hqglvpzxshiuw | ||
| Updated setting: keep-awake | ||
| $ adb -s 5p4hqglvpzxshiuw shell "settings get global stay_on_while_plugged_in" | ||
| 0 | ||
| ``` | ||
|
|
||
| `15 → 7 → 0`. The user's stored mask was restored to `15` after the run. The | ||
|
strzhao marked this conversation as resolved.
Resolved
|
||
| CLI result carries the read-back state (`stayOnWhilePluggedIn`), so an ack can | ||
| never claim a write the device did not store. | ||
|
|
||
| ## HarmonyOS note | ||
|
|
||
| HarmonyOS keep-awake moved out of #4290 (maintainer option B): no device was | ||
| reachable to prove a restore route, and on JDY-AL50 (HarmonyOS 7.0.0.111) | ||
| `power-shell timeout -r` acks but does not clear an active `-o` override (the | ||
| screen stayed up past 260s). The finding is recorded in the PR thread; a | ||
| future PR may bring the half back behind a proven restore route. | ||
|
|
||
| ## The live Android repro at head 73d04eb4a (2026-11-23) | ||
|
|
||
| The review asked for a device where `svc power stayon true` fails, or the | ||
| hand-written mask dropped for the toggle read-back. The Redmi 2312DRAABC | ||
| (Android 14, MIUI) answers the question from the other side: | ||
|
|
||
| ```sh | ||
| $ adb shell settings get global stay_on_while_plugged_in | ||
| 0 | ||
| $ adb shell svc power stayon true | ||
| $ adb shell settings get global stay_on_while_plugged_in | ||
| 15 | ||
| $ adb shell svc power stayon false | ||
| $ adb shell settings get global stay_on_while_plugged_in | ||
| 0 | ||
| ``` | ||
|
|
||
| `svc power stayon true` writes 15 from a 0 row on this unit — the original | ||
| lowering keeps the screen on here, and `false` returns the row to 0. The | ||
| shipped 7 write would clobber a 15 a dock or user had set, so the lowering now | ||
| rides the global-toggle machinery: `svc power stayon true|false`, the row | ||
| polled to a state (`0` disabled, any positive mask enabled), and the typed | ||
| `keep-awake-not-applied` / `keep-awake-unreadable` reasons on a read-back that | ||
| did not move or is not a mask. The result is `{ keepAwake }` only. | ||
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.