From 8ba7b08eb7198f4a67b4512d1348deac90c3bc9b Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Mon, 24 Jan 2022 19:31:35 +0800 Subject: [PATCH] Fix LaunchAppShowImeAndDialogThemeAppTest flakiness Using tapping DialogThemedActivity may possible to get unexpected focus change to hide the keyboard, also DialogThemedActivity self doesn't set android:windowSoftInputState=stateUnchanged, that affects the test verfication that we expeting IME layer should persist visible. Fix it by adding stateUnchanged softInputState flag, and simply using UiDevice#pressBack to dismiss dialog without touching unrelated focus change. Fix: 215884488 Test: atest LaunchAppShowImeAndDialogThemeAppTest \ --rerun-until-failure 20 Change-Id: I4704dfa531836423dafc3f3ece1d3b80584ae7fa --- .../server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt | 5 ++--- .../FlickerTests/test-apps/flickerapp/res/values/styles.xml | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt index 6d67ee7366046..535612a2bd8bb 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt @@ -67,10 +67,9 @@ class ImeAppAutoFocusHelper @JvmOverloads constructor( val dialog = uiDevice.wait( Until.findObject(By.text("Dialog for test")), FIND_TIMEOUT) - // Tapping outside of the dialog to dismiss + // Pressing back key to dismiss the dialog if (dialog != null) { - val dialogBounds = dialog.visibleBounds - uiDevice.click(dialogBounds.left, dialogBounds.top - 300) + uiDevice.pressBack() wmHelper.waitForAppTransitionIdle() } } diff --git a/tests/FlickerTests/test-apps/flickerapp/res/values/styles.xml b/tests/FlickerTests/test-apps/flickerapp/res/values/styles.xml index 9a49136681920..746b0f4ca7e11 100644 --- a/tests/FlickerTests/test-apps/flickerapp/res/values/styles.xml +++ b/tests/FlickerTests/test-apps/flickerapp/res/values/styles.xml @@ -36,5 +36,6 @@ true true false + stateUnchanged