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
This commit is contained in:
Ming-Shin Lu
2022-01-24 19:31:35 +08:00
parent 55b96e8422
commit 8ba7b08eb7
2 changed files with 3 additions and 3 deletions

View File

@@ -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()
}
}

View File

@@ -36,5 +36,6 @@
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowSoftInputMode">stateUnchanged</item>
</style>
</resources>