Skip to content

Restore launcher readiness check after boot; require dual logcat markers for launch validation - #82

Merged
mattleibow merged 5 commits into
best56/f2-2-workflowsfrom
copilot/investigate-android-emulator-issue
Feb 22, 2026
Merged

mattleibow merged 5 commits into
best56/f2-2-workflowsfrom
copilot/investigate-android-emulator-issue

Conversation

Copilot AI commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor

macOS CI (no KVM, --gpu guest) fails at launch validation because removing the launcher focus check in PR #81 left boot_completed=1 + CPU threshold as the only readiness signal — insufficient on slow emulators. The system reports "ready" while still initializing, so the test app never fully starts.

Evidence from run 22268361795: boot 394s ✅, CPU 7.24 (threshold 30) ✅, install ✅, monkey launch ✅, but E2E_APP_STARTED_SUCCESSFULLY never appeared in logcat across 25 attempts / 10 min. Same commit on Ubuntu (KVM): marker found on attempt 2.

Emulator.cs — Restore launcher readiness check

After boot_completed=1, poll dumpsys window displays for launcher focus with:

  • 120s hard timeout independent of --timeout — never blocks indefinitely (the hang that motivated PR Fix macOS emulator boot hang: remove launcher focus check, unify --timeout budget #81's removal)
  • ANR dialog dismissal via KEYCODE_BACK — handles the macOS-specific ANR focus-steal that caused the original hang
  • Non-blocking — proceeds after timeout since boot IS complete; the extra wait just gives the system time to stabilize
// Phase 3: best-effort launcher wait (won't fail, won't hang)
while (launcherSw.Elapsed < launcherTimeout && !token.IsCancellationRequested)
{
    var output = adb.Shell("dumpsys window displays", Serial);
    if (output.Any(l => l.Contains("mCurrentFocus", ...) && l.Contains("launcher", ...)))
        break;
    // Dismiss ANR dialogs blocking launcher focus
    if (output.Any(l => l.Contains("Application Not Responding", ...)))
        adb.Shell("input keyevent KEYCODE_BACK", Serial);
}

run.yml — Dual-marker launch validation

Require both markers, log each individually to reveal ordering:

  • E2E_APP_STARTED_SUCCESSFULLY — app-emitted marker
  • Displayed $TEST_APP_PACKAGE — system ActivityManager marker

This tells us definitively whether the activity displayed (system-level) vs whether the app's managed code ran to completion (app-level).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 22, 2026 06:29
…t markers

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
…ring

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate issues with Android emulator app installation on macOS Restore launcher readiness check after boot; require dual logcat markers for launch validation Feb 22, 2026
Copilot AI requested a review from mattleibow February 22, 2026 06:35
@github-actions

github-actions Bot commented Feb 22, 2026 •

Copy link
Copy Markdown

Test Results

  4 files    4 suites   22m 21s ⏱️
103 tests 100 ✅ 3 💤 0 ❌
206 runs  200 ✅ 6 💤 0 ❌

Results for commit 42c0919.

♻️ This comment has been updated with latest results.

@mattleibow
mattleibow marked this pull request as ready for review February 22, 2026 15:33
@mattleibow
mattleibow merged commit 0bfaf17 into best56/f2-2-workflows Feb 22, 2026
9 checks passed
@mattleibow
mattleibow deleted the copilot/investigate-android-emulator-issue branch February 22, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants