diff options
41 files changed, 200 insertions, 215 deletions
diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt index 10aea519f18b..35bab7aaf22c 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt @@ -18,8 +18,6 @@ package com.android.wm.shell.flicker import android.graphics.Region import android.view.Surface -import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER -import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.traces.layers.getVisibleBounds @@ -32,15 +30,15 @@ fun FlickerTestParameter.appPairsDividerIsVisible() { fun FlickerTestParameter.appPairsDividerIsInvisible() { assertLayersEnd { - this.notExists(APP_PAIR_SPLIT_DIVIDER) + this.notContains(APP_PAIR_SPLIT_DIVIDER) } } fun FlickerTestParameter.appPairsDividerBecomesVisible() { assertLayers { - this.hidesLayer(DOCKED_STACK_DIVIDER) + this.isInvisible(DOCKED_STACK_DIVIDER) .then() - .showsLayer(DOCKED_STACK_DIVIDER) + .isVisible(DOCKED_STACK_DIVIDER) } } @@ -52,30 +50,30 @@ fun FlickerTestParameter.dockedStackDividerIsVisible() { fun FlickerTestParameter.dockedStackDividerBecomesVisible() { assertLayers { - this.hidesLayer(DOCKED_STACK_DIVIDER) + this.isInvisible(DOCKED_STACK_DIVIDER) .then() - .showsLayer(DOCKED_STACK_DIVIDER) + .isVisible(DOCKED_STACK_DIVIDER) } } fun FlickerTestParameter.dockedStackDividerBecomesInvisible() { assertLayers { - this.showsLayer(DOCKED_STACK_DIVIDER) + this.isVisible(DOCKED_STACK_DIVIDER) .then() - .hidesLayer(DOCKED_STACK_DIVIDER) + .isInvisible(DOCKED_STACK_DIVIDER) } } fun FlickerTestParameter.dockedStackDividerIsInvisible() { assertLayersEnd { - this.notExists(DOCKED_STACK_DIVIDER) + this.notContains(DOCKED_STACK_DIVIDER) } } fun FlickerTestParameter.appPairsPrimaryBoundsIsVisible(rotation: Int, primaryLayerName: String) { assertLayersEnd { val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER) - this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation)) + this.coversExactly(getPrimaryRegion(dividerRegion, rotation), primaryLayerName) } } @@ -85,7 +83,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisible( ) { assertLayersEnd { val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER) - this.hasVisibleRegion(primaryLayerName, getPrimaryRegion(dividerRegion, rotation)) + this.coversExactly(getPrimaryRegion(dividerRegion, rotation), primaryLayerName) } } @@ -95,7 +93,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisible( ) { assertLayersEnd { val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER) - this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation)) + this.coversExactly(getSecondaryRegion(dividerRegion, rotation), secondaryLayerName) } } @@ -105,7 +103,7 @@ fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisible( ) { assertLayersEnd { val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER) - this.hasVisibleRegion(secondaryLayerName, getSecondaryRegion(dividerRegion, rotation)) + this.coversExactly(getSecondaryRegion(dividerRegion, rotation), secondaryLayerName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonConstants.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonConstants.kt index d2cfb0fbb5f6..03b93c74233c 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonConstants.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonConstants.kt @@ -18,3 +18,5 @@ package com.android.wm.shell.flicker const val IME_WINDOW_NAME = "InputMethod" const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui" +const val APP_PAIR_SPLIT_DIVIDER = "AppPairSplitDivider" +const val DOCKED_STACK_DIVIDER = "DockedStackDivider"
\ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestCannotPairNonResizeableApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestCannotPairNonResizeableApps.kt index 5d51b2fd515f..90e71373b1fd 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestCannotPairNonResizeableApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestCannotPairNonResizeableApps.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.apppairs -import android.os.Bundle import android.os.SystemClock import android.platform.test.annotations.Presubmit import androidx.test.filters.RequiresDevice @@ -48,7 +47,7 @@ class AppPairsTestCannotPairNonResizeableApps( testSpec: FlickerTestParameter ) : AppPairsTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestPairPrimaryAndSecondaryApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestPairPrimaryAndSecondaryApps.kt index 77890ba8ed15..dc51b4fb5a9e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestPairPrimaryAndSecondaryApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestPairPrimaryAndSecondaryApps.kt @@ -16,17 +16,16 @@ package com.android.wm.shell.flicker.apppairs -import android.os.Bundle import android.os.SystemClock import android.platform.test.annotations.Presubmit import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER 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.dsl.FlickerBuilder import com.android.server.wm.flicker.traces.layers.getVisibleBounds +import com.android.wm.shell.flicker.APP_PAIR_SPLIT_DIVIDER import com.android.wm.shell.flicker.appPairsDividerIsVisible import com.android.wm.shell.flicker.helpers.AppPairsHelper import org.junit.FixMethodOrder @@ -46,7 +45,7 @@ import org.junit.runners.Parameterized class AppPairsTestPairPrimaryAndSecondaryApps( testSpec: FlickerTestParameter ) : AppPairsTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) transitions { @@ -75,10 +74,10 @@ class AppPairsTestPairPrimaryAndSecondaryApps( fun appsEndingBounds() { testSpec.assertLayersEnd { val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER) - this.hasVisibleRegion(primaryApp.defaultWindowName, - appPairsHelper.getPrimaryBounds(dividerRegion)) - .hasVisibleRegion(secondaryApp.defaultWindowName, - appPairsHelper.getSecondaryBounds(dividerRegion)) + this.coversExactly(appPairsHelper.getPrimaryBounds(dividerRegion), + primaryApp.defaultWindowName) + .coversExactly(appPairsHelper.getSecondaryBounds(dividerRegion), + secondaryApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestUnpairPrimaryAndSecondaryApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestUnpairPrimaryAndSecondaryApps.kt index 3d3ca0cfd450..5bb9b2f8b8ca 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestUnpairPrimaryAndSecondaryApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestUnpairPrimaryAndSecondaryApps.kt @@ -16,17 +16,16 @@ package com.android.wm.shell.flicker.apppairs -import android.os.Bundle import android.os.SystemClock import android.platform.test.annotations.Presubmit import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER 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.dsl.FlickerBuilder import com.android.server.wm.flicker.traces.layers.getVisibleBounds +import com.android.wm.shell.flicker.APP_PAIR_SPLIT_DIVIDER import com.android.wm.shell.flicker.appPairsDividerIsInvisible import com.android.wm.shell.flicker.helpers.AppPairsHelper import org.junit.FixMethodOrder @@ -46,7 +45,7 @@ import org.junit.runners.Parameterized class AppPairsTestUnpairPrimaryAndSecondaryApps( testSpec: FlickerTestParameter ) : AppPairsTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) setup { @@ -80,10 +79,10 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps( fun appsStartingBounds() { testSpec.assertLayersStart { val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER) - hasVisibleRegion(primaryApp.defaultWindowName, - appPairsHelper.getPrimaryBounds(dividerRegion)) - hasVisibleRegion(secondaryApp.defaultWindowName, - appPairsHelper.getSecondaryBounds(dividerRegion)) + coversExactly(appPairsHelper.getPrimaryBounds(dividerRegion), + primaryApp.defaultWindowName) + coversExactly(appPairsHelper.getSecondaryBounds(dividerRegion), + secondaryApp.defaultWindowName) } } @@ -91,8 +90,8 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps( @Test fun appsEndingBounds() { testSpec.assertLayersEnd { - notExists(primaryApp.defaultWindowName) - notExists(secondaryApp.defaultWindowName) + notContains(primaryApp.defaultWindowName) + notContains(secondaryApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTransition.kt index 9e6752db224f..91e080f65550 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTransition.kt @@ -17,7 +17,6 @@ package com.android.wm.shell.flicker.apppairs import android.app.Instrumentation -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.system.helpers.ActivityHelper import android.util.Log @@ -66,7 +65,7 @@ abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter) } } - internal open val transition: FlickerBuilder.(Bundle) -> Unit + internal open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setup { test { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsInAppPairsMode.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsInAppPairsMode.kt index 35a0020b16a9..eb53783f32f7 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsInAppPairsMode.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsInAppPairsMode.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.apppairs -import android.os.Bundle import android.os.SystemClock import android.platform.test.annotations.Presubmit import android.view.Surface @@ -52,7 +51,7 @@ import org.junit.runners.Parameterized class RotateTwoLaunchedAppsInAppPairsMode( testSpec: FlickerTestParameter ) : RotateTwoLaunchedAppsTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsRotateAndEnterAppPairsMode.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsRotateAndEnterAppPairsMode.kt index 326a775acc8d..39c94842fe6e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsRotateAndEnterAppPairsMode.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsRotateAndEnterAppPairsMode.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.apppairs -import android.os.Bundle import android.os.SystemClock import android.platform.test.annotations.Presubmit import android.view.Surface @@ -55,7 +54,7 @@ import org.junit.runners.Parameterized class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode( testSpec: FlickerTestParameter ) : RotateTwoLaunchedAppsTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { super.transition(this, it) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsTransition.kt index 271b25fc0ce1..83853e61ab5e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/RotateTwoLaunchedAppsTransition.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.apppairs -import android.os.Bundle import android.view.Surface import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.dsl.FlickerBuilder @@ -30,7 +29,7 @@ abstract class RotateTwoLaunchedAppsTransition( override val nonResizeableApp: SplitScreenHelper? get() = null - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { setup { test { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenDockActivity.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenDockActivity.kt index 9b70fac737e6..17c51fb15b0c 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenDockActivity.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenDockActivity.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -50,11 +49,10 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -// @FlakyTest(bugId = 179116910) class EnterSplitScreenDockActivity( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenLaunchToSide.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenLaunchToSide.kt index bd57a59ea3d9..a94fd463c624 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenLaunchToSide.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenLaunchToSide.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -54,7 +53,7 @@ import org.junit.runners.Parameterized class EnterSplitScreenLaunchToSide( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNonResizableNotDock.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNonResizableNotDock.kt index 67578b29a36c..238059b484b5 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNonResizableNotDock.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNonResizableNotDock.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice @@ -50,7 +49,7 @@ import org.junit.runners.Parameterized class EnterSplitScreenNonResizableNotDock( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) teardown { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitLegacySplitScreenFromBottom.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitLegacySplitScreenFromBottom.kt index 5d42a4a8fae0..acd570a3773e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitLegacySplitScreenFromBottom.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitLegacySplitScreenFromBottom.kt @@ -16,12 +16,10 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory @@ -34,6 +32,7 @@ import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry +import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder import org.junit.Test @@ -52,7 +51,7 @@ import org.junit.runners.Parameterized class ExitLegacySplitScreenFromBottom( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) setup { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitPrimarySplitScreenShowSecondaryFullscreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitPrimarySplitScreenShowSecondaryFullscreen.kt index ff8f9c6ed865..cef188695ce7 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitPrimarySplitScreenShowSecondaryFullscreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitPrimarySplitScreenShowSecondaryFullscreen.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -53,7 +52,7 @@ import org.junit.runners.Parameterized class ExitPrimarySplitScreenShowSecondaryFullscreen( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) teardown { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenRotateTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenRotateTransition.kt index 893b101d0759..1e89a25c06df 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenRotateTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenRotateTransition.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.view.Surface import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.dsl.FlickerBuilder @@ -27,7 +26,7 @@ import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen abstract class LegacySplitScreenRotateTransition( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { setup { eachRun { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenToLauncher.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenToLauncher.kt index 09a7e31d20e2..7f69a66e6e82 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenToLauncher.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenToLauncher.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.support.test.launcherhelper.LauncherStrategyFactory import android.view.Surface @@ -66,7 +65,7 @@ class LegacySplitScreenToLauncher( .launcherStrategy.supportedLauncherPackage private val testApp = SimpleAppHelper(instrumentation) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setup { test { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenTransition.kt index 6ab1f0bfdb89..91ea8716e4f0 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenTransition.kt @@ -17,7 +17,6 @@ package com.android.wm.shell.flicker.legacysplitscreen import android.app.Instrumentation -import android.os.Bundle import android.support.test.launcherhelper.LauncherStrategyFactory import android.view.Surface import androidx.test.platform.app.InstrumentationRegistry @@ -41,7 +40,7 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa protected val LAUNCHER_PACKAGE_NAME = LauncherStrategyFactory.getInstance(instrumentation) .launcherStrategy.supportedLauncherPackage - protected open val transition: FlickerBuilder.(Bundle) -> Unit + protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setup { eachRun { @@ -70,7 +69,7 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa } } - internal open val cleanSetup: FlickerBuilder.(Bundle) -> Unit + internal open val cleanSetup: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setup { eachRun { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableDismissInLegacySplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableDismissInLegacySplitScreen.kt index 1b4b54a74eab..caafa278d297 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableDismissInLegacySplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableDismissInLegacySplitScreen.kt @@ -16,12 +16,10 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory @@ -34,6 +32,7 @@ import com.android.server.wm.flicker.layerBecomesInvisible import com.android.server.wm.flicker.layerBecomesVisible import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry +import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder import org.junit.Test @@ -53,7 +52,7 @@ import org.junit.runners.Parameterized class NonResizableDismissInLegacySplitScreen( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> cleanSetup(this, configuration) setup { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableLaunchInLegacySplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableLaunchInLegacySplitScreen.kt index 2365e3bfd8c3..543484ac9759 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableLaunchInLegacySplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/NonResizableLaunchInLegacySplitScreen.kt @@ -16,12 +16,10 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory @@ -33,6 +31,7 @@ import com.android.server.wm.flicker.layerBecomesInvisible import com.android.server.wm.flicker.layerBecomesVisible import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry +import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder import org.junit.Test @@ -53,7 +52,7 @@ import org.junit.runners.Parameterized class NonResizableLaunchInLegacySplitScreen( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> cleanSetup(this, configuration) setup { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/OpenAppToLegacySplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/OpenAppToLegacySplitScreen.kt index b369a3d32e64..d22833784bcf 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/OpenAppToLegacySplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/OpenAppToLegacySplitScreen.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -53,7 +52,7 @@ import org.junit.runners.Parameterized class OpenAppToLegacySplitScreen( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt index ffffa1902976..f5174bc3cef7 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ResizeLegacySplitScreen.kt @@ -17,13 +17,11 @@ package com.android.wm.shell.flicker.legacysplitscreen import android.graphics.Region -import android.os.Bundle import android.util.Rational import android.view.Surface import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice import androidx.test.uiautomator.By -import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory @@ -46,6 +44,7 @@ import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEn import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible import com.android.server.wm.flicker.traces.layers.getVisibleBounds +import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER import com.android.wm.shell.flicker.helpers.SimpleAppHelper import org.junit.FixMethodOrder import org.junit.Test @@ -70,7 +69,7 @@ class ResizeLegacySplitScreen( private val testAppTop = SimpleAppHelper(instrumentation) private val testAppBottom = ImeAppHelper(instrumentation) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setup { eachRun { @@ -151,21 +150,21 @@ class ResizeLegacySplitScreen( @Test fun topAppLayerIsAlwaysVisible() { testSpec.assertLayers { - this.showsLayer(sSimpleActivity) + this.isVisible(sSimpleActivity) } } @Test fun bottomAppLayerIsAlwaysVisible() { testSpec.assertLayers { - this.showsLayer(sImeActivity) + this.isVisible(sImeActivity) } } @Test fun dividerLayerIsAlwaysVisible() { testSpec.assertLayers { - this.showsLayer(DOCKED_STACK_DIVIDER) + this.isVisible(DOCKED_STACK_DIVIDER) } } @@ -183,8 +182,8 @@ class ResizeLegacySplitScreen( dividerBounds.bottom - WindowUtils.dockedStackDividerInset, displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) - this.hasVisibleRegion("SimpleActivity", topAppBounds) - .hasVisibleRegion("ImeActivity", bottomAppBounds) + this.coversExactly(topAppBounds, "SimpleActivity") + .coversExactly(bottomAppBounds, "ImeActivity") } } @@ -203,8 +202,8 @@ class ResizeLegacySplitScreen( displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) - this.hasVisibleRegion(sSimpleActivity, topAppBounds) - .hasVisibleRegion(sImeActivity, bottomAppBounds) + this.coversExactly(topAppBounds, sSimpleActivity) + .coversExactly(bottomAppBounds, sImeActivity) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppAndEnterSplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppAndEnterSplitScreen.kt index c538008aa179..c914adae2b7c 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppAndEnterSplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppAndEnterSplitScreen.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -54,7 +53,7 @@ import org.junit.runners.Parameterized class RotateOneLaunchedAppAndEnterSplitScreen( testSpec: FlickerTestParameter ) : LegacySplitScreenRotateTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppInSplitScreenMode.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppInSplitScreenMode.kt index c1162560119c..ffb20a4bc99a 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppInSplitScreenMode.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateOneLaunchedAppInSplitScreenMode.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -54,7 +53,7 @@ import org.junit.runners.Parameterized class RotateOneLaunchedAppInSplitScreenMode( testSpec: FlickerTestParameter ) : LegacySplitScreenRotateTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppAndEnterSplitScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppAndEnterSplitScreen.kt index 273925c0361c..8cf1990d406f 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppAndEnterSplitScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppAndEnterSplitScreen.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -56,7 +55,7 @@ import org.junit.runners.Parameterized class RotateTwoLaunchedAppAndEnterSplitScreen( testSpec: FlickerTestParameter ) : LegacySplitScreenRotateTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) transitions { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppInSplitScreenMode.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppInSplitScreenMode.kt index c7188dc227e7..9c798d8ea661 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppInSplitScreenMode.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/RotateTwoLaunchedAppInSplitScreenMode.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -56,7 +55,7 @@ import org.junit.runners.Parameterized class RotateTwoLaunchedAppInSplitScreenMode( testSpec: FlickerTestParameter ) : LegacySplitScreenRotateTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> super.transition(this, configuration) setup { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterExitPipTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterExitPipTest.kt index ca48eaa45840..75c33c671008 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterExitPipTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterExitPipTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.RequiresDevice @@ -51,7 +50,7 @@ class EnterExitPipTest( private val testApp = FixedAppHelper(instrumentation) private val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = buildTransition(eachRun = true) { setup { eachRun { @@ -68,7 +67,7 @@ class EnterExitPipTest( @Test fun pipAppRemainInsideVisibleBounds() { testSpec.assertWm { - coversAtMostRegion(pipApp.defaultWindowName, displayBounds) + coversAtMost(displayBounds, pipApp.defaultWindowName) } } @@ -95,10 +94,10 @@ class EnterExitPipTest( @Test fun showBothAppLayersThenHidePip() { testSpec.assertLayers { - showsLayer(testApp.defaultWindowName) - .showsLayer(pipApp.defaultWindowName) + isVisible(testApp.defaultWindowName) + .isVisible(pipApp.defaultWindowName) .then() - .hidesLayer(testApp.defaultWindowName) + .isInvisible(testApp.defaultWindowName) } } @@ -106,8 +105,8 @@ class EnterExitPipTest( @Test fun testAppCoversFullScreenWithPipOnDisplay() { testSpec.assertLayersStart { - hasVisibleRegion(testApp.defaultWindowName, displayBounds) - coversAtMostRegion(displayBounds, pipApp.defaultWindowName) + coversExactly(displayBounds, testApp.defaultWindowName) + coversAtMost(displayBounds, pipApp.defaultWindowName) } } @@ -115,7 +114,7 @@ class EnterExitPipTest( @Test fun pipAppCoversFullScreen() { testSpec.assertLayersEnd { - hasVisibleRegion(pipApp.defaultWindowName, displayBounds) + coversExactly(displayBounds, pipApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt index e1fbc16e8ce2..83dca53b1542 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -48,7 +47,7 @@ import org.junit.runners.Parameterized @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = buildTransition(eachRun = true, stringExtras = emptyMap()) { transitions { pipApp.clickEnterPipButton() @@ -85,7 +84,7 @@ class EnterPipTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { @Test fun pipLayerBecomesVisible() { testSpec.assertLayers { - this.showsLayer(pipApp.launcherName) + this.isVisible(pipApp.launcherName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipToOtherOrientationTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipToOtherOrientationTest.kt index 215b97bfeb83..41e2864481fe 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipToOtherOrientationTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipToOtherOrientationTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -56,7 +55,7 @@ class EnterPipToOtherOrientationTest( private val startingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_90) private val endingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_0) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setupAndTeardown(this, configuration) @@ -121,7 +120,7 @@ class EnterPipToOtherOrientationTest( @Test fun pipAppLayerHidesTestApp() { testSpec.assertLayersStart { - hasVisibleRegion(pipApp.defaultWindowName, startingBounds) + coversExactly(startingBounds, pipApp.defaultWindowName) isInvisible(testApp.defaultWindowName) } } @@ -130,7 +129,7 @@ class EnterPipToOtherOrientationTest( @Test fun testAppLayerCoversFullScreen() { testSpec.assertLayersEnd { - hasVisibleRegion(testApp.defaultWindowName, endingBounds) + coversExactly(endingBounds, testApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/Extensions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/Extensions.kt index 707d28d9c4c0..96eb66c3cc28 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/Extensions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/Extensions.kt @@ -48,7 +48,7 @@ fun WindowManagerStateSubject.isInPipMode( activity: ComponentName ): WindowManagerStateSubject = apply { val windowName = activity.toWindowName() - hasWindow(windowName) + contains(windowName) val pinnedWindows = wmState.pinnedWindows .map { it.title } Truth.assertWithMessage("Window not in PIP mode") diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipKeyboardTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipKeyboardTest.kt index f3b9ea1455ca..46339603f806 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipKeyboardTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipKeyboardTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.RequiresDevice @@ -46,7 +45,7 @@ import org.junit.runners.Parameterized class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { private val imeApp = ImeAppHelper(instrumentation) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = buildTransition(eachRun = false) { configuration -> setup { test { @@ -78,7 +77,7 @@ class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) fun pipInVisibleBounds() { testSpec.assertWm { val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation) - coversAtMostRegion(pipApp.defaultWindowName, displayBounds) + coversAtMost(displayBounds, pipApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt index daf381ee9ddb..97afc65b8b61 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Postsubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -58,7 +57,7 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t private val testApp = FixedAppHelper(instrumentation) private val displayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { withTestName { testSpec.name } repeat { testSpec.config.repetitions } @@ -90,7 +89,7 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t @Test fun pipWindowInsideDisplayBounds() { testSpec.assertWm { - coversAtMostRegion(pipApp.defaultWindowName, displayBounds) + coversAtMost(displayBounds, pipApp.defaultWindowName) } } @@ -100,7 +99,7 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t testSpec.assertWmEnd { isVisible(testApp.defaultWindowName) isVisible(imeApp.defaultWindowName) - noWindowsOverlap(setOf(testApp.defaultWindowName, imeApp.defaultWindowName)) + noWindowsOverlap(testApp.defaultWindowName, imeApp.defaultWindowName) } } @@ -116,7 +115,7 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t @Test fun pipLayerInsideDisplayBounds() { testSpec.assertLayers { - coversAtMostRegion(displayBounds, pipApp.defaultWindowName) + coversAtMost(displayBounds, pipApp.defaultWindowName) } } @@ -124,8 +123,8 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t @Test fun bothAppLayersVisible() { testSpec.assertLayersEnd { - coversAtMostRegion(displayBounds, testApp.defaultWindowName) - coversAtMostRegion(displayBounds, imeApp.defaultWindowName) + coversAtMost(displayBounds, testApp.defaultWindowName) + coversAtMost(displayBounds, imeApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt index 43c12acef9e8..37b49c70708d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -56,7 +55,7 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) private val startingBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation) private val endingBounds = WindowUtils.getDisplayBounds(testSpec.config.endRotation) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = buildTransition(eachRun = false) { configuration -> setup { test { @@ -113,8 +112,8 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) @Test fun appLayerRotates_StartingBounds() { testSpec.assertLayersStart { - hasVisibleRegion(fixedApp.defaultWindowName, startingBounds) - coversAtMostRegion(startingBounds, pipApp.defaultWindowName) + coversExactly(startingBounds, fixedApp.defaultWindowName) + coversAtMost(startingBounds, pipApp.defaultWindowName) } } @@ -122,8 +121,8 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) @Test fun appLayerRotates_EndingBounds() { testSpec.assertLayersEnd { - hasVisibleRegion(fixedApp.defaultWindowName, endingBounds) - coversAtMostRegion(endingBounds, pipApp.defaultWindowName) + coversExactly(endingBounds, fixedApp.defaultWindowName) + coversAtMost(endingBounds, pipApp.defaultWindowName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToAppTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToAppTest.kt index 02389a9ccf87..704fd1d61c33 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToAppTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToAppTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -50,7 +49,7 @@ import org.junit.runners.Parameterized @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class PipToAppTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = buildTransition(eachRun = true) { configuration -> setup { eachRun { @@ -102,9 +101,9 @@ class PipToAppTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { @Test fun appReplacesPipLayer() { testSpec.assertLayers { - this.showsLayer(PIP_WINDOW_TITLE) + this.isVisible(PIP_WINDOW_TITLE) .then() - .showsLayer(pipApp.launcherName) + .isVisible(pipApp.launcherName) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToHomeTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToHomeTest.kt index 968a11de2511..06ef79a2b243 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToHomeTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipToHomeTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.Surface @@ -29,6 +28,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.focusChanges import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible import com.android.server.wm.flicker.noUncoveredRegions import com.android.server.wm.flicker.startRotation @@ -50,7 +50,7 @@ import org.junit.runners.Parameterized @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class PipToHomeTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = buildTransition(eachRun = true) { configuration -> setup { eachRun { @@ -97,9 +97,9 @@ class PipToHomeTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { @Test fun pipLayerBecomesInvisible() { testSpec.assertLayers { - this.showsLayer(PIP_WINDOW_TITLE) + this.isVisible(PIP_WINDOW_TITLE) .then() - .hidesLayer(PIP_WINDOW_TITLE) + .isInvisible(PIP_WINDOW_TITLE) } } @@ -116,7 +116,7 @@ class PipToHomeTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { @Postsubmit @Test fun navBarLayerRotatesAndScales() = - testSpec.noUncoveredRegions(testSpec.config.startRotation, Surface.ROTATION_0) + testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) @FlakyTest(bugId = 151179149) @Test diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipTransition.kt index a94483ec00a0..b0a9afef9215 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipTransition.kt @@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.pip import android.app.Instrumentation import android.content.Intent -import android.os.Bundle import android.view.Surface import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.FlickerBuilderProvider @@ -38,7 +37,7 @@ abstract class PipTransition(protected val testSpec: FlickerTestParameter) { protected val isRotated = testSpec.config.startRotation.isRotated() protected val pipApp = PipAppHelper(instrumentation) protected val broadcastActionTrigger = BroadcastActionTrigger(instrumentation) - protected abstract val transition: FlickerBuilder.(Bundle) -> Unit + protected abstract val transition: FlickerBuilder.(Map<String, Any?>) -> Unit // Helper class to process test actions by broadcast. protected class BroadcastActionTrigger(private val instrumentation: Instrumentation) { @@ -81,7 +80,7 @@ abstract class PipTransition(protected val testSpec: FlickerTestParameter) { /** * Gets a configuration that handles basic setup and teardown of pip tests */ - protected val setupAndTeardown: FlickerBuilder.(Bundle) -> Unit + protected val setupAndTeardown: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { setup { test { @@ -112,8 +111,8 @@ abstract class PipTransition(protected val testSpec: FlickerTestParameter) { protected open fun buildTransition( eachRun: Boolean, stringExtras: Map<String, String> = mapOf(Components.PipActivity.EXTRA_ENTER_PIP to "true"), - extraSpec: FlickerBuilder.(Bundle) -> Unit = {} - ): FlickerBuilder.(Bundle) -> Unit { + extraSpec: FlickerBuilder.(Map<String, Any?>) -> Unit = {} + ): FlickerBuilder.(Map<String, Any?>) -> Unit { return { configuration -> setupAndTeardown(this, configuration) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTest.kt index 1f0370dc0505..1fcc7d066aa0 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTest.kt @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.pip -import android.os.Bundle import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -54,7 +53,7 @@ class SetRequestedOrientationWhilePinnedTest( private val startingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_0) private val endingBounds = WindowUtils.getDisplayBounds(Surface.ROTATION_90) - override val transition: FlickerBuilder.(Bundle) -> Unit + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit get() = { configuration -> setupAndTeardown(this, configuration) @@ -88,7 +87,7 @@ class SetRequestedOrientationWhilePinnedTest( @Test fun pipWindowInsideDisplay() { testSpec.assertWmStart { - coversAtMostRegion(pipApp.defaultWindowName, startingBounds) + coversAtMost(startingBounds, pipApp.defaultWindowName) } } @@ -112,7 +111,7 @@ class SetRequestedOrientationWhilePinnedTest( @Test fun pipLayerInsideDisplay() { testSpec.assertLayersStart { - coversAtMostRegion(startingBounds, pipApp.defaultWindowName) + coversAtMost(startingBounds, pipApp.defaultWindowName) } } @@ -120,7 +119,7 @@ class SetRequestedOrientationWhilePinnedTest( @Test fun pipAppLayerCoversFullScreen() { testSpec.assertLayersEnd { - hasVisibleRegion(pipApp.defaultWindowName, endingBounds) + coversExactly(endingBounds, pipApp.defaultWindowName) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt index 7d29cdd2b5c5..a8b7b057fe24 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -21,8 +21,6 @@ import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.NAV_BAR_LAYER_NAME import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.STATUS_BAR_WINDOW_NAME -const val APP_PAIR_SPLIT_DIVIDER = "AppPairSplitDivider" -const val DOCKED_STACK_DIVIDER = "DockedStackDivider" const val WALLPAPER_TITLE = "Wallpaper" fun FlickerTestParameter.statusBarWindowIsAlwaysVisible() { @@ -64,9 +62,9 @@ fun FlickerTestParameter.wallpaperWindowBecomesVisible() { fun FlickerTestParameter.wallpaperWindowBecomesInvisible() { assertWm { - this.showsBelowAppWindow("Wallpaper") + this.showsBelowAppWindow(WALLPAPER_TITLE) .then() - .hidesBelowAppWindow("Wallpaper") + .hidesBelowAppWindow(WALLPAPER_TITLE) } } @@ -103,19 +101,19 @@ fun FlickerTestParameter.noUncoveredRegions( if (allStates) { assertLayers { if (startingBounds == endingBounds) { - this.coversAtLeastRegion(startingBounds) + this.coversAtLeast(startingBounds) } else { - this.coversAtLeastRegion(startingBounds) + this.coversAtLeast(startingBounds) .then() - .coversAtLeastRegion(endingBounds) + .coversAtLeast(endingBounds) } } } else { assertLayersStart { - this.coversAtLeastRegion(startingBounds) + this.coversAtLeast(startingBounds) } assertLayersEnd { - this.coversAtLeastRegion(endingBounds) + this.coversAtLeast(endingBounds) } } } @@ -124,15 +122,15 @@ fun FlickerTestParameter.noUncoveredRegions( fun FlickerTestParameter.navBarLayerIsAlwaysVisible(rotatesScreen: Boolean = false) { if (rotatesScreen) { assertLayers { - this.showsLayer(NAV_BAR_LAYER_NAME) + this.isVisible(NAV_BAR_LAYER_NAME) .then() - .hidesLayer(NAV_BAR_LAYER_NAME) + .isInvisible(NAV_BAR_LAYER_NAME) .then() - .showsLayer(NAV_BAR_LAYER_NAME) + .isVisible(NAV_BAR_LAYER_NAME) } } else { assertLayers { - this.showsLayer(NAV_BAR_LAYER_NAME) + this.isVisible(NAV_BAR_LAYER_NAME) } } } @@ -141,15 +139,15 @@ fun FlickerTestParameter.navBarLayerIsAlwaysVisible(rotatesScreen: Boolean = fal fun FlickerTestParameter.statusBarLayerIsAlwaysVisible(rotatesScreen: Boolean = false) { if (rotatesScreen) { assertLayers { - this.showsLayer(STATUS_BAR_WINDOW_NAME) + this.isVisible(STATUS_BAR_WINDOW_NAME) .then() - hidesLayer(STATUS_BAR_WINDOW_NAME) + .isInvisible(STATUS_BAR_WINDOW_NAME) .then() - .showsLayer(STATUS_BAR_WINDOW_NAME) + .isVisible(STATUS_BAR_WINDOW_NAME) } } else { assertLayers { - this.showsLayer(STATUS_BAR_WINDOW_NAME) + this.isVisible(STATUS_BAR_WINDOW_NAME) } } } @@ -163,10 +161,10 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales( val endingPos = WindowUtils.getNavigationBarPosition(endRotation) assertLayersStart { - this.hasVisibleRegion(NAV_BAR_LAYER_NAME, startingPos) + this.coversExactly(startingPos, NAV_BAR_LAYER_NAME) } assertLayersEnd { - this.hasVisibleRegion(NAV_BAR_LAYER_NAME, endingPos) + this.coversExactly(endingPos, NAV_BAR_LAYER_NAME) } } @@ -179,10 +177,10 @@ fun FlickerTestParameter.statusBarLayerRotatesScales( val endingPos = WindowUtils.getStatusBarPosition(endRotation) assertLayersStart { - this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, startingPos) + this.coversExactly(startingPos, STATUS_BAR_WINDOW_NAME) } assertLayersEnd { - this.hasVisibleRegion(STATUS_BAR_WINDOW_NAME, endingPos) + this.coversExactly(endingPos, STATUS_BAR_WINDOW_NAME) } } @@ -197,39 +195,41 @@ fun FlickerTestParameter.visibleLayersShownMoreThanOneConsecutiveEntry( fun FlickerTestParameter.appLayerReplacesWallpaperLayer(appName: String) { assertLayers { - this.showsLayer("Wallpaper") + this.isVisible(WALLPAPER_TITLE) .then() - .replaceVisibleLayer("Wallpaper", appName) + .isInvisible(WALLPAPER_TITLE) + .isVisible(appName) } } fun FlickerTestParameter.wallpaperLayerReplacesAppLayer(testApp: IAppHelper) { assertLayers { - this.showsLayer(testApp.getPackage()) + this.isVisible(testApp.getPackage()) .then() - .replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE) + .isInvisible(testApp.getPackage()) + .isVisible(WALLPAPER_TITLE) } } fun FlickerTestParameter.layerAlwaysVisible(packageName: String) { assertLayers { - this.showsLayer(packageName) + this.isVisible(packageName) } } fun FlickerTestParameter.layerBecomesVisible(packageName: String) { assertLayers { - this.hidesLayer(packageName) + this.isInvisible(packageName) .then() - .showsLayer(packageName) + .isVisible(packageName) } } fun FlickerTestParameter.layerBecomesInvisible(packageName: String) { assertLayers { - this.showsLayer(packageName) + this.isVisible(packageName) .then() - .hidesLayer(packageName) + .isInvisible(packageName) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt index 212644c04505..3dfa31d64f8c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt @@ -23,23 +23,23 @@ const val IME_WINDOW_TITLE = "InputMethod" fun FlickerTestParameter.imeLayerBecomesVisible() { assertLayers { - this.hidesLayer(IME_WINDOW_TITLE) + this.isInvisible(IME_WINDOW_TITLE) .then() - .showsLayer(IME_WINDOW_TITLE) + .isVisible(IME_WINDOW_TITLE) } } fun FlickerTestParameter.imeLayerBecomesInvisible() { assertLayers { - this.showsLayer(IME_WINDOW_TITLE) + this.isVisible(IME_WINDOW_TITLE) .then() - .hidesLayer(IME_WINDOW_TITLE) + .isInvisible(IME_WINDOW_TITLE) } } fun FlickerTestParameter.imeAppLayerIsAlwaysVisible(testApp: IAppHelper) { assertLayers { - this.showsLayer(testApp.getPackage()) + this.isVisible(testApp.getPackage()) } } @@ -83,9 +83,8 @@ fun FlickerTestParameter.imeAppWindowBecomesInvisible(testApp: IAppHelper) { fun FlickerTestParameter.imeAppLayerBecomesInvisible(testApp: IAppHelper) { assertLayers { - this.skipUntilFirstAssertion() - .showsLayer(testApp.getPackage()) + this.isVisible(testApp.getPackage()) .then() - .hidesLayer(testApp.getPackage()) + .isInvisible(testApp.getPackage()) } }
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt index 3cc509fe2b8e..20e4b88ff13b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt @@ -16,13 +16,13 @@ package com.android.server.wm.flicker.rotation -import android.os.Bundle import android.platform.test.annotations.Presubmit import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice 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.dsl.FlickerBuilder import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.focusDoesNotChange import com.android.server.wm.flicker.helpers.SimpleAppHelper @@ -54,7 +54,15 @@ class ChangeAppRotationTest( testSpec: FlickerTestParameter ) : RotationTransition(testSpec) { override val testApp = SimpleAppHelper(instrumentation) - override fun getAppLaunchParams(configuration: Bundle): Map<String, String> = emptyMap() + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit + get() = { + super.transition(this, it) + setup { + test { + testApp.launchViaIntent(wmHelper) + } + } + } @Presubmit @Test @@ -78,11 +86,11 @@ class ChangeAppRotationTest( @Test fun screenshotLayerBecomesInvisible() { testSpec.assertLayers { - this.showsLayer(testApp.getPackage()) + this.isVisible(testApp.getPackage()) .then() - .showsLayer(SCREENSHOT_LAYER) + .isVisible(SCREENSHOT_LAYER) .then() - .showsLayer(testApp.getPackage()) + .isVisible(testApp.getPackage()) } } @@ -113,7 +121,7 @@ class ChangeAppRotationTest( @Test fun appLayerRotates_StartingPos() { testSpec.assertLayersStart { - this.hasVisibleRegion(testApp.getPackage(), startingPos) + this.coversExactly(startingPos, testApp.getPackage()) } } @@ -121,7 +129,7 @@ class ChangeAppRotationTest( @Test fun appLayerRotates_EndingPos() { testSpec.assertLayersEnd { - this.hasVisibleRegion(testApp.getPackage(), endingPos) + this.coversExactly(endingPos, testApp.getPackage()) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt index 04ab84dfcd8e..c391112a53ec 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/RotationTransition.kt @@ -17,7 +17,6 @@ package com.android.server.wm.flicker.rotation import android.app.Instrumentation -import android.os.Bundle import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerTestParameter @@ -31,36 +30,37 @@ import com.android.server.wm.flicker.repetitions import com.android.server.wm.flicker.startRotation abstract class RotationTransition(protected val testSpec: FlickerTestParameter) { + protected abstract val testApp: StandardAppHelper + protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() protected val startingPos get() = WindowUtils.getDisplayBounds(testSpec.config.startRotation) protected val endingPos get() = WindowUtils.getDisplayBounds(testSpec.config.endRotation) - protected abstract val testApp: StandardAppHelper - protected abstract fun getAppLaunchParams(configuration: Bundle): Map<String, String> + protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit = { + withTestName { testSpec.name } + repeat { testSpec.config.repetitions } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + eachRun { + this.setRotation(testSpec.config.startRotation) + } + } + teardown { + test { + testApp.exit() + } + } + transitions { + this.setRotation(testSpec.config.endRotation) + } + } @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { - withTestName { testSpec.name } - repeat { testSpec.config.repetitions } - setup { - test { - device.wakeUpAndGoToHomeScreen() - val extras = getAppLaunchParams(testSpec.config) - testApp.launchViaIntent(wmHelper, stringExtras = extras) - } - eachRun { - this.setRotation(testSpec.config.startRotation) - } - } - teardown { - test { - testApp.exit() - } - } - transitions { - this.setRotation(testSpec.config.endRotation) - } + transition(testSpec.config) } } }
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt index ef1aeadb31bc..fc5bcc7eef1b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt @@ -16,7 +16,6 @@ package com.android.server.wm.flicker.rotation -import android.os.Bundle import android.platform.test.annotations.Presubmit import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice @@ -24,6 +23,7 @@ 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.appWindowAlwaysVisibleOnTop +import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.focusDoesNotChange import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper @@ -58,9 +58,18 @@ class SeamlessAppRotationTest( ) : RotationTransition(testSpec) { override val testApp = SeamlessRotationAppHelper(instrumentation) - override fun getAppLaunchParams(configuration: Bundle): Map<String, String> = mapOf( - ActivityOptions.EXTRA_STARVE_UI_THREAD to configuration.starveUiThread.toString() - ) + override val transition: FlickerBuilder.(Map<String, Any?>) -> Unit + get() = { + super.transition(this, it) + setup { + test { + testApp.launchViaIntent(wmHelper, + stringExtras = mapOf( + ActivityOptions.EXTRA_STARVE_UI_THREAD to it.starveUiThread.toString()) + ) + } + } + } @Presubmit @Test @@ -115,7 +124,7 @@ class SeamlessAppRotationTest( @Test fun appLayerRotates() { testSpec.assertLayers { - this.hasVisibleRegion(testApp.`package`, startingPos) + this.coversExactly(startingPos, testApp.`package`) } } @@ -126,12 +135,14 @@ class SeamlessAppRotationTest( companion object { private val testFactory = FlickerTestParameterFactory.getInstance() - private val Bundle.starveUiThread - get() = this.getBoolean(ActivityOptions.EXTRA_STARVE_UI_THREAD, false) + private val Map<String, Any?>.starveUiThread + get() = this.getOrDefault(ActivityOptions.EXTRA_STARVE_UI_THREAD, false) as Boolean - private fun FlickerTestParameter.createConfig(starveUiThread: Boolean): Bundle { - val config = this.config.deepCopy() - config.putBoolean(ActivityOptions.EXTRA_STARVE_UI_THREAD, starveUiThread) + private fun FlickerTestParameter.createConfig( + starveUiThread: Boolean + ): MutableMap<String, Any?> { + val config = this.config.toMutableMap() + config[ActivityOptions.EXTRA_STARVE_UI_THREAD] = starveUiThread return config } |