Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 843f8c32 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update OpenImeWindowFromFixedOrientationAppTest" into tm-qpr-dev

parents df428426 703f9b89
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -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
                            )
+1 −0
Original line number Diff line number Diff line
@@ -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>