Skip to content

Android snapshot returns stale launcher hierarchy while foreground app is active #564

Description

@ludwig-pro

Summary

On Android, agent-device snapshot -i can return a stale Pixel Launcher hierarchy while the foreground app is active.

The command reports the target app as Page / App, but the returned nodes are from com.google.android.apps.nexuslauncher. At the same time, agent-device screenshot shows the correct foreground app UI.

Environment

  • agent-device: 0.14.7
  • Host: macOS arm64
  • Android device: Pixel 9a
  • Android: 16 / API 36
  • App type: React Native / Expo development build

Reproduction

agent-device open <app.package> --platform android --relaunch
agent-device wait 10000 --platform android
agent-device snapshot -i --platform android

Observed snapshot shape:

Page: <app.package>
App: <app.package>
Snapshot: 47 visible nodes
@e1 [group] "Search"
@e2 [image] "Google app"
@e3 [text-field] "Search web and more" [editable]
@e6 [gridview] "com.google.android.apps.nexuslauncher:id/apps_list_view"
...

Android foreground state still points to the app:

adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'
mCurrentFocus=Window{... u0 <app.package>/<app.package>.MainActivity}
mFocusedApp=ActivityRecord{... u0 <app.package>/.MainActivity ...}

Screenshots

1 2
Image Image

Expected behavior

snapshot -i should return the foreground app hierarchy, or fail explicitly if the Android snapshot backend cannot produce a trustworthy tree. It should not report app metadata while returning stale launcher nodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-infoWaiting on reporter or external input

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions