Update OpenImeWindowFromFixedOrientationAppTest

To detect IME gone bugs 230733128 in ShellTransition with following
refined test steps:
  - Launch the activity with expecting IME will be shown.
  - Swiping out the IME activity to home.
  - Bring the exist IME activity to the front in landscape mode
    device rotation.

Fix: 232242249
Test: atest FlickerTest:OpenImeWindowFromFixedOrientationAppTest
Change-Id: I0148545ed19f52c58e0f45d578e6fe5634d1cc06
This commit is contained in:
Ming-Shin Lu
2022-05-23 17:05:14 +00:00
parent 39cf0dcd14
commit 703f9b8948
2 changed files with 18 additions and 9 deletions

View File

@@ -23,16 +23,16 @@ import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.FlakyTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group2
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.FixedOrientationAppHelper
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.flicker.navBarWindowIsVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsVisible
@@ -43,7 +43,8 @@ import org.junit.runners.MethodSorters
import org.junit.runners.Parameterized
/**
* Test IME window layer will become visible when switching from the fixed orientation activity.
* Test IME window layer will become visible when switching from the fixed orientation activity
* (e.g. Launcher activity).
* To run this test: `atest FlickerTests:OpenImeWindowFromFixedOrientationAppTest`
*/
@RequiresDevice
@@ -53,24 +54,31 @@ import org.junit.runners.Parameterized
@Group2
class OpenImeWindowFromFixedOrientationAppTest(private val testSpec: FlickerTestParameter) {
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
private val fixedOrientationApp = FixedOrientationAppHelper(instrumentation)
private val imeTestApp = ImeAppAutoFocusHelper(instrumentation, testSpec.startRotation)
private val taplInstrumentation = LauncherInstrumentation()
@FlickerBuilderProvider
fun buildFlicker(): FlickerBuilder {
return FlickerBuilder(instrumentation).apply {
setup {
test {
// Launch the activity with expecting IME will be shown.
imeTestApp.launchViaIntent(wmHelper)
}
eachRun {
fixedOrientationApp.launchViaIntent(wmHelper)
this.setRotation(Surface.ROTATION_90)
// Swiping out the IME activity to home.
taplInstrumentation.goHome()
wmHelper.waitForHomeActivityVisible()
}
}
transitions {
// Bring the exist IME activity to the front in landscape mode device rotation.
setRotation(Surface.ROTATION_90)
imeTestApp.launchViaIntent(wmHelper)
}
teardown {
test {
fixedOrientationApp.exit(wmHelper)
imeTestApp.exit(wmHelper)
}
}
}
@@ -90,7 +98,7 @@ class OpenImeWindowFromFixedOrientationAppTest(private val testSpec: FlickerTest
@Presubmit
@Test
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd()
@FlakyTest(bugId = 206753786)
fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@@ -112,7 +120,7 @@ class OpenImeWindowFromFixedOrientationAppTest(private val testSpec: FlickerTest
return FlickerTestParameterFactory.getInstance()
.getConfigNonRotationTests(
repetitions = 3,
supportedRotations = listOf(Surface.ROTATION_0),
supportedRotations = listOf(Surface.ROTATION_90),
supportedNavigationModes = listOf(
WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
)

View File

@@ -45,6 +45,7 @@
android:theme="@style/CutoutShortEdges"
android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivityAutoFocus"
android:windowSoftInputMode="stateVisible"
android:configChanges="orientation|screenSize"
android:label="ImeAppAutoFocus"
android:exported="true">
<intent-filter>