Keep screen awake during active computer use - #46
Merged
Miyamura80 merged 2 commits intoSep 16, 2026
Merged
Conversation
The screen dimming or sleeping mid-session interrupts computer use: today AndroidComputerSource refuses to act once the screen is off, so a normal device screen timeout cuts sessions short. Add FLAG_KEEP_SCREEN_ON to the computer-use border overlay window, which is already re-armed on every observe/control call. This holds the display awake for as long as the window is attached, with no WAKE_LOCK permission and no device-wide timeout change, and releases on its own once the agent goes quiet. Decouple two lifetimes so behaviour stays clean: - The animated frame still hides ~1.5s after the last command (unchanged UX). - The window itself lingers ~60s to bridge the gaps between commands (model latency, network) so the screen does not dim between actions, then detaches. While idle the view paints nothing, so no GPU work happens; the window simply stays attached to hold the screen on. FLAG_KEEP_SCREEN_ON only keeps an already-on screen awake, consistent with the existing screen-off guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3vMrbcQhiGuMZdUdg8hHg
Address code-review feedback on the keep-screen-on change. Fold the frame's linger timing into LiquidMetalBorderView so the overlay owns a single concern and a single timer: - The view self-limits: poke(mode) refreshes an animate-until deadline and the frame loop quiesces on its own once pokes stop, clearing to transparent. The animation time base is still set only when starting from idle, so repeated pokes extend the frame with no visual jump. - ComputerUseBorderOverlay drops the second timer, the hideFrame() pass-through, and its copy of the frame-linger constant. It now only schedules window removal (the keep-awake lifetime), and signal() reduces to attach + poke + reschedule. - setMode is now private (poke is the only entry point); startAnimating is gone. - Document KEEP_AWAKE_MILLIS as an idle timeout, not a session length, and state its failure mode: a gap longer than it between two actions lets the screen sleep mid-session. There is no explicit session-end signal to key off (computer use is a stream of discrete observe/control calls), so the idle timeout stands. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3vMrbcQhiGuMZdUdg8hHg
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
github-actions
Bot
deleted the
claude/android-screen-timeout-computer-use-qti51o
branch
September 16, 2026 19:07
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.
Summary
The phone screen dimming or sleeping mid-session interrupts computer use:
AndroidComputerSourcerefuses to act once the screen is off, so a normal device screen timeout cuts sessions short.This holds the display awake while computer use is active by adding
FLAG_KEEP_SCREEN_ONto the computer-use border overlay window (which is already re-armed on every observe/control call). It needs noWAKE_LOCKpermission and makes no device-wide timeout change, and it releases on its own once the agent goes quiet.FLAG_KEEP_SCREEN_ONonly keeps an already-on screen awake; it cannot wake a screen that is already off, which is consistent with the existing screen-off guard. Starting a session on a sleeping phone is intentionally out of scope.Changes
FLAG_KEEP_SCREEN_ONto the border overlay window inComputerUseBorderOverlay.LiquidMetalBorderView(poke(mode)self-limits and quiesces on its own), so the overlay owns a single concern and a single timer.onDrawpaints nothing while idle, so the window stays attached with no GPU work.KEEP_AWAKE_MILLISas an idle timeout (not a session length) and its failure mode: a gap longer than it between two actions lets the screen sleep. There is no explicit session-end signal to key off, since computer use is a stream of discrete observe/control calls.Testing
./gradlew assembleDebug)./gradlew testDebugUnitTest)./gradlew lintDebug)Note: no Android SDK in the authoring sandbox, so these are left for CI (the "Build & unit test" job) to verify. No unit-test-shaped logic changed; the change is Android View/WindowManager wiring.
Related Issues
Closes #
🤖 Generated with Claude Code
https://claude.ai/code/session_01K3vMrbcQhiGuMZdUdg8hHg
Generated by Claude Code
Summary by cubic
Prevents a normal screen timeout from interrupting computer-use sessions by keeping the display awake while the border overlay is attached.
AndroidComputerSourcealready refuses to act once the screen is off, so a device screen timeout used to cut sessions short.FLAG_KEEP_SCREEN_ONand stays attached for 60s after the last command; the animated frame still disappears after ~1.5s as before.WAKE_LOCKpermission, changes no device-wide timeout, and can only keep an already-on screen awake—it cannot wake a sleeping screen.Written for commit b49aa52. Summary will update on new commits.