diff options
| author | 2024-05-22 23:35:36 +0800 | |
|---|---|---|
| committer | 2024-05-23 13:30:08 +0000 | |
| commit | 383fed6dd5a844f28266b9e9f36a2deb8d2bd31f (patch) | |
| tree | b3b60f11609bdfa1bc8df8bb90020a9adf058562 | |
| parent | d24f7b2d8eda762c5a5c4e242bc6fbd76ec75d65 (diff) | |
Add test for seamless rotation when launching app over keyguard
The test verifies that there won't be a rotation animation layer for
the rotation change with a show-when-locked seamless rotation activity.
Bug: 333557024
Test: atest OpenShowWhenLockedSeamlessAppRotationTest
Change-Id: If525192159c8c2964a014ef19923bd1b55001c51
| -rw-r--r-- | tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/OpenShowWhenLockedSeamlessAppRotationTest.kt | 125 | ||||
| -rw-r--r-- | tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml | 1 |
2 files changed, 126 insertions, 0 deletions
diff --git a/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/OpenShowWhenLockedSeamlessAppRotationTest.kt b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/OpenShowWhenLockedSeamlessAppRotationTest.kt new file mode 100644 index 000000000000..bf569bc23df6 --- /dev/null +++ b/tests/FlickerTests/Rotation/src/com/android/server/wm/flicker/rotation/OpenShowWhenLockedSeamlessAppRotationTest.kt @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wm.flicker.rotation + +import android.platform.test.annotations.Presubmit +import android.tools.NavBar +import android.tools.Rotation +import android.tools.flicker.assertions.FlickerTest +import android.tools.flicker.junit.FlickerParametersRunnerFactory +import android.tools.flicker.legacy.FlickerBuilder +import android.tools.flicker.legacy.LegacyFlickerTest +import android.tools.flicker.legacy.LegacyFlickerTestFactory +import android.tools.flicker.rules.ChangeDisplayOrientationRule +import android.tools.traces.component.ComponentNameMatcher +import com.android.server.wm.flicker.BaseTest +import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper +import org.junit.Assume +import org.junit.FixMethodOrder +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test opening an app over lockscreen with rotation change using seamless rotations. + */ +@RunWith(Parameterized::class) +@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenShowWhenLockedSeamlessAppRotationTest(flicker: LegacyFlickerTest) : BaseTest(flicker) { + val testApp = SeamlessRotationAppHelper(instrumentation) + + override val transition: FlickerBuilder.() -> Unit + get() = { + setup { + device.sleep() + wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() + device.wakeUp() + val originalRotation = device.displayRotation + ChangeDisplayOrientationRule.setRotation(Rotation.ROTATION_90) + Assume.assumeTrue("Assume that lockscreen uses fixed orientation", + originalRotation == device.displayRotation) + } + transitions { + // The activity is show-when-locked, so the requested orientation will be changed + // from NOSENSOR(keyguard) to UNSPECIFIED(activity). Then the fixed-user-rotation + // (by setRotation) will take effect to rotate the display. + testApp.launchViaIntent(wmHelper) + } + teardown { testApp.exit(wmHelper) } + } + + @Presubmit + @Test + fun notContainsRotationAnimation() { + flicker.assertLayers { + // Verifies that com.android.wm.shell.transition.ScreenRotationAnimation is not used. + notContains(ComponentNameMatcher("", "Animation leash of screenshot rotation")) + } + } + + // Ignore the assertions which are included in SeamlessAppRotationTest. + @Test + @Ignore("Uninterested") + override fun statusBarLayerPositionAtStartAndEnd() {} + + @Test + @Ignore("Uninterested") + override fun statusBarLayerIsVisibleAtStartAndEnd() {} + + @Test + @Ignore("Uninterested") + override fun statusBarWindowIsAlwaysVisible() {} + + @Test + @Ignore("Uninterested") + override fun navBarLayerPositionAtStartAndEnd() {} + + @Test + @Ignore("Uninterested") + override fun navBarLayerIsVisibleAtStartAndEnd() {} + + @Test + @Ignore("Uninterested") + override fun navBarWindowIsVisibleAtStartAndEnd() {} + + @Test + @Ignore("Uninterested") + override fun navBarWindowIsAlwaysVisible() {} + + @Test + @Ignore("Uninterested") + override fun visibleLayersShownMoreThanOneConsecutiveEntry() {} + + @Test + @Ignore("Uninterested") + override fun visibleWindowsShownMoreThanOneConsecutiveEntry() {} + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<FlickerTest> { + // The rotation will be controlled by the setup of test. + return LegacyFlickerTestFactory.nonRotationTests( + supportedRotations = listOf(Rotation.ROTATION_0), + supportedNavigationModes = listOf(NavBar.MODE_GESTURAL) + ) + } + } +} diff --git a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml index 3e500d9c8bd4..45260bddd355 100644 --- a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +++ b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml @@ -74,6 +74,7 @@ android:taskAffinity="com.android.server.wm.flicker.testapp.SeamlessRotationActivity" android:theme="@style/CutoutShortEdges" android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" + android:showWhenLocked="true" android:label="SeamlessActivity" android:exported="true"> <intent-filter> |