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
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowFromFixedOrientationAppTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowFromFixedOrientationAppTest.kt
index 78aea1f..933a3a0 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowFromFixedOrientationAppTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowFromFixedOrientationAppTest.kt
@@ -23,16 +23,16 @@
 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.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 @@
 @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 @@
 
     @Presubmit
     @Test
-    fun navBarLayerRotatesAndScales() = testSpec.navBarLayerRotatesAndScales()
+    fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd()
 
     @FlakyTest(bugId = 206753786)
     fun statusBarLayerRotatesScales() = testSpec.statusBarLayerRotatesScales()
@@ -112,7 +120,7 @@
             return FlickerTestParameterFactory.getInstance()
                     .getConfigNonRotationTests(
                             repetitions = 3,
-                            supportedRotations = listOf(Surface.ROTATION_0),
+                            supportedRotations = listOf(Surface.ROTATION_90),
                             supportedNavigationModes = listOf(
                                     WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
                             )
diff --git a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml
index 43aa4b1..3e2130d 100644
--- a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml
+++ b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml
@@ -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>