From d7cf745103075e83c52b0d9f4dfeabb109f72a4a Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Mon, 20 Sep 2021 16:22:43 +0200 Subject: [PATCH] Update window visibility checks on flicker Check window + activity visibility now on the assertions and make the tests compatible with split isVisible/isInvisible assertions Test: atest FlickerTests WMShellFlickerTests Change-Id: Ia73703f385f73610ca2300ddff9d3f4356347374 --- .../android/wm/shell/flicker/CommonAssertions.kt | 1 + .../src/com/android/wm/shell/flicker/WaitUtils.kt | 1 + .../AppPairsTestCannotPairNonResizeableApps.kt | 4 ++-- .../AppPairsTestPairPrimaryAndSecondaryApps.kt | 4 ++-- .../AppPairsTestSupportPairNonResizeableApps.kt | 4 ++-- .../AppPairsTestUnpairPrimaryAndSecondaryApps.kt | 4 ++-- .../RotateTwoLaunchedAppsInAppPairsMode.kt | 4 ++-- ...teTwoLaunchedAppsRotateAndEnterAppPairsMode.kt | 4 ++-- .../EnterSplitScreenDockActivity.kt | 2 +- .../EnterSplitScreenFromDetachedRecentTask.kt | 2 +- .../EnterSplitScreenLaunchToSide.kt | 2 +- .../EnterSplitScreenSupportNonResizable.kt | 2 +- ...SplitScreenFromIntentNotSupportNonResizable.kt | 15 +++++++-------- ...acySplitScreenFromIntentSupportNonResizable.kt | 9 ++++----- ...SplitScreenFromRecentNotSupportNonResizable.kt | 8 ++++---- ...acySplitScreenFromRecentSupportNonResizable.kt | 6 +++--- .../RotateTwoLaunchedAppAndEnterSplitScreen.kt | 2 +- .../wm/shell/flicker/pip/CommonAssertions.kt | 1 + .../flicker/pip/EnterPipToOtherOrientationTest.kt | 4 ++-- .../shell/flicker/pip/ExitPipToAppTransition.kt | 2 +- .../wm/shell/flicker/pip/ExitPipTransition.kt | 4 ++-- .../shell/flicker/pip/PipLegacySplitScreenTest.kt | 6 +++--- .../server/wm/flicker/close/CloseAppTransition.kt | 2 +- .../wm/flicker/helpers/FlickerExtensions.kt | 1 + .../ime/CloseImeAutoOpenWindowToHomeTest.kt | 2 +- .../server/wm/flicker/ime/OpenImeWindowTest.kt | 3 ++- .../server/wm/flicker/ime/ReOpenImeWindowTest.kt | 6 +++--- .../ime/SwitchImeWindowsFromGestureNavTest.kt | 9 +++++---- .../wm/flicker/launch/ActivitiesTransitionTest.kt | 9 +++++++-- .../wm/flicker/launch/OpenAppNonResizeableTest.kt | 7 +++---- .../server/wm/flicker/launch/OpenAppTransition.kt | 4 ++-- .../QuickSwitchBetweenTwoAppsBackTest.kt | 4 ++-- .../QuickSwitchBetweenTwoAppsForwardTest.kt | 4 ++-- .../quickswitch/QuickSwitchFromLauncherTest.kt | 14 +++++++------- 34 files changed, 82 insertions(+), 74 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 e736dce66270c..c07f0eb115102 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 @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:JvmName("CommonAssertions") package com.android.wm.shell.flicker import android.graphics.Region diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/WaitUtils.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/WaitUtils.kt index a6d67355f2711..b63d9fffdb61a 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/WaitUtils.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/WaitUtils.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:JvmName("WaitUtils") package com.android.wm.shell.flicker import android.os.SystemClock 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 19374ed04be53..038be9c190c2c 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 @@ -100,8 +100,8 @@ class AppPairsTestCannotPairNonResizeableApps( "Non resizeable app not initialized" } testSpec.assertWmEnd { - isVisible(nonResizeableApp.component) - isInvisible(primaryApp.component) + isAppWindowVisible(nonResizeableApp.component) + isAppWindowInvisible(primaryApp.component) } } 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 46ee89295a4ee..bbc6b2dbece8d 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 @@ -77,8 +77,8 @@ class AppPairsTestPairPrimaryAndSecondaryApps( @Test fun bothAppWindowsVisible() { testSpec.assertWmEnd { - isVisible(primaryApp.component) - isVisible(secondaryApp.component) + isAppWindowVisible(primaryApp.component) + isAppWindowVisible(secondaryApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestSupportPairNonResizeableApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestSupportPairNonResizeableApps.kt index f7ced71afe8a1..bb784a809b7ee 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestSupportPairNonResizeableApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTestSupportPairNonResizeableApps.kt @@ -100,8 +100,8 @@ class AppPairsTestSupportPairNonResizeableApps( "Non resizeable app not initialized" } testSpec.assertWmEnd { - isVisible(nonResizeableApp.component) - isVisible(primaryApp.component) + isAppWindowVisible(nonResizeableApp.component) + isAppWindowVisible(primaryApp.component) } } 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 3debdd3276e41..a1a4db112dfdd 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 @@ -81,8 +81,8 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps( @Test fun bothAppWindowsInvisible() { testSpec.assertWmEnd { - isInvisible(primaryApp.component) - isInvisible(secondaryApp.component) + isAppWindowInvisible(primaryApp.component) + isAppWindowInvisible(secondaryApp.component) } } 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 3e782e608c86f..56a2531a3fe16 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 @@ -73,8 +73,8 @@ class RotateTwoLaunchedAppsInAppPairsMode( @Test fun bothAppWindowsVisible() { testSpec.assertWmEnd { - isVisible(primaryApp.component) - .isVisible(secondaryApp.component) + isAppWindowVisible(primaryApp.component) + isAppWindowVisible(secondaryApp.component) } } 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 ee28c7aa6bebf..0699a4fd05127 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 @@ -85,8 +85,8 @@ class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode( @Test fun bothAppWindowsVisible() { testSpec.assertWmEnd { - isVisible(primaryApp.component) - isVisible(secondaryApp.component) + isAppWindowVisible(primaryApp.component) + isAppWindowVisible(secondaryApp.component) } } 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 cad38adcddcf8..bd44d082a1aaa 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 @@ -88,7 +88,7 @@ class EnterSplitScreenDockActivity( @Test fun appWindowIsVisible() { testSpec.assertWmEnd { - isVisible(splitScreenApp.component) + isAppWindowVisible(splitScreenApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenFromDetachedRecentTask.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenFromDetachedRecentTask.kt index b60cbcff7f3b5..625d48b8ab5a7 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenFromDetachedRecentTask.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenFromDetachedRecentTask.kt @@ -77,7 +77,7 @@ class EnterSplitScreenFromDetachedRecentTask( @Test fun appWindowIsVisible() { testSpec.assertWmEnd { - isVisible(splitScreenApp.component) + isAppWindowVisible(splitScreenApp.component) } } 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 94ae9da693306..2ed2806af528c 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 @@ -91,7 +91,7 @@ class EnterSplitScreenLaunchToSide( // Because we log WM once per frame, sometimes the activity and the window // become visible in the same entry, sometimes not, thus it is not possible to // assert the visibility of the activity here - this.isAppWindowInvisible(secondaryApp.component, ignoreActivity = true) + this.isAppWindowInvisible(secondaryApp.component) .then() // during re-parenting, the window may disappear and reappear from the // trace, this occurs because we log only 1x per frame diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenSupportNonResizable.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenSupportNonResizable.kt index 2beb8a95c33fa..163b6ffda6e2d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenSupportNonResizable.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenSupportNonResizable.kt @@ -94,7 +94,7 @@ class EnterSplitScreenSupportNonResizable( @Test fun appWindowIsVisible() { testSpec.assertWmEnd { - isVisible(nonResizeableApp.component) + isAppWindowVisible(nonResizeableApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentNotSupportNonResizable.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentNotSupportNonResizable.kt index 6bc717a2d7091..f7d628d48769a 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentNotSupportNonResizable.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentNotSupportNonResizable.kt @@ -119,12 +119,12 @@ class LegacySplitScreenFromIntentNotSupportNonResizable( // when the activity gets PAUSED the window may still be marked as visible // it will be updated in the next log entry. This occurs because we record 1x // per frame, thus ignore activity check here - this.isAppWindowVisible(splitScreenApp.component, ignoreActivity = true) + this.isAppWindowVisible(splitScreenApp.component) .then() // immediately after the window (after onResume and before perform relayout) // the activity is invisible. This may or not be logged, since we record 1x // per frame, thus ignore activity check here - .isAppWindowInvisible(splitScreenApp.component, ignoreActivity = true) + .isAppWindowInvisible(splitScreenApp.component) } } @@ -141,13 +141,12 @@ class LegacySplitScreenFromIntentNotSupportNonResizable( .then() // we log once per frame, upon logging, window may be visible or not depending // on what was processed until that moment. Both behaviors are correct - .isAppWindowInvisible(nonResizeableApp.component, - ignoreActivity = true, isOptional = true) + .isAppWindowInvisible(nonResizeableApp.component, isOptional = true) .then() // immediately after the window (after onResume and before perform relayout) // the activity is invisible. This may or not be logged, since we record 1x // per frame, thus ignore activity check here - .isAppWindowVisible(nonResizeableApp.component, ignoreActivity = true) + .isAppWindowVisible(nonResizeableApp.component) } } @@ -158,7 +157,7 @@ class LegacySplitScreenFromIntentNotSupportNonResizable( @Test fun nonResizableAppWindowBecomesVisibleAtEnd() { testSpec.assertWmEnd { - this.isVisible(nonResizeableApp.component) + isAppWindowVisible(nonResizeableApp.component) } } @@ -170,8 +169,8 @@ class LegacySplitScreenFromIntentNotSupportNonResizable( @Test fun onlyNonResizableAppWindowIsVisibleAtEnd() { testSpec.assertWmEnd { - isInvisible(splitScreenApp.component) - isVisible(nonResizeableApp.component) + isAppWindowInvisible(splitScreenApp.component) + isAppWindowVisible(nonResizeableApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentSupportNonResizable.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentSupportNonResizable.kt index 212acc7236593..a5c6571f68dee 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentSupportNonResizable.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromIntentSupportNonResizable.kt @@ -109,13 +109,12 @@ class LegacySplitScreenFromIntentSupportNonResizable( .then() // we log once per frame, upon logging, window may be visible or not depending // on what was processed until that moment. Both behaviors are correct - .isAppWindowInvisible(nonResizeableApp.component, - ignoreActivity = true, isOptional = true) + .isAppWindowInvisible(nonResizeableApp.component, isOptional = true) .then() // immediately after the window (after onResume and before perform relayout) // the activity is invisible. This may or not be logged, since we record 1x // per frame, thus ignore activity check here - .isAppWindowVisible(nonResizeableApp.component, ignoreActivity = true) + .isAppWindowVisible(nonResizeableApp.component) } } @@ -127,8 +126,8 @@ class LegacySplitScreenFromIntentSupportNonResizable( @Test fun bothAppsWindowsAreVisibleAtEnd() { testSpec.assertWmEnd { - isVisible(splitScreenApp.component) - isVisible(nonResizeableApp.component) + isAppWindowVisible(splitScreenApp.component) + isAppWindowVisible(nonResizeableApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentNotSupportNonResizable.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentNotSupportNonResizable.kt index 69129601861e7..6f486b0ddfead 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentNotSupportNonResizable.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentNotSupportNonResizable.kt @@ -115,12 +115,12 @@ class LegacySplitScreenFromRecentNotSupportNonResizable( // when the activity gets PAUSED the window may still be marked as visible // it will be updated in the next log entry. This occurs because we record 1x // per frame, thus ignore activity check here - this.isAppWindowVisible(splitScreenApp.component, ignoreActivity = true) + this.isAppWindowVisible(splitScreenApp.component) .then() // immediately after the window (after onResume and before perform relayout) // the activity is invisible. This may or not be logged, since we record 1x // per frame, thus ignore activity check here - .isAppWindowInvisible(splitScreenApp.component, ignoreActivity = true) + .isAppWindowInvisible(splitScreenApp.component) } } @@ -142,8 +142,8 @@ class LegacySplitScreenFromRecentNotSupportNonResizable( @Test fun onlyNonResizableAppWindowIsVisibleAtEnd() { testSpec.assertWmEnd { - isInvisible(splitScreenApp.component) - isVisible(nonResizeableApp.component) + isAppWindowInvisible(splitScreenApp.component) + isAppWindowVisible(nonResizeableApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentSupportNonResizable.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentSupportNonResizable.kt index b7a78ce882db0..f03c927b8d58d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentSupportNonResizable.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenFromRecentSupportNonResizable.kt @@ -106,7 +106,7 @@ class LegacySplitScreenFromRecentSupportNonResizable( // Because we log WM once per frame, sometimes the activity and the window // become visible in the same entry, sometimes not, thus it is not possible to // assert the visibility of the activity here - this.isAppWindowInvisible(nonResizeableApp.component, ignoreActivity = true) + this.isAppWindowInvisible(nonResizeableApp.component) .then() // during re-parenting, the window may disappear and reappear from the // trace, this occurs because we log only 1x per frame @@ -128,8 +128,8 @@ class LegacySplitScreenFromRecentSupportNonResizable( @Test fun bothAppsWindowsAreVisibleAtEnd() { testSpec.assertWmEnd { - isVisible(splitScreenApp.component) - isVisible(nonResizeableApp.component) + isAppWindowVisible(splitScreenApp.component) + isAppWindowVisible(nonResizeableApp.component) } } 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 2be693631b26c..56933c371aa8d 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 @@ -101,7 +101,7 @@ class RotateTwoLaunchedAppAndEnterSplitScreen( // Because we log WM once per frame, sometimes the activity and the window // become visible in the same entry, sometimes not, thus it is not possible to // assert the visibility of the activity here - this.isAppWindowInvisible(secondaryApp.component, ignoreActivity = true) + this.isAppWindowInvisible(secondaryApp.component) .then() // during re-parenting, the window may disappear and reappear from the // trace, this occurs because we log only 1x per frame diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/CommonAssertions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/CommonAssertions.kt index 443204c245db4..f9b08000290f1 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/CommonAssertions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/CommonAssertions.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:JvmName("CommonAssertions") package com.android.wm.shell.flicker.pip internal const val PIP_WINDOW_COMPONENT = "PipMenuActivity" 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 d17a2bca875d9..2aa1ed868ff2b 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 @@ -150,7 +150,7 @@ class EnterPipToOtherOrientationTest( @Test fun testAppWindowInvisibleOnStart() { testSpec.assertWmStart { - isInvisible(testApp.component) + isAppWindowInvisible(testApp.component) } } @@ -161,7 +161,7 @@ class EnterPipToOtherOrientationTest( @Test fun testAppWindowVisibleOnEnd() { testSpec.assertWmEnd { - isVisible(testApp.component) + isAppWindowVisible(testApp.component) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipToAppTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipToAppTransition.kt index 8d21d8394162d..64b7eb53bd6f3 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipToAppTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipToAppTransition.kt @@ -62,7 +62,7 @@ abstract class ExitPipToAppTransition(testSpec: FlickerTestParameter) : PipTrans // when the activity is STOPPING, sometimes it becomes invisible in an entry before // the window, sometimes in the same entry. This occurs because we log 1x per frame // thus we ignore activity here - isAppWindowVisible(testApp.component, ignoreActivity = true) + isAppWindowVisible(testApp.component) .isAppWindowOnTop(pipApp.component) .then() .isAppWindowInvisible(testApp.component) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipTransition.kt index 3414031d35321..5207fed592086 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipTransition.kt @@ -54,9 +54,9 @@ abstract class ExitPipTransition(testSpec: FlickerTestParameter) : PipTransition open fun pipWindowBecomesInvisible() { testSpec.assertWm { this.invoke("hasPipWindow") { - it.isPinned(pipApp.component).isVisible(pipApp.component) + it.isPinned(pipApp.component).isAppWindowVisible(pipApp.component) }.then().invoke("!hasPipWindow") { - it.isNotPinned(pipApp.component).isInvisible(pipApp.component) + it.isNotPinned(pipApp.component).isAppWindowInvisible(pipApp.component) } } } 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 d6030401b7cea..9bea5c03dadbd 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 @@ -104,9 +104,9 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t @Test fun bothAppWindowsVisible() { testSpec.assertWmEnd { - isVisible(testApp.component) - isVisible(imeApp.component) - noWindowsOverlap(testApp.component, imeApp.component) + isAppWindowVisible(testApp.component) + isAppWindowVisible(imeApp.component) + doNotOverlap(testApp.component, imeApp.component) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppTransition.kt index 3c610aff04e07..9fce3fa02061a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppTransition.kt @@ -139,7 +139,7 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter) @Test open fun launcherWindowBecomesVisible() { testSpec.assertWm { - this.isAppWindowInvisible(LAUNCHER_COMPONENT) + this.isAppWindowNotOnTop(LAUNCHER_COMPONENT) .then() .isAppWindowOnTop(LAUNCHER_COMPONENT) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt index fad25b4fa0b97..75900df978dfe 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerExtensions.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:JvmName("FlickerExtensions") package com.android.server.wm.flicker.helpers import com.android.server.wm.flicker.Flicker diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt index 035218502fc17..f7f325ec7e225 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt @@ -110,7 +110,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete testSpec.assertWm { this.isAppWindowOnTop(testApp.component) .then() - .appWindowNotOnTop(testApp.component) + .isAppWindowNotOnTop(testApp.component) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt index 665204bc9e1ef..44a27b1278c80 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt @@ -20,6 +20,7 @@ import android.app.Instrumentation import android.platform.test.annotations.Presubmit import android.view.Surface import android.view.WindowManagerPolicyConstants +import androidx.test.filters.FlakyTest import androidx.test.filters.RequiresDevice import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.FlickerBuilderProvider @@ -142,7 +143,7 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) { } } - @Presubmit + @FlakyTest @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() { testSpec.assertWm { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt index d31c9bc1cf68b..7a017039534ae 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ReOpenImeWindowTest.kt @@ -137,9 +137,9 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { // Since we log 1x per frame, sometimes the activity visibility and the app visibility // are updated together, sometimes not, thus ignore activity check at the start testSpec.assertWm { - this.isAppWindowVisible(testApp.component, ignoreActivity = true) + this.isAppWindowVisible(testApp.component) .then() - .isAppWindowInvisible(testApp.component, ignoreActivity = true) + .isAppWindowInvisible(testApp.component) .then() .isAppWindowVisible(testApp.component) } @@ -154,7 +154,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { // and the app visibility are updated together, sometimes not, thus ignore activity // check at the start testSpec.assertWm { - this.isAppWindowVisible(testApp.component, ignoreActivity = true) + this.isAppWindowVisible(testApp.component) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest.kt index 8cff595043526..4c506b0fea4d6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest.kt @@ -106,11 +106,12 @@ class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParame @Test fun imeAppWindowVisibility() { - val component = FlickerComponentName(imeTestApp.`package`, "") testSpec.assertWm { - this.isAppWindowOnTop(component) - .then() - .isAppWindowVisible(component, ignoreActivity = true) + isAppWindowVisible(imeTestApp.component) + .then() + .isAppWindowVisible(testApp.component) + .then() + .isAppWindowVisible(imeTestApp.component) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/ActivitiesTransitionTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/ActivitiesTransitionTest.kt index d369de948e002..60c7ab439acd0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/ActivitiesTransitionTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/ActivitiesTransitionTest.kt @@ -96,11 +96,16 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) { @Test fun entireScreenCovered() = testSpec.entireScreenCovered() + /** + * Checks that the [LAUNCHER_COMPONENT] window is not on top. The launcher cannot be + * asserted with `isAppWindowVisible` because it contains 2 windows with the exact same name, + * and both are never simultaneously visible + */ @Presubmit @Test - fun launcherWindowNotVisible() { + fun launcherWindowNotOnTop() { testSpec.assertWm { - this.isAppWindowInvisible(LAUNCHER_COMPONENT, ignoreActivity = true) + this.isAppWindowNotOnTop(LAUNCHER_COMPONENT) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt index b842681e5c3e0..1bdc23547bef9 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt @@ -132,10 +132,9 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti testSpec.assertWm { this.notContains(testApp.component) .then() - .isAppWindowInvisible(testApp.component, - ignoreActivity = true, isOptional = true) + .isAppWindowInvisible(testApp.component, isOptional = true) .then() - .isAppWindowVisible(testApp.component, ignoreActivity = true) + .isAppWindowVisible(testApp.component) } } @@ -146,7 +145,7 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti @Test fun appWindowBecomesVisibleAtEnd() { testSpec.assertWmEnd { - this.isVisible(testApp.component) + this.isAppWindowVisible(testApp.component) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTransition.kt index e6ce88eea16da..247f3f0ba8d9f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTransition.kt @@ -201,9 +201,9 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { */ open fun launcherWindowBecomesInvisible() { testSpec.assertWm { - this.isAppWindowVisible(LAUNCHER_COMPONENT) + this.isAppWindowOnTop(LAUNCHER_COMPONENT) .then() - .isAppWindowInvisible(LAUNCHER_COMPONENT) + .isAppWindowNotOnTop(LAUNCHER_COMPONENT) } } } \ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt index 091180f95b9c2..cdab6818e2098 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest.kt @@ -191,7 +191,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet .then() .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true) .then() - .isAppWindowVisible(testApp1.component, ignoreActivity = true) + .isAppWindowVisible(testApp1.component) } } @@ -217,7 +217,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet @Test fun app2WindowBecomesAndStaysInvisible() { testSpec.assertWm { - this.isAppWindowVisible(testApp2.component, ignoreActivity = true) + this.isAppWindowVisible(testApp2.component) .then() .isAppWindowInvisible(testApp2.component) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt index ed6f5c6100cb7..d1a3fe43b6daf 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt @@ -209,7 +209,7 @@ class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestPara .then() .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true) .then() - .isAppWindowVisible(testApp2.component, ignoreActivity = true) + .isAppWindowVisible(testApp2.component) } } @@ -235,7 +235,7 @@ class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestPara @Test fun app1WindowBecomesAndStaysInvisible() { testSpec.assertWm { - this.isAppWindowVisible(testApp1.component, ignoreActivity = true) + this.isAppWindowVisible(testApp1.component) .then() .isAppWindowInvisible(testApp1.component) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt index edf440878992e..0389f7ce8d8d6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt @@ -145,7 +145,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { @Test fun startsWithHomeActivityFlaggedVisible() { testSpec.assertWmStart { - this.isHomeActivityVisible(true) + this.isHomeActivityVisible() } } @@ -192,7 +192,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { @Test fun endsWithHomeActivityFlaggedInvisible() { testSpec.assertWmEnd { - this.isHomeActivityVisible(false) + this.isHomeActivityInvisible() } } @@ -204,9 +204,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { @Test fun appWindowBecomesAndStaysVisible() { testSpec.assertWm { - this.isAppWindowInvisible(testApp.component, ignoreActivity = true) + this.isAppWindowInvisible(testApp.component) .then() - .isAppWindowVisible(testApp.component, ignoreActivity = true) + .isAppWindowVisible(testApp.component) } } @@ -232,9 +232,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { @Test fun launcherWindowBecomesAndStaysInvisible() { testSpec.assertWm { - this.isAppWindowVisible(LAUNCHER_COMPONENT) + this.isAppWindowOnTop(LAUNCHER_COMPONENT) .then() - .isAppWindowInvisible(LAUNCHER_COMPONENT) + .isAppWindowNotOnTop(LAUNCHER_COMPONENT) } } @@ -260,7 +260,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { @Test fun appWindowIsVisibleOnceLauncherWindowIsInvisible() { testSpec.assertWm { - this.isAppWindowVisible(LAUNCHER_COMPONENT) + this.isAppWindowOnTop(LAUNCHER_COMPONENT) .then() .isAppWindowVisible(FlickerComponentName.SNAPSHOT) .then()