Repository navigation
fix(android): skip the tap-escape guard when the launcher owned the focus before - #5011
Conversation
…ocus before The post-touch escape guard compared the foreground after the dispatch with the session app and never looked at what was in front before it. A deliberate longpress on the launcher after `home` therefore failed with "press ... left <app> and foregrounded <launcher>", although the gesture ran. The before-command blocking-dialog readiness read already learns the focused window, from the helper focus call or the window dump. It now reports that window's package on a clear read. The guard skips a touch dispatched while an escape surface (launcher, Settings, System UI) already owned the focus. Other packages in an app flow, such as a permission prompt or a custom tab, and a read that names no package keep the guard. The guard's messages name the actual command instead of "press".
|
Thanks for the fix. At 5aa044c this is ready: the guard now skips only when the launcher owned the focus before the tap, and the launcher-before test is the one that fails without the change. Not blocking, and fine to take or leave: the retained route (app owns focus, a tap escapes, the guard still throws) has no live run at this head, so one run where pressing an in-app element opens Settings or the launcher and returns COMMAND_FAILED 'left and foregrounded ' would cover it; The Smoke Tests failure looks unrelated: the Linux desktop job stopped in 'Install Linux desktop dependencies' because apt-get update timed out, before any repo code ran. The other Smoke Tests, Integration, Coverage and Lint jobs pass at this head, and Body rules passes. There are no conflicts. Re-running the Smoke Tests job should clear the last red check. Not verified here: the Pixel 9 AVD transcript in the PR body, whether that run used the helper path or the dumpsys path for the focus read, and the tests locally; they were read, not run. |
Summary
The Android escape check failed a deliberate touch made while the session app was already in the background. After
home, alongpresson a launcher icon opened the shortcut menu but returnedCOMMAND_FAILED … The tap likely escaped the app, so agents retried a gesture that had already worked.The check is now skipped only when an escape surface (the launcher, Settings, System UI) owned the focus before the dispatch. The focus comes from the blocking-dialog readiness read that already runs before each touch, so there's no extra device call. A permission prompt, custom tab or sign-in activity in the app's flow, or a read that names no package, keeps the check. Messages now name the actual command.
Before / after
Pixel 9 AVD (Android 16):
open <app>,home,snapshot -i, then a long-press on the app's launcher icon:Validation
5aa044cce,check:affected --run --head,exactCommit: true. Format, lint, typecheck, layering, fallow, build and vitest-related pass.unitfails only onupload-http-deadlineandcommitted-source-tree, which fail the same way on clean main on this macOS host.test:integration:providerpasses when run directly (317/317).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.