Conversation
Add tapUntilPrefChanges: wait for the switch to be enabled and bounds-stable before each tap attempt, then poll up to 2s for the preference to flip, and retry the whole sequence up to 3 times before failing. Addresses two no-ANR flake classes observed across API-29 CI runs after the UiAutomator-node fix (ActivityWatch#266): 1. The tap lands before SyncSettingsActivity finishes applying async state — the switch is laid out but not yet interactive, so the click is ignored. 2. The preference write completes after the 2s window on a loaded emulator; the next attempt observes the change immediately. The assertion stays strict: a genuinely broken toggle still fails the test after maxAttempts taps. Removes the now-unused awaitSyncEnabled helper. Git-Session-Id: d850
|
Address two correctness issues Greptile flagged on ActivityWatch#287's retry helper: - Re-check prefs.isSyncEnabled() before each retry tap. A tap processed just after its poll window closed flips the preference late; retrying blindly reversed the successful transition and could fail a working toggle intermittently. - Track readiness and skip the tap when the enabled + stable-bounds wait times out. Falling through to tapViewCenter could inject a premature or misplaced tap and consume an attempt. If no attempt ever reached readiness, fail with a message naming that condition rather than the tap assertion. Verified: ./gradlew :mobile:compileStandardDebugAndroidTestKotlin builds. Git-Session-Id: ece32b17-aee2-59d1-b14a-b6186e142390
🤖 AI code reviewReplaces the tapViewCenter + awaitSyncEnabled pair in NativeWindowInsetsTest.syncToggleReceivesRealTap with a new tapUntilPrefChanges helper that waits for the view to be enabled and bounds-stable, polls for the preference flip, and retries the tap up to maxAttempts times. Removes the old awaitSyncEnabled helper and updates the test to call the new helper for both toggle directions. Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Files changed (1) — the diff as I read it
Previous review passes
Reviewed Maintainer commands
|
|
@greptileai review |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
Problem
NativeWindowInsetsTest.syncToggleReceivesRealTapcontinues to fail intermittentlyin
Test E2E (29)even after the UiAutomator-node fix (#266) addedawaitSyncEnabled:ANR in com.android.systemui— tap eaten by dialogThe ANR class is a known emulator flake. The no-ANR class has a different
mechanism: the tap lands while
SyncSettingsActivityis still applying asyncpreference state, so the switch is laid out but not yet interactive — the click
is silently ignored and the 5 s poll expires unchanged.
Fix
Add
tapUntilPrefChangesto replace thetapViewCenter+awaitSyncEnabledpair:
isEnabled == trueand stable bounds across two consecutive 50 ms samples before injecting the tap.
toggle still fails — retries tolerate input timing, not a bad toggle.
Production code is unchanged. The now-unused
awaitSyncEnabledhelper is removed.Related