From 3249255e42abaf8402b3814c5ce570f2de1dcd6d Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Mon, 24 Jul 2023 21:57:32 +0000 Subject: [PATCH] Check for stopped state after launching AlwaysExpandActivity over the main activity in addition to paused It seems like the main activity goes through to the paused state when the activity is opened over it but then quickly to stopping and stopped, but if that is faster than our wait condition checking interval we just always wait for paused which has already passed now that we are in stopped. Test: atest com.android.server.wm.flicker.activityembedding.open.MainActivityStartsSecondaryWithAlwaysExpandTest Bug: 291916460 Change-Id: Id64fd02a728a3a94504ab0d7f7884efad0236b5f --- .../wm/flicker/helpers/ActivityEmbeddingAppHelper.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt index 35353c62d7e6b..f20e8e9b66d21 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt @@ -171,12 +171,15 @@ constructor( wmHelper .StateSyncBuilder() .withActivityState(ALWAYS_EXPAND_ACTIVITY_COMPONENT, PlatformConsts.STATE_RESUMED) - .withActivityState(MAIN_ACTIVITY_COMPONENT, PlatformConsts.STATE_PAUSED) + .withActivityState(MAIN_ACTIVITY_COMPONENT, PlatformConsts.STATE_PAUSED, + PlatformConsts.STATE_STOPPED) .waitForAndVerify() } private fun launchSecondaryActivityFromButton( - wmHelper: WindowManagerStateHelper, buttonName: String) { + wmHelper: WindowManagerStateHelper, + buttonName: String + ) { val launchButton = uiDevice.wait(Until.findObject(By.res(getPackage(), buttonName)), FIND_TIMEOUT) require(launchButton != null) {