From 2f28af9c44fe9544f22329f86a5f05e440596175 Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Wed, 22 Sep 2021 09:16:59 +0000 Subject: [PATCH 1/5] [DO NOT MERGE] Sync flicker from master to sc-v2 Flicker on master diverged form sc-v2, to make it easier to debug flicker issues on sc-v2, push the current version of flicker into sc-v2 Test: atest FlickerTests WMShellFlickerTests Bug: 183993924 Change-Id: Icf40d1aa707ffe80e46dcfd2c616355cf48e6719 --- .../wm/shell/flicker/CommonAssertions.kt | 11 +- .../wm/shell/flicker/CommonConstants.kt | 6 +- .../com/android/wm/shell/flicker/WaitUtils.kt | 1 + ...AppPairsTestCannotPairNonResizeableApps.kt | 4 +- ...AppPairsTestPairPrimaryAndSecondaryApps.kt | 4 +- ...ppPairsTestSupportPairNonResizeableApps.kt | 4 +- ...pPairsTestUnpairPrimaryAndSecondaryApps.kt | 4 +- .../flicker/apppairs/AppPairsTransition.kt | 3 +- .../RotateTwoLaunchedAppsInAppPairsMode.kt | 4 +- ...oLaunchedAppsRotateAndEnterAppPairsMode.kt | 4 +- .../shell/flicker/helpers/AppPairsHelper.kt | 4 +- .../wm/shell/flicker/helpers/BaseAppHelper.kt | 5 +- .../shell/flicker/helpers/FixedAppHelper.kt | 3 +- .../wm/shell/flicker/helpers/ImeAppHelper.kt | 3 +- .../flicker/helpers/MultiWindowHelper.kt | 4 +- .../wm/shell/flicker/helpers/PipAppHelper.kt | 12 +- .../shell/flicker/helpers/SimpleAppHelper.kt | 3 +- .../flicker/helpers/SplitScreenHelper.kt | 11 +- .../EnterSplitScreenDockActivity.kt | 15 +- .../EnterSplitScreenFromDetachedRecentTask.kt | 13 +- .../EnterSplitScreenLaunchToSide.kt | 15 +- .../EnterSplitScreenNotSupportNonResizable.kt | 13 +- .../EnterSplitScreenSupportNonResizable.kt | 15 +- .../ExitLegacySplitScreenFromBottom.kt | 9 +- ...imarySplitScreenShowSecondaryFullscreen.kt | 9 +- ...tScreenFromIntentNotSupportNonResizable.kt | 26 +- ...plitScreenFromIntentSupportNonResizable.kt | 18 +- ...tScreenFromRecentNotSupportNonResizable.kt | 19 +- ...plitScreenFromRecentSupportNonResizable.kt | 17 +- .../LegacySplitScreenToLauncher.kt | 9 +- .../LegacySplitScreenTransition.kt | 17 +- .../OpenAppToLegacySplitScreen.kt | 9 +- .../ResizeLegacySplitScreen.kt | 21 +- ...RotateTwoLaunchedAppAndEnterSplitScreen.kt | 2 +- .../wm/shell/flicker/pip/CommonAssertions.kt | 1 + .../wm/shell/flicker/pip/EnterPipTest.kt | 1 - .../pip/EnterPipToOtherOrientationTest.kt | 10 +- .../flicker/pip/ExitPipToAppTransition.kt | 3 +- .../wm/shell/flicker/pip/ExitPipTransition.kt | 4 +- .../pip/ExitPipViaExpandButtonClickTest.kt | 1 - .../shell/flicker/pip/ExitPipViaIntentTest.kt | 1 - .../flicker/pip/ExpandPipOnDoubleClickTest.kt | 1 - .../pip/MovePipShelfHeightTransition.kt | 2 - .../wm/shell/flicker/pip/PipKeyboardTest.kt | 8 +- .../flicker/pip/PipLegacySplitScreenTest.kt | 10 +- .../wm/shell/flicker/pip/PipRotationTest.kt | 4 +- .../SetRequestedOrientationWhilePinnedTest.kt | 4 +- .../server/wm/flicker/CommonAssertions.kt | 47 ++- .../flicker/close/CloseAppBackButtonTest.kt | 38 +- .../flicker/close/CloseAppHomeButtonTest.kt | 40 +- .../wm/flicker/close/CloseAppTransition.kt | 48 ++- .../wm/flicker/helpers/FlickerExtensions.kt | 1 + .../flicker/helpers/ImeAppAutoFocusHelper.kt | 6 +- .../server/wm/flicker/helpers/ImeAppHelper.kt | 6 +- .../flicker/helpers/NonResizeableAppHelper.kt | 6 +- .../helpers/SeamlessRotationAppHelper.kt | 6 +- .../wm/flicker/helpers/SimpleAppHelper.kt | 6 +- .../flicker/helpers/TwoActivitiesAppHelper.kt | 6 +- .../ime/CloseImeAutoOpenWindowToAppTest.kt | 6 +- .../ime/CloseImeAutoOpenWindowToHomeTest.kt | 12 +- .../wm/flicker/ime/CloseImeWindowToAppTest.kt | 10 +- .../flicker/ime/CloseImeWindowToHomeTest.kt | 12 +- .../server/wm/flicker/ime/CommonAssertions.kt | 26 +- .../wm/flicker/ime/OpenImeWindowTest.kt | 3 +- .../wm/flicker/ime/ReOpenImeWindowTest.kt | 33 +- .../ime/SwitchImeWindowsFromGestureNavTest.kt | 32 +- .../launch/ActivitiesTransitionTest.kt | 63 +++- .../launch/OpenAppNonResizeableTest.kt | 30 +- .../wm/flicker/launch/OpenAppTransition.kt | 18 +- .../QuickSwitchBetweenTwoAppsBackTest.kt | 12 +- .../QuickSwitchBetweenTwoAppsForwardTest.kt | 348 ++++++++++++++++++ .../QuickSwitchFromLauncherTest.kt | 24 +- .../flicker/rotation/ChangeAppRotationTest.kt | 67 +++- .../wm/flicker/rotation/RotationTransition.kt | 46 ++- .../rotation/SeamlessAppRotationTest.kt | 96 ++++- 75 files changed, 1054 insertions(+), 361 deletions(-) create mode 100644 tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt 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 b36468b7e9a5e..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,13 +14,14 @@ * limitations under the License. */ +@file:JvmName("CommonAssertions") package com.android.wm.shell.flicker -import android.content.ComponentName import android.graphics.Region import android.view.Surface import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.traces.common.FlickerComponentName fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() { assertLayersEnd { @@ -72,7 +73,7 @@ fun FlickerTestParameter.dockedStackDividerNotExistsAtEnd() { fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd( rotation: Int, - primaryComponent: ComponentName + primaryComponent: FlickerComponentName ) { assertLayersEnd { val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region @@ -83,7 +84,7 @@ fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd( rotation: Int, - primaryComponent: ComponentName + primaryComponent: FlickerComponentName ) { assertLayersEnd { val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region @@ -94,7 +95,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd( rotation: Int, - secondaryComponent: ComponentName + secondaryComponent: FlickerComponentName ) { assertLayersEnd { val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region @@ -105,7 +106,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd( fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd( rotation: Int, - secondaryComponent: ComponentName + secondaryComponent: FlickerComponentName ) { assertLayersEnd { val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region 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 ff1a6e6d9d905..40891f36a5da0 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 @@ -17,8 +17,8 @@ @file:JvmName("CommonConstants") package com.android.wm.shell.flicker -import android.content.ComponentName +import com.android.server.wm.traces.common.FlickerComponentName const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui" -val APP_PAIR_SPLIT_DIVIDER_COMPONENT = ComponentName("", "AppPairSplitDivider#") -val DOCKED_STACK_DIVIDER_COMPONENT = ComponentName("", "DockedStackDivider#") \ No newline at end of file +val APP_PAIR_SPLIT_DIVIDER_COMPONENT = FlickerComponentName("", "AppPairSplitDivider#") +val DOCKED_STACK_DIVIDER_COMPONENT = FlickerComponentName("", "DockedStackDivider#") \ No newline at end of file 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/AppPairsTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/apppairs/AppPairsTransition.kt index cdf89a57fde80..c1ec324e9ab11 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 @@ -38,6 +38,7 @@ import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.wm.shell.flicker.helpers.AppPairsHelper import com.android.wm.shell.flicker.helpers.BaseAppHelper import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.getDevEnableNonResizableMultiWindow @@ -55,7 +56,7 @@ abstract class AppPairsTransition(protected val testSpec: FlickerTestParameter) protected val activityHelper = ActivityHelper.getInstance() protected val appPairsHelper = AppPairsHelper(instrumentation, Components.SplitScreenActivity.LABEL, - Components.SplitScreenActivity.COMPONENT) + Components.SplitScreenActivity.COMPONENT.toFlickerComponent()) protected val primaryApp = SplitScreenHelper.getPrimary(instrumentation) protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation) 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/helpers/AppPairsHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt index 5a438af0b1f16..623055f659b9a 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/AppPairsHelper.kt @@ -17,15 +17,15 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.graphics.Region import com.android.server.wm.flicker.Flicker import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.traces.common.FlickerComponentName class AppPairsHelper( instrumentation: Instrumentation, activityLabel: String, - component: ComponentName + component: FlickerComponentName ) : BaseAppHelper(instrumentation, activityLabel, component) { fun getPrimaryBounds(dividerBounds: Region): android.graphics.Region { val primaryAppBounds = Region(0, 0, dividerBounds.bounds.right, diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/BaseAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/BaseAppHelper.kt index f15044ef37afa..57bc0d580d725 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/BaseAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/BaseAppHelper.kt @@ -17,7 +17,6 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.content.pm.PackageManager.FEATURE_LEANBACK import android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY import android.os.SystemProperties @@ -28,13 +27,13 @@ import androidx.test.uiautomator.UiObject2 import androidx.test.uiautomator.Until import com.android.compatibility.common.util.SystemUtil import com.android.server.wm.flicker.helpers.StandardAppHelper -import com.android.server.wm.traces.parser.toWindowName +import com.android.server.wm.traces.common.FlickerComponentName import java.io.IOException abstract class BaseAppHelper( instrumentation: Instrumentation, launcherName: String, - component: ComponentName + component: FlickerComponentName ) : StandardAppHelper( instrumentation, launcherName, diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/FixedAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/FixedAppHelper.kt index b4ae18749b346..471e010cf560e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/FixedAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/FixedAppHelper.kt @@ -17,10 +17,11 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.wm.shell.flicker.testapp.Components class FixedAppHelper(instrumentation: Instrumentation) : BaseAppHelper( instrumentation, Components.FixedActivity.LABEL, - Components.FixedActivity.COMPONENT + Components.FixedActivity.COMPONENT.toFlickerComponent() ) \ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/ImeAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/ImeAppHelper.kt index 086e8b792e0ef..0f00edea136fe 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/ImeAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/ImeAppHelper.kt @@ -21,13 +21,14 @@ import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.android.server.wm.flicker.helpers.FIND_TIMEOUT +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.wm.shell.flicker.testapp.Components open class ImeAppHelper(instrumentation: Instrumentation) : BaseAppHelper( instrumentation, Components.ImeActivity.LABEL, - Components.ImeActivity.COMPONENT + Components.ImeActivity.COMPONENT.toFlickerComponent() ) { /** * Opens the IME and wait for it to be displayed diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/MultiWindowHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/MultiWindowHelper.kt index 7f99e62b36b09..12ccbafce6515 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/MultiWindowHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/MultiWindowHelper.kt @@ -17,14 +17,14 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.content.Context import android.provider.Settings +import com.android.server.wm.traces.common.FlickerComponentName class MultiWindowHelper( instrumentation: Instrumentation, activityLabel: String, - componentsInfo: ComponentName + componentsInfo: FlickerComponentName ) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) { companion object { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt index 1529f5bcd7e1a..2357b0debb335 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt @@ -26,6 +26,7 @@ import androidx.test.uiautomator.BySelector import androidx.test.uiautomator.Until import com.android.server.wm.flicker.helpers.FIND_TIMEOUT import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.wm.shell.flicker.pip.tv.closeTvPipWindow import com.android.wm.shell.flicker.pip.tv.isFocusedOrHasFocusedChild @@ -34,7 +35,7 @@ import com.android.wm.shell.flicker.testapp.Components class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper( instrumentation, Components.PipActivity.LABEL, - Components.PipActivity.COMPONENT + Components.PipActivity.COMPONENT.toFlickerComponent() ) { private val mediaSessionManager: MediaSessionManager get() = context.getSystemService(MediaSessionManager::class.java) @@ -129,7 +130,7 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper( } /** - * Expands the pip window and dismisses it by clicking on the X button. + * Taps the pip window and dismisses it by clicking on the X button. */ fun closePipWindow(wmHelper: WindowManagerStateHelper) { if (isTelevision) { @@ -137,9 +138,12 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper( } else { val windowRect = getWindowRect(wmHelper) uiDevice.click(windowRect.centerX(), windowRect.centerY()) - val exitPipObject = uiDevice.findObject(By.res(SYSTEMUI_PACKAGE, "dismiss")) + // search and interact with the dismiss button + val dismissSelector = By.res(SYSTEMUI_PACKAGE, "dismiss") + uiDevice.wait(Until.hasObject(dismissSelector), FIND_TIMEOUT) + val dismissPipObject = uiDevice.findObject(dismissSelector) ?: error("PIP window dismiss button not found") - val dismissButtonBounds = exitPipObject.visibleBounds + val dismissButtonBounds = dismissPipObject.visibleBounds uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY()) } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SimpleAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SimpleAppHelper.kt index ba13e38ae9e38..4d0fbc4a0e381 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SimpleAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SimpleAppHelper.kt @@ -17,10 +17,11 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.wm.shell.flicker.testapp.Components class SimpleAppHelper(instrumentation: Instrumentation) : BaseAppHelper( instrumentation, Components.SimpleActivity.LABEL, - Components.SimpleActivity.COMPONENT + Components.SimpleActivity.COMPONENT.toFlickerComponent() ) \ No newline at end of file diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt index 2d996ca1d6f74..0ec9b2d869a8c 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/SplitScreenHelper.kt @@ -17,14 +17,15 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.content.res.Resources +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.wm.shell.flicker.testapp.Components class SplitScreenHelper( instrumentation: Instrumentation, activityLabel: String, - componentsInfo: ComponentName + componentsInfo: FlickerComponentName ) : BaseAppHelper(instrumentation, activityLabel, componentsInfo) { companion object { @@ -39,16 +40,16 @@ class SplitScreenHelper( fun getPrimary(instrumentation: Instrumentation): SplitScreenHelper = SplitScreenHelper(instrumentation, Components.SplitScreenActivity.LABEL, - Components.SplitScreenActivity.COMPONENT) + Components.SplitScreenActivity.COMPONENT.toFlickerComponent()) fun getSecondary(instrumentation: Instrumentation): SplitScreenHelper = SplitScreenHelper(instrumentation, Components.SplitScreenSecondaryActivity.LABEL, - Components.SplitScreenSecondaryActivity.COMPONENT) + Components.SplitScreenSecondaryActivity.COMPONENT.toFlickerComponent()) fun getNonResizeable(instrumentation: Instrumentation): SplitScreenHelper = SplitScreenHelper(instrumentation, Components.NonResizeableActivity.LABEL, - Components.NonResizeableActivity.COMPONENT) + Components.NonResizeableActivity.COMPONENT.toFlickerComponent()) } } 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 508e93988aa65..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 @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import android.view.WindowManagerPolicyConstants @@ -25,13 +24,13 @@ 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.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.SplitScreenHelper @@ -50,7 +49,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group1 +@Group4 class EnterSplitScreenDockActivity( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { @@ -62,10 +61,10 @@ class EnterSplitScreenDockActivity( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(LAUNCHER_COMPONENT, LIVE_WALLPAPER_COMPONENT, - splitScreenApp.component, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, LAUNCHER_COMPONENT) + splitScreenApp.component, FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, LAUNCHER_COMPONENT) @Presubmit @Test @@ -89,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 12f3909b6c342..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 @@ -16,16 +16,16 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface 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.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder @@ -43,6 +43,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) +@Group4 class EnterSplitScreenFromDetachedRecentTask( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { @@ -62,10 +63,10 @@ class EnterSplitScreenFromDetachedRecentTask( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(LAUNCHER_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, splitScreenApp.component) @Presubmit @@ -76,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 ac85c4857c761..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 @@ -16,21 +16,20 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface 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.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.reopenAppFromOverview import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerBecomesVisible import com.android.wm.shell.flicker.dockedStackPrimaryBoundsIsVisibleAtEnd import com.android.wm.shell.flicker.dockedStackSecondaryBoundsIsVisibleAtEnd @@ -49,7 +48,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group1 +@Group4 class EnterSplitScreenLaunchToSide( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { @@ -62,10 +61,10 @@ class EnterSplitScreenLaunchToSide( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(LAUNCHER_COMPONENT, splitScreenApp.component, - secondaryApp.component, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + secondaryApp.component, FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @Presubmit @Test @@ -92,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/EnterSplitScreenNotSupportNonResizable.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNotSupportNonResizable.kt index 964af23414394..ee6cf341c9ff5 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNotSupportNonResizable.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/EnterSplitScreenNotSupportNonResizable.kt @@ -16,17 +16,16 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface 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.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.canSplitScreen -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setSupportsNonResizableMultiWindow @@ -51,7 +50,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) -@Group1 +@Group4 class EnterSplitScreenNotSupportNonResizable( testSpec: FlickerTestParameter ) : LegacySplitScreenTransition(testSpec) { @@ -71,10 +70,10 @@ class EnterSplitScreenNotSupportNonResizable( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(LAUNCHER_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, nonResizeableApp.component, splitScreenApp.component) 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 1b8afa6688029..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 @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.RequiresDevice @@ -26,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setSupportsNonResizableMultiWindow @@ -68,12 +67,12 @@ class EnterSplitScreenSupportNonResizable( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(LAUNCHER_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, - nonResizeableApp.component, - splitScreenApp.component) + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, + nonResizeableApp.component, + splitScreenApp.component) @Before override fun setup() { @@ -95,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/ExitLegacySplitScreenFromBottom.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/ExitLegacySplitScreenFromBottom.kt index 247965f8071dc..2b629b0a7eb52 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,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Postsubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -30,7 +29,7 @@ import com.android.server.wm.flicker.helpers.exitSplitScreenFromBottom import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder @@ -70,10 +69,10 @@ class ExitLegacySplitScreenFromBottom( } } - override val ignoredWindows: List - get() = listOf(LAUNCHER_COMPONENT, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, + override val ignoredWindows: List + get() = listOf(LAUNCHER_COMPONENT, FlickerComponentName.SPLASH_SCREEN, splitScreenApp.component, secondaryApp.component, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + FlickerComponentName.SNAPSHOT) @Postsubmit @Test 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 ff34364261f28..95fe3bef4852f 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.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -30,7 +29,7 @@ import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.reopenAppFromOverview import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder @@ -70,10 +69,10 @@ class ExitPrimarySplitScreenShowSecondaryFullscreen( } } - override val ignoredWindows: List - get() = listOf(LAUNCHER_COMPONENT, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, + override val ignoredWindows: List + get() = listOf(LAUNCHER_COMPONENT, FlickerComponentName.SPLASH_SCREEN, splitScreenApp.component, secondaryApp.component, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + FlickerComponentName.SNAPSHOT) @Presubmit @Test 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 95e4085db4eb2..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 @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.RequiresDevice @@ -26,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig @@ -69,11 +68,11 @@ class LegacySplitScreenFromIntentNotSupportNonResizable( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, - nonResizeableApp.component, splitScreenApp.component, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + nonResizeableApp.component, splitScreenApp.component, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @Before override fun setup() { @@ -120,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) } } @@ -142,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) } } @@ -159,7 +157,7 @@ class LegacySplitScreenFromIntentNotSupportNonResizable( @Test fun nonResizableAppWindowBecomesVisibleAtEnd() { testSpec.assertWmEnd { - this.isVisible(nonResizeableApp.component) + isAppWindowVisible(nonResizeableApp.component) } } @@ -171,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 65346aa8ea5d4..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 @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.RequiresDevice @@ -26,7 +25,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig @@ -69,11 +68,11 @@ class LegacySplitScreenFromIntentSupportNonResizable( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, nonResizeableApp.component, splitScreenApp.component, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @Before override fun setup() { @@ -110,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) } } @@ -128,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 547341a14cdd3..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 @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.Surface @@ -28,7 +27,7 @@ import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.reopenAppFromOverview -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.dockedStackDividerNotExistsAtEnd import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig @@ -71,11 +70,11 @@ class LegacySplitScreenFromRecentNotSupportNonResizable( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, - TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @Before override fun setup() { @@ -116,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) } } @@ -143,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 3f86658297fe9..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 @@ -16,7 +16,6 @@ package com.android.wm.shell.flicker.legacysplitscreen -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.RequiresDevice @@ -27,7 +26,7 @@ import com.android.server.wm.flicker.annotation.Group2 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.reopenAppFromOverview -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.dockedStackDividerIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.resetMultiWindowConfig @@ -70,11 +69,11 @@ class LegacySplitScreenFromRecentSupportNonResizable( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(DOCKED_STACK_DIVIDER_COMPONENT, LAUNCHER_COMPONENT, LETTERBOX_COMPONENT, - TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + TOAST_COMPONENT, splitScreenApp.component, nonResizeableApp.component, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @Before override fun setup() { @@ -107,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 @@ -129,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/LegacySplitScreenToLauncher.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/legacysplitscreen/LegacySplitScreenToLauncher.kt index 5fb6f1fa10761..b6680d96e2a21 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.content.ComponentName import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.Surface @@ -39,7 +38,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.dockedStackDividerBecomesInvisible import com.android.wm.shell.flicker.helpers.SimpleAppHelper import org.junit.FixMethodOrder @@ -86,9 +85,9 @@ class LegacySplitScreenToLauncher( } } - override val ignoredWindows: List - get() = listOf(LAUNCHER_COMPONENT, WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + override val ignoredWindows: List + get() = listOf(LAUNCHER_COMPONENT, FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @Presubmit @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 311769313a7a1..661c8b69068ec 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.content.ComponentName import android.content.Context import android.support.test.launcherhelper.LauncherStrategyFactory import android.view.Surface @@ -32,7 +31,7 @@ import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.repetitions import com.android.server.wm.flicker.startRotation -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.helpers.BaseAppHelper.Companion.isShellTransitionsEnabled import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.getDevEnableNonResizableMultiWindow import com.android.wm.shell.flicker.helpers.MultiWindowHelper.Companion.setDevEnableNonResizableMultiWindow @@ -50,7 +49,7 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa protected val splitScreenApp = SplitScreenHelper.getPrimary(instrumentation) protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation) protected val nonResizeableApp = SplitScreenHelper.getNonResizeable(instrumentation) - protected val LAUNCHER_COMPONENT = ComponentName("", + protected val LAUNCHER_COMPONENT = FlickerComponentName("", LauncherStrategyFactory.getInstance(instrumentation) .launcherStrategy.supportedLauncherPackage) private var prevDevEnableNonResizableMultiWindow = 0 @@ -79,9 +78,9 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa * * b/182720234 */ - open val ignoredWindows: List = listOf( - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + open val ignoredWindows: List = listOf( + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) protected open val transition: FlickerBuilder.(Map) -> Unit get() = { configuration -> @@ -148,9 +147,9 @@ abstract class LegacySplitScreenTransition(protected val testSpec: FlickerTestPa } companion object { - internal val LIVE_WALLPAPER_COMPONENT = ComponentName("", + internal val LIVE_WALLPAPER_COMPONENT = FlickerComponentName("", "com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2") - internal val LETTERBOX_COMPONENT = ComponentName("", "Letterbox") - internal val TOAST_COMPONENT = ComponentName("", "Toast") + internal val LETTERBOX_COMPONENT = FlickerComponentName("", "Letterbox") + internal val TOAST_COMPONENT = FlickerComponentName("", "Toast") } } 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 a7ac6a77d425c..34eff80a04bc1 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.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import androidx.test.filters.FlakyTest @@ -29,7 +28,7 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.statusBarLayerIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.appPairsDividerBecomesVisible import com.android.wm.shell.flicker.helpers.SplitScreenHelper import org.junit.FixMethodOrder @@ -59,10 +58,10 @@ class OpenAppToLegacySplitScreen( } } - override val ignoredWindows: List + override val ignoredWindows: List get() = listOf(LAUNCHER_COMPONENT, splitScreenApp.component, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT) + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT) @FlakyTest @Test 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 cd150518f21f8..14b006ee046e8 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 @@ -42,6 +42,7 @@ import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.wm.shell.flicker.DOCKED_STACK_DIVIDER_COMPONENT import com.android.wm.shell.flicker.helpers.SimpleAppHelper import com.android.wm.shell.flicker.testapp.Components @@ -110,7 +111,7 @@ class ResizeLegacySplitScreen( @Test fun topAppWindowIsAlwaysVisible() { testSpec.assertWm { - this.isAppWindowVisible(Components.SimpleActivity.COMPONENT) + this.isAppWindowVisible(Components.SimpleActivity.COMPONENT.toFlickerComponent()) } } @@ -118,7 +119,7 @@ class ResizeLegacySplitScreen( @Test fun bottomAppWindowIsAlwaysVisible() { testSpec.assertWm { - this.isAppWindowVisible(Components.ImeActivity.COMPONENT) + this.isAppWindowVisible(Components.ImeActivity.COMPONENT.toFlickerComponent()) } } @@ -142,14 +143,14 @@ class ResizeLegacySplitScreen( @Test fun topAppLayerIsAlwaysVisible() { testSpec.assertLayers { - this.isVisible(Components.SimpleActivity.COMPONENT) + this.isVisible(Components.SimpleActivity.COMPONENT.toFlickerComponent()) } } @Test fun bottomAppLayerIsAlwaysVisible() { testSpec.assertLayers { - this.isVisible(Components.ImeActivity.COMPONENT) + this.isVisible(Components.ImeActivity.COMPONENT.toFlickerComponent()) } } @@ -174,8 +175,10 @@ class ResizeLegacySplitScreen( dividerBounds.bottom - WindowUtils.dockedStackDividerInset, displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) - visibleRegion(Components.SimpleActivity.COMPONENT).coversExactly(topAppBounds) - visibleRegion(Components.ImeActivity.COMPONENT).coversExactly(bottomAppBounds) + visibleRegion(Components.SimpleActivity.COMPONENT.toFlickerComponent()) + .coversExactly(topAppBounds) + visibleRegion(Components.ImeActivity.COMPONENT.toFlickerComponent()) + .coversExactly(bottomAppBounds) } } @@ -194,8 +197,10 @@ class ResizeLegacySplitScreen( displayBounds.right, displayBounds.bottom - WindowUtils.navigationBarHeight) - visibleRegion(Components.SimpleActivity.COMPONENT).coversExactly(topAppBounds) - visibleRegion(Components.ImeActivity.COMPONENT).coversExactly(bottomAppBounds) + visibleRegion(Components.SimpleActivity.COMPONENT.toFlickerComponent()) + .coversExactly(topAppBounds) + visibleRegion(Components.ImeActivity.COMPONENT.toFlickerComponent()) + .coversExactly(bottomAppBounds) } } 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/EnterPipTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt index 046972d246e6d..52a744f3897d8 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 @@ -26,7 +26,6 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.traces.parser.toLayerName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith 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 097ccb8cd734f..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 @@ -29,7 +29,7 @@ import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.navBarLayerRotatesAndScales import com.android.server.wm.flicker.statusBarLayerRotatesScales -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.helpers.FixedAppHelper import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT @@ -106,7 +106,7 @@ class EnterPipToOtherOrientationTest( } /** - * Checks that the [WindowManagerStateHelper.NAV_BAR_COMPONENT] has the correct position at + * Checks that the [FlickerComponentName.NAV_BAR] has the correct position at * the start and end of the transition */ @FlakyTest @@ -115,7 +115,7 @@ class EnterPipToOtherOrientationTest( testSpec.navBarLayerRotatesAndScales(Surface.ROTATION_90, Surface.ROTATION_0) /** - * Checks that the [WindowManagerStateHelper.STATUS_BAR_COMPONENT] has the correct position at + * Checks that the [FlickerComponentName.STATUS_BAR] has the correct position at * the start and end of the transition */ @Presubmit @@ -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 faaaecb8da463..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 @@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.pip import android.platform.test.annotations.Presubmit import com.android.server.wm.flicker.FlickerTestParameter -import com.android.server.wm.traces.parser.toLayerName import com.android.wm.shell.flicker.helpers.FixedAppHelper import org.junit.Test @@ -63,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/ExitPipViaExpandButtonClickTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaExpandButtonClickTest.kt index fa100b5b25ab8..b53342d6f2f79 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaExpandButtonClickTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaExpandButtonClickTest.kt @@ -23,7 +23,6 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.traces.parser.toWindowName import org.junit.FixMethodOrder import org.junit.runner.RunWith import org.junit.runners.MethodSorters diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaIntentTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaIntentTest.kt index 617ef221ee9a2..1fec3cf852144 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaIntentTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExitPipViaIntentTest.kt @@ -23,7 +23,6 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.traces.parser.toWindowName import org.junit.FixMethodOrder import org.junit.runner.RunWith import org.junit.runners.MethodSorters diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt index 89b2c400e80ae..ce840efcab88d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt @@ -27,7 +27,6 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.traces.parser.toLayerName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/MovePipShelfHeightTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/MovePipShelfHeightTransition.kt index ed04fc9474353..6e0324c17272f 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/MovePipShelfHeightTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/MovePipShelfHeightTransition.kt @@ -20,8 +20,6 @@ import android.platform.test.annotations.Presubmit import com.android.launcher3.tapl.LauncherInstrumentation import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.traces.RegionSubject -import com.android.server.wm.traces.parser.toLayerName -import com.android.server.wm.traces.parser.toWindowName import com.android.wm.shell.flicker.helpers.FixedAppHelper import org.junit.Test 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 5719413aff25e..aba8aced298fd 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 @@ -22,12 +22,12 @@ 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.annotation.Group3 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.WindowUtils import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.startRotation -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.android.wm.shell.flicker.helpers.ImeAppHelper import org.junit.FixMethodOrder import org.junit.Test @@ -43,7 +43,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group3 +@Group4 class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { private val imeApp = ImeAppHelper(instrumentation) @@ -90,7 +90,7 @@ class PipKeyboardTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) @Test fun pipIsAboveAppWindow() { testSpec.assertWmTag(TAG_IME_VISIBLE) { - isAboveWindow(WindowManagerStateHelper.IME_COMPONENT, pipApp.component) + isAboveWindow(FlickerComponentName.IME, 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 086165289d2d8..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 @@ -23,7 +23,7 @@ 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.annotation.Group3 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen @@ -51,7 +51,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group3 +@Group4 class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { private val imeApp = ImeAppHelper(instrumentation) private val testApp = FixedAppHelper(instrumentation) @@ -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/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 b1054600d7020..08d52095e499d 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 @@ -23,7 +23,7 @@ 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.annotation.Group3 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.entireScreenCovered @@ -62,7 +62,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group3 +@Group4 class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) { private val fixedApp = FixedAppHelper(instrumentation) private val screenBoundsStart = WindowUtils.getDisplayBounds(testSpec.config.startRotation) 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 02a3eb1e070ae..d6dbc366aec0c 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 @@ -22,7 +22,7 @@ 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.annotation.Group3 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.WindowUtils import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE @@ -43,7 +43,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group3 +@Group4 class SetRequestedOrientationWhilePinnedTest( testSpec: FlickerTestParameter ) : PipTransition(testSpec) { 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 2cc19438b9272..562a0bd6a05d1 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -17,22 +17,29 @@ @file:JvmName("CommonAssertions") package com.android.server.wm.flicker -import android.content.ComponentName import com.android.server.wm.flicker.helpers.WindowUtils -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName -val LAUNCHER_COMPONENT = ComponentName("com.google.android.apps.nexuslauncher", +val LAUNCHER_COMPONENT = FlickerComponentName("com.google.android.apps.nexuslauncher", "com.google.android.apps.nexuslauncher.NexusLauncherActivity") +/** + * Checks that [FlickerComponentName.STATUS_BAR] window is visible and above the app windows in + * all WM trace entries + */ fun FlickerTestParameter.statusBarWindowIsVisible() { assertWm { - this.isAboveAppWindowVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + this.isAboveAppWindowVisible(FlickerComponentName.STATUS_BAR) } } +/** + * Checks that [FlickerComponentName.NAV_BAR] window is visible and above the app windows in + * all WM trace entries + */ fun FlickerTestParameter.navBarWindowIsVisible() { assertWm { - this.isAboveAppWindowVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + this.isAboveAppWindowVisible(FlickerComponentName.NAV_BAR) } } @@ -69,21 +76,29 @@ fun FlickerTestParameter.entireScreenCovered(allStates: Boolean = true) { } } +/** + * Checks that [FlickerComponentName.NAV_BAR] layer is visible at the start and end of the SF + * trace + */ fun FlickerTestParameter.navBarLayerIsVisible() { assertLayersStart { - this.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + this.isVisible(FlickerComponentName.NAV_BAR) } assertLayersEnd { - this.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + this.isVisible(FlickerComponentName.NAV_BAR) } } +/** + * Checks that [FlickerComponentName.STATUS_BAR] layer is visible at the start and end of the SF + * trace + */ fun FlickerTestParameter.statusBarLayerIsVisible() { assertLayersStart { - this.isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + this.isVisible(FlickerComponentName.STATUS_BAR) } assertLayersEnd { - this.isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + this.isVisible(FlickerComponentName.STATUS_BAR) } } @@ -96,10 +111,10 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales( val endingPos = WindowUtils.getNavigationBarPosition(endRotation) assertLayersStart { - this.visibleRegion(WindowManagerStateHelper.NAV_BAR_COMPONENT).coversExactly(startingPos) + this.visibleRegion(FlickerComponentName.NAV_BAR).coversExactly(startingPos) } assertLayersEnd { - this.visibleRegion(WindowManagerStateHelper.NAV_BAR_COMPONENT).coversExactly(endingPos) + this.visibleRegion(FlickerComponentName.NAV_BAR).coversExactly(endingPos) } } @@ -112,10 +127,10 @@ fun FlickerTestParameter.statusBarLayerRotatesScales( val endingPos = WindowUtils.getStatusBarPosition(endRotation) assertLayersStart { - this.visibleRegion(WindowManagerStateHelper.STATUS_BAR_COMPONENT).coversExactly(startingPos) + this.visibleRegion(FlickerComponentName.STATUS_BAR).coversExactly(startingPos) } assertLayersEnd { - this.visibleRegion(WindowManagerStateHelper.STATUS_BAR_COMPONENT).coversExactly(endingPos) + this.visibleRegion(FlickerComponentName.STATUS_BAR).coversExactly(endingPos) } } @@ -132,15 +147,15 @@ fun FlickerTestParameter.statusBarLayerRotatesScales( * (useful mostly for app launch) */ fun FlickerTestParameter.replacesLayer( - originalLayer: ComponentName, - newLayer: ComponentName, + originalLayer: FlickerComponentName, + newLayer: FlickerComponentName, ignoreSnapshot: Boolean = false ) { assertLayers { val assertion = this.isVisible(originalLayer) if (ignoreSnapshot) { assertion.then() - .isVisible(WindowManagerStateHelper.SNAPSHOT_COMPONENT, isOptional = true) + .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true) } assertion.then().isVisible(newLayer) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt index 90c851d6e2663..9b34853092a2a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt @@ -23,7 +23,7 @@ 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.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import org.junit.FixMethodOrder import org.junit.Test @@ -33,13 +33,38 @@ import org.junit.runners.Parameterized /** * Test app closes by pressing back button + * * To run this test: `atest FlickerTests:CloseAppBackButtonTest` + * + * Actions: + * Make sure no apps are running on the device + * Launch an app [testApp] and wait animation to complete + * Press back button + * + * To run only the presubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit` + * + * To run only the postsubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit` + * + * To run only the flaky assertions add: `-- + * --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest` + * + * Notes: + * 1. Some default assertions (e.g., nav bar, status bar and screen covered) + * are inherited [CloseAppTransition] + * 2. Part of the test setup occurs automatically via + * [com.android.server.wm.flicker.TransitionRunnerWithRules], + * including configuring navigation mode, initial orientation and ensuring no + * apps are running before setup */ @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group1 +@Group4 class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) { override val transition: FlickerBuilder.(Map) -> Unit get() = { @@ -50,14 +75,23 @@ class CloseAppBackButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio } } + /** {@inheritDoc} */ @FlakyTest @Test override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() + /** {@inheritDoc} */ @Postsubmit + @Test override fun navBarLayerIsVisible() = super.navBarLayerIsVisible() companion object { + /** + * Creates the test configurations. + * + * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring + * repetitions, screen orientation and navigation modes. + */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): List { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt index e8391ed9cfa17..e380794906185 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppHomeButtonTest.kt @@ -22,7 +22,7 @@ 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.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import org.junit.FixMethodOrder import org.junit.Test @@ -31,14 +31,39 @@ import org.junit.runners.MethodSorters import org.junit.runners.Parameterized /** - * Test app closes by pressing home button. + * Test app closes by pressing home button + * * To run this test: `atest FlickerTests:CloseAppHomeButtonTest` + * + * Actions: + * Make sure no apps are running on the device + * Launch an app [testApp] and wait animation to complete + * Press home button + * + * To run only the presubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit` + * + * To run only the postsubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit` + * + * To run only the flaky assertions add: `-- + * --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest` + * + * Notes: + * 1. Some default assertions (e.g., nav bar, status bar and screen covered) + * are inherited [CloseAppTransition] + * 2. Part of the test setup occurs automatically via + * [com.android.server.wm.flicker.TransitionRunnerWithRules], + * including configuring navigation mode, initial orientation and ensuring no + * apps are running before setup */ @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group1 +@Group4 class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransition(testSpec) { override val transition: FlickerBuilder.(Map) -> Unit get() = { @@ -49,14 +74,23 @@ class CloseAppHomeButtonTest(testSpec: FlickerTestParameter) : CloseAppTransitio } } + /** {@inheritDoc} */ @FlakyTest @Test override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() + /** {@inheritDoc} */ @Postsubmit + @Test override fun navBarLayerIsVisible() = super.navBarLayerIsVisible() companion object { + /** + * Creates the test configurations. + * + * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring + * repetitions, screen orientation and navigation modes. + */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection { 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 1efb6daae31bf..04826191d8ad2 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 @@ -62,6 +62,10 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Entry point for the test runner. It will use this method to initialize and cache + * flicker executions + */ @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { @@ -69,42 +73,64 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that the navigation bar window is visible during the whole transition + */ @Presubmit @Test open fun navBarWindowIsVisible() { testSpec.navBarWindowIsVisible() } + /** + * Checks that the status bar window is visible during the whole transition + */ @Presubmit @Test open fun statusBarWindowIsVisible() { testSpec.statusBarWindowIsVisible() } + /** + * Checks that the navigation bar layer is visible during the whole transition + */ @Presubmit @Test open fun navBarLayerIsVisible() { testSpec.navBarLayerIsVisible() } + /** + * Checks that the status bar layer is visible during the whole transition + */ @Presubmit @Test open fun statusBarLayerIsVisible() { testSpec.statusBarLayerIsVisible() } + /** + * Checks the position of the navigation bar at the start and end of the transition + */ @Presubmit @Test open fun navBarLayerRotatesAndScales() { testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0) } + /** + * Checks the position of the status bar at the start and end of the transition + */ @Presubmit @Test open fun statusBarLayerRotatesScales() { testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0) } + /** + * Checks that all windows that are visible on the trace, are visible for at least 2 + * consecutive entries. + */ @Presubmit @Test open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { @@ -113,6 +139,10 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that all layers that are visible on the trace, are visible for at least 2 + * consecutive entries. + */ @Presubmit @Test open fun visibleLayersShownMoreThanOneConsecutiveEntry() { @@ -121,10 +151,17 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that all parts of the screen are covered during the transition + */ @Presubmit @Test open fun entireScreenCovered() = testSpec.entireScreenCovered() + /** + * Checks that [testApp] is the top visible app window at the start of the transition and + * that it is replaced by [LAUNCHER_COMPONENT] during the transition + */ @Presubmit @Test open fun launcherReplacesAppWindowAsTopWindow() { @@ -135,19 +172,26 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that [LAUNCHER_COMPONENT] is invisible at the start of the transition and that + * it becomes visible during the transition + */ @Presubmit @Test open fun launcherWindowBecomesVisible() { testSpec.assertWm { - this.isAppWindowInvisible(LAUNCHER_COMPONENT) + this.isAppWindowNotOnTop(LAUNCHER_COMPONENT) .then() .isAppWindowOnTop(LAUNCHER_COMPONENT) } } + /** + * Checks that [LAUNCHER_COMPONENT] layer becomes visible when [testApp] becomes invisible + */ @Presubmit @Test open fun launcherLayerReplacesApp() { testSpec.replacesLayer(testApp.component, LAUNCHER_COMPONENT) } -} +} \ No newline at end of file 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/helpers/ImeAppAutoFocusHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt index bd7c1855fea9c..0b1748a6bda41 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt @@ -17,9 +17,10 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import androidx.test.uiautomator.UiDevice import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper class ImeAppAutoFocusHelper @JvmOverloads constructor( @@ -27,7 +28,8 @@ class ImeAppAutoFocusHelper @JvmOverloads constructor( private val rotation: Int, private val imePackageName: String = IME_PACKAGE, launcherName: String = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_LAUNCHER_NAME, - component: ComponentName = ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME + component: FlickerComponentName = + ActivityOptions.IME_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent() ) : ImeAppHelper(instr, launcherName, component) { override fun openIME( device: UiDevice, diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt index d224af97462e0..1c2164a70a551 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt @@ -17,19 +17,21 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.LauncherStrategyFactory import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper open class ImeAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.IME_ACTIVITY_LAUNCHER_NAME, - component: ComponentName = ActivityOptions.IME_ACTIVITY_COMPONENT_NAME, + component: FlickerComponentName = + ActivityOptions.IME_ACTIVITY_COMPONENT_NAME.toFlickerComponent(), launcherStrategy: ILauncherStrategy = LauncherStrategyFactory .getInstance(instr) .launcherStrategy diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt index 3074e28b43fac..f7ca5ce1c001b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NonResizeableAppHelper.kt @@ -17,15 +17,17 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.LauncherStrategyFactory import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent class NonResizeableAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.NON_RESIZEABLE_ACTIVITY_LAUNCHER_NAME, - component: ComponentName = ActivityOptions.NON_RESIZEABLE_ACTIVITY_COMPONENT_NAME, + component: FlickerComponentName = + ActivityOptions.NON_RESIZEABLE_ACTIVITY_COMPONENT_NAME.toFlickerComponent(), launcherStrategy: ILauncherStrategy = LauncherStrategyFactory .getInstance(instr) .launcherStrategy diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt index 02be3cf0a8a36..7bab981ce231d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SeamlessRotationAppHelper.kt @@ -17,15 +17,17 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.LauncherStrategyFactory import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent class SeamlessRotationAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.SEAMLESS_ACTIVITY_LAUNCHER_NAME, - component: ComponentName = ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME, + component: FlickerComponentName = + ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME.toFlickerComponent(), launcherStrategy: ILauncherStrategy = LauncherStrategyFactory .getInstance(instr) .launcherStrategy diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt index d7cbaaee26275..f6a8817e5b082 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/SimpleAppHelper.kt @@ -17,15 +17,17 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.LauncherStrategyFactory import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent class SimpleAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.SIMPLE_ACTIVITY_LAUNCHER_NAME, - component: ComponentName = ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME, + component: FlickerComponentName = + ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent(), launcherStrategy: ILauncherStrategy = LauncherStrategyFactory .getInstance(instr) .launcherStrategy diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt index 19fefb93b4876..59e8dc8260075 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/TwoActivitiesAppHelper.kt @@ -17,19 +17,21 @@ package com.android.server.wm.flicker.helpers import android.app.Instrumentation -import android.content.ComponentName import android.support.test.launcherhelper.ILauncherStrategy import android.support.test.launcherhelper.LauncherStrategyFactory import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.common.FlickerComponentName +import com.android.server.wm.traces.parser.toFlickerComponent import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper class TwoActivitiesAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.BUTTON_ACTIVITY_LAUNCHER_NAME, - component: ComponentName = ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME, + component: FlickerComponentName = + ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME.toFlickerComponent(), launcherStrategy: ILauncherStrategy = LauncherStrategyFactory .getInstance(instr) .launcherStrategy diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt index d17e77d74c1c9..35505367ce216 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt @@ -37,7 +37,7 @@ import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -125,7 +125,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter @Test fun imeLayerVisibleStart() { testSpec.assertLayersStart { - this.isVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isVisible(FlickerComponentName.IME) } } @@ -133,7 +133,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter @Test fun imeLayerInvisibleEnd() { testSpec.assertLayersEnd { - this.isInvisible(WindowManagerStateHelper.IME_COMPONENT) + this.isInvisible(FlickerComponentName.IME) } } 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 6f0f55aa4888b..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 @@ -38,7 +38,7 @@ import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -110,7 +110,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete testSpec.assertWm { this.isAppWindowOnTop(testApp.component) .then() - .appWindowNotOnTop(testApp.component) + .isAppWindowNotOnTop(testApp.component) } } @@ -122,7 +122,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete @Test fun imeLayerVisibleStart() { testSpec.assertLayersStart { - this.isVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isVisible(FlickerComponentName.IME) } } @@ -130,7 +130,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete @Test fun imeLayerInvisibleEnd() { testSpec.assertLayersEnd { - this.isInvisible(WindowManagerStateHelper.IME_COMPONENT) + this.isInvisible(FlickerComponentName.IME) } } @@ -173,8 +173,8 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete fun visibleLayersShownMoreThanOneConsecutiveEntry() { testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf( - WindowManagerStateHelper.IME_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT)) + FlickerComponentName.IME, + FlickerComponentName.SPLASH_SCREEN)) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt index 6751439709bfe..11660dfe43fc9 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt @@ -35,8 +35,8 @@ import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.Assume -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -91,9 +91,9 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) { fun visibleWindowsShownMoreThanOneConsecutiveEntry() { testSpec.assertWm { this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf( - WindowManagerStateHelper.IME_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT)) + FlickerComponentName.IME, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT)) } } @@ -165,4 +165,4 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) { .getConfigNonRotationTests(repetitions = 5) } } -} +} \ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt index 8aaf9251018f3..bb2ffbc372d0e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt @@ -37,7 +37,7 @@ import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -95,9 +95,9 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) { fun visibleWindowsShownMoreThanOneConsecutiveEntry() { testSpec.assertWm { this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf( - WindowManagerStateHelper.IME_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT)) + FlickerComponentName.IME, + FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT)) } } @@ -157,8 +157,8 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) { fun visibleLayersShownMoreThanOneConsecutiveEntry() { testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry(listOf( - WindowManagerStateHelper.IME_COMPONENT, - WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT)) + FlickerComponentName.IME, + FlickerComponentName.SPLASH_SCREEN)) } } 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 7659d9471e2f2..ba78e25580eca 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 @@ -18,52 +18,52 @@ package com.android.server.wm.flicker.ime import com.android.server.wm.flicker.FlickerTestParameter -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName fun FlickerTestParameter.imeLayerBecomesVisible() { assertLayers { - this.isInvisible(WindowManagerStateHelper.IME_COMPONENT) + this.isInvisible(FlickerComponentName.IME) .then() - .isVisible(WindowManagerStateHelper.IME_COMPONENT) + .isVisible(FlickerComponentName.IME) } } fun FlickerTestParameter.imeLayerBecomesInvisible() { assertLayers { - this.isVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isVisible(FlickerComponentName.IME) .then() - .isInvisible(WindowManagerStateHelper.IME_COMPONENT) + .isInvisible(FlickerComponentName.IME) } } fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false) { if (rotatesScreen) { assertWm { - this.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isNonAppWindowVisible(FlickerComponentName.IME) .then() - .isNonAppWindowInvisible(WindowManagerStateHelper.IME_COMPONENT) + .isNonAppWindowInvisible(FlickerComponentName.IME) .then() - .isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) + .isNonAppWindowVisible(FlickerComponentName.IME) } } else { assertWm { - this.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isNonAppWindowVisible(FlickerComponentName.IME) } } } fun FlickerTestParameter.imeWindowBecomesVisible() { assertWm { - this.isNonAppWindowInvisible(WindowManagerStateHelper.IME_COMPONENT) + this.isNonAppWindowInvisible(FlickerComponentName.IME) .then() - .isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) + .isNonAppWindowVisible(FlickerComponentName.IME) } } fun FlickerTestParameter.imeWindowBecomesInvisible() { assertWm { - this.isNonAppWindowVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isNonAppWindowVisible(FlickerComponentName.IME) .then() - .isNonAppWindowInvisible(WindowManagerStateHelper.IME_COMPONENT) + .isNonAppWindowInvisible(FlickerComponentName.IME) } } 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 b37c404479341..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 @@ -17,7 +17,6 @@ package com.android.server.wm.flicker.ime import android.app.Instrumentation -import android.content.ComponentName import android.os.SystemProperties import android.platform.test.annotations.Presubmit import android.view.Surface @@ -43,7 +42,7 @@ import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.Assume import org.junit.FixMethodOrder import org.junit.Test @@ -104,12 +103,12 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { @Presubmit @Test fun visibleWindowsShownMoreThanOneConsecutiveEntry() { - val component = ComponentName("", "RecentTaskScreenshotSurface") + val component = FlickerComponentName("", "RecentTaskScreenshotSurface") testSpec.assertWm { this.visibleWindowsShownMoreThanOneConsecutiveEntry( - ignoreWindows = listOf(WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, - component) + ignoreWindows = listOf(FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, + component) ) } } @@ -138,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) } @@ -155,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) } } @@ -177,11 +176,11 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { fun imeLayerIsBecomesVisibleLegacy() { Assume.assumeFalse(isShellTransitionsEnabled) testSpec.assertLayers { - this.isVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isVisible(FlickerComponentName.IME) .then() - .isInvisible(WindowManagerStateHelper.IME_COMPONENT) + .isInvisible(FlickerComponentName.IME) .then() - .isVisible(WindowManagerStateHelper.IME_COMPONENT) + .isVisible(FlickerComponentName.IME) } } @@ -190,7 +189,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { fun imeLayerIsBecomesVisible() { Assume.assumeTrue(isShellTransitionsEnabled) testSpec.assertLayers { - this.isVisible(WindowManagerStateHelper.IME_COMPONENT) + this.isVisible(FlickerComponentName.IME) } } @@ -200,7 +199,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { testSpec.assertLayers { this.isVisible(LAUNCHER_COMPONENT) .then() - .isVisible(WindowManagerStateHelper.SNAPSHOT_COMPONENT, isOptional = true) + .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true) .then() .isVisible(testApp.component) } @@ -223,11 +222,11 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) { fun visibleLayersShownMoreThanOneConsecutiveEntry() { // depends on how much of the animation transactions are sent to SF at once // sometimes this layer appears for 2-3 frames, sometimes for only 1 - val recentTaskComponent = ComponentName("", "RecentTaskScreenshotSurface") + val recentTaskComponent = FlickerComponentName("", "RecentTaskScreenshotSurface") testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry( - listOf(WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, recentTaskComponent) + listOf(FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, recentTaskComponent) ) } } 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 f9dd88e8cb29d..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 @@ -17,7 +17,6 @@ package com.android.server.wm.flicker.ime import android.app.Instrumentation -import android.content.ComponentName import android.platform.test.annotations.Presubmit import android.view.Surface import android.view.WindowManagerPolicyConstants @@ -28,7 +27,7 @@ import com.android.server.wm.flicker.FlickerBuilderProvider import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory -import com.android.server.wm.flicker.annotation.Group2 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.helpers.WindowUtils @@ -36,7 +35,7 @@ import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test @@ -52,7 +51,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group2 +@Group4 @Presubmit class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() @@ -107,51 +106,52 @@ class SwitchImeWindowsFromGestureNavTest(private val testSpec: FlickerTestParame @Test fun imeAppWindowVisibility() { - val component = ComponentName(imeTestApp.`package`, "") testSpec.assertWm { - this.isAppWindowOnTop(component) - .then() - .isAppWindowVisible(component, ignoreActivity = true) + isAppWindowVisible(imeTestApp.component) + .then() + .isAppWindowVisible(testApp.component) + .then() + .isAppWindowVisible(imeTestApp.component) } } @Test fun navBarLayerIsVisibleAroundSwitching() { testSpec.assertLayersStart { - isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + isVisible(FlickerComponentName.NAV_BAR) } testSpec.assertLayersEnd { - isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + isVisible(FlickerComponentName.NAV_BAR) } } @Test fun statusBarLayerIsVisibleAroundSwitching() { testSpec.assertLayersStart { - isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + isVisible(FlickerComponentName.STATUS_BAR) } testSpec.assertLayersEnd { - isVisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + isVisible(FlickerComponentName.STATUS_BAR) } } @Test fun imeLayerIsVisibleWhenSwitchingToImeApp() { testSpec.assertLayersStart { - isVisible(WindowManagerStateHelper.IME_COMPONENT) + isVisible(FlickerComponentName.IME) } testSpec.assertLayersTag(TAG_IME_VISIBLE) { - isVisible(WindowManagerStateHelper.IME_COMPONENT) + isVisible(FlickerComponentName.IME) } testSpec.assertLayersEnd { - isVisible(WindowManagerStateHelper.IME_COMPONENT) + isVisible(FlickerComponentName.IME) } } @Test fun imeLayerIsInvisibleWhenSwitchingToTestApp() { testSpec.assertLayersTag(TAG_IME_INVISIBLE) { - isInvisible(WindowManagerStateHelper.IME_COMPONENT) + isInvisible(FlickerComponentName.IME) } } 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 42c252e70eeab..f74a7718461f3 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 @@ -27,10 +27,11 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.repetitions -import com.android.server.wm.flicker.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.TwoActivitiesAppHelper import com.android.server.wm.flicker.testapp.ActivityOptions +import com.android.server.wm.traces.parser.toFlickerComponent import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -39,17 +40,33 @@ import org.junit.runners.Parameterized /** * Test the back and forward transition between 2 activities. + * * To run this test: `atest FlickerTests:ActivitiesTransitionTest` + * + * Actions: + * Launch an app + * Launch a secondary activity within the app + * Close the secondary activity back to the initial one + * + * Notes: + * 1. Part of the test setup occurs automatically via + * [com.android.server.wm.flicker.TransitionRunnerWithRules], + * including configuring navigation mode, initial orientation and ensuring no + * apps are running before setup */ @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group1 +@Group4 class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) { val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp: TwoActivitiesAppHelper = TwoActivitiesAppHelper(instrumentation) + /** + * Entry point for the test runner. It will use this method to initialize and cache + * flicker executions + */ @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { @@ -75,30 +92,52 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) { } } + /** + * Checks that the [ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME] activity is visible at + * the start of the transition, that + * [ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME] becomes visible during the + * transition, and that [ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME] is again visible + * at the end + */ @Presubmit @Test fun finishSubActivity() { + val buttonActivityComponent = ActivityOptions + .BUTTON_ACTIVITY_COMPONENT_NAME.toFlickerComponent() + val imeAutoFocusActivityComponent = ActivityOptions + .SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME.toFlickerComponent() testSpec.assertWm { - this.isAppWindowOnTop(ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME) - .then() - .isAppWindowOnTop(ActivityOptions.SIMPLE_ACTIVITY_AUTO_FOCUS_COMPONENT_NAME) - .then() - .isAppWindowOnTop(ActivityOptions.BUTTON_ACTIVITY_COMPONENT_NAME) + this.isAppWindowOnTop(buttonActivityComponent) + .then() + .isAppWindowOnTop(imeAutoFocusActivityComponent) + .then() + .isAppWindowOnTop(buttonActivityComponent) } } + /** + * Checks that all parts of the screen are covered during the transition + */ @Presubmit @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) } } + /** + * Checks that the [LAUNCHER_COMPONENT] layer is never visible during the transition + */ @Presubmit @Test fun launcherLayerNotVisible() { @@ -106,6 +145,12 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) { } companion object { + /** + * Creates the test configurations. + * + * See [FlickerTestParameterFactory.getConfigNonRotationTests] for configuring + * repetitions, screen orientation and navigation modes. + */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection { 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 b7176122095be..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 @@ -16,7 +16,6 @@ package com.android.server.wm.flicker.launch -import android.content.ComponentName import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.Surface @@ -29,7 +28,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.helpers.NonResizeableAppHelper import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import com.google.common.truth.Truth import org.junit.FixMethodOrder import org.junit.Test @@ -61,7 +60,7 @@ import org.junit.runners.Parameterized @Group1 class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { override val testApp = NonResizeableAppHelper(instrumentation) - private val colorFadComponent = ComponentName("", "ColorFade BLAST#") + private val colorFadComponent = FlickerComponentName("", "ColorFade BLAST#") /** * Defines the transition used to run the test @@ -92,15 +91,15 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti * Checks that the nav bar layer starts visible, becomes invisible during unlocking animation * and becomes visible at the end */ - @Presubmit + @Postsubmit @Test fun navBarLayerVisibilityChanges() { testSpec.assertLayers { - this.isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + this.isVisible(FlickerComponentName.NAV_BAR) .then() - .isInvisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + .isInvisible(FlickerComponentName.NAV_BAR) .then() - .isVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + .isVisible(FlickerComponentName.NAV_BAR) } } @@ -133,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) } } @@ -147,7 +145,7 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti @Test fun appWindowBecomesVisibleAtEnd() { testSpec.assertWmEnd { - this.isVisible(testApp.component) + this.isAppWindowVisible(testApp.component) } } @@ -159,11 +157,11 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti @Test fun navBarWindowsVisibilityChanges() { testSpec.assertWm { - this.isAboveAppWindowVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + this.isAboveAppWindowVisible(FlickerComponentName.NAV_BAR) .then() - .isNonAppWindowInvisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + .isNonAppWindowInvisible(FlickerComponentName.NAV_BAR) .then() - .isAboveAppWindowVisible(WindowManagerStateHelper.NAV_BAR_COMPONENT) + .isAboveAppWindowVisible(FlickerComponentName.NAV_BAR) } } @@ -173,6 +171,10 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = super.visibleWindowsShownMoreThanOneConsecutiveEntry() + @FlakyTest + @Test + override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() + /** {@inheritDoc} */ @FlakyTest @Test 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 14d17f82b8052..419d3e88983bc 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 @@ -39,10 +39,12 @@ import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SNAPSHOT_COMPONENT -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SPLASH_SCREEN_COMPONENT +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.Test +/** + * Base class for app launch tests + */ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() protected open val testApp: StandardAppHelper = SimpleAppHelper(instrumentation) @@ -85,7 +87,7 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { } /** - * Checks that the navigation bar layer is visible during the whole transition + * Checks that the navigation bar layer is visible at the start and end of the trace */ open fun navBarLayerIsVisible() { testSpec.navBarLayerIsVisible() @@ -110,7 +112,7 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { } /** - * Checks that the status bar layer is visible during the whole transition + * Checks that the status bar layer is visible at the start and end of the trace */ @Presubmit @Test @@ -188,9 +190,9 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) { testSpec.assertWm { this.isAppWindowOnTop(LAUNCHER_COMPONENT) .then() - .isAppWindowOnTop(SNAPSHOT_COMPONENT, isOptional = true) + .isAppWindowOnTop(FlickerComponentName.SNAPSHOT, isOptional = true) .then() - .isAppWindowOnTop(SPLASH_SCREEN_COMPONENT, isOptional = true) + .isAppWindowOnTop(FlickerComponentName.SPLASH_SCREEN, isOptional = true) .then() .isAppWindowOnTop(testApp.component) } @@ -202,9 +204,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 035aac1c5e86a..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 @@ -39,7 +39,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SNAPSHOT_COMPONENT +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -189,9 +189,9 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet testSpec.assertWm { this.isAppWindowInvisible(testApp1.component) .then() - .isAppWindowVisible(SNAPSHOT_COMPONENT, isOptional = true) + .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) } @@ -251,7 +251,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet // TODO: Do we actually want to test this? Seems too implementation specific... .isAppWindowVisible(LAUNCHER_COMPONENT, isOptional = true) .then() - .isAppWindowVisible(SNAPSHOT_COMPONENT, isOptional = true) + .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true) .then() .isAppWindowVisible(testApp1.component) } @@ -270,7 +270,7 @@ class QuickSwitchBetweenTwoAppsBackTest(private val testSpec: FlickerTestParamet .then() .isVisible(LAUNCHER_COMPONENT, isOptional = true) .then() - .isVisible(SNAPSHOT_COMPONENT, isOptional = true) + .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true) .then() .isVisible(testApp1.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 new file mode 100644 index 0000000000000..d1a3fe43b6daf --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest.kt @@ -0,0 +1,348 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wm.flicker.quickswitch + +import android.app.Instrumentation +import android.platform.test.annotations.Postsubmit +import android.platform.test.annotations.RequiresDevice +import android.view.Surface +import android.view.WindowManagerPolicyConstants +import androidx.test.platform.app.InstrumentationRegistry +import com.android.server.wm.flicker.FlickerBuilderProvider +import com.android.server.wm.flicker.FlickerParametersRunnerFactory +import com.android.server.wm.flicker.FlickerTestParameter +import com.android.server.wm.flicker.FlickerTestParameterFactory +import com.android.server.wm.flicker.LAUNCHER_COMPONENT +import com.android.server.wm.flicker.annotation.Group1 +import com.android.server.wm.flicker.dsl.FlickerBuilder +import com.android.server.wm.flicker.helpers.NonResizeableAppHelper +import com.android.server.wm.flicker.helpers.SimpleAppHelper +import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.flicker.helpers.isRotated +import com.android.server.wm.flicker.navBarLayerIsVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsVisible +import com.android.server.wm.flicker.repetitions +import com.android.server.wm.flicker.startRotation +import com.android.server.wm.flicker.statusBarLayerIsVisible +import com.android.server.wm.flicker.statusBarWindowIsVisible +import com.android.server.wm.traces.common.FlickerComponentName +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test quick switching back to previous app from last opened app + * + * To run this test: `atest FlickerTests:QuickSwitchBetweenTwoAppsBackTest` + * + * Actions: + * Launch an app [testApp1] + * Launch another app [testApp2] + * Swipe right from the bottom of the screen to quick switch back to the first app [testApp1] + * Swipe left from the bottom of the screen to quick switch forward to the second app [testApp2] + */ +@RequiresDevice +@RunWith(Parameterized::class) +@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@Group1 +class QuickSwitchBetweenTwoAppsForwardTest(private val testSpec: FlickerTestParameter) { + private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() + + private val testApp1 = SimpleAppHelper(instrumentation) + private val testApp2 = NonResizeableAppHelper(instrumentation) + + private val startDisplayBounds = WindowUtils.getDisplayBounds(testSpec.config.startRotation) + + @FlickerBuilderProvider + fun buildFlicker(): FlickerBuilder { + return FlickerBuilder(instrumentation).apply { + withTestName { testSpec.name } + repeat { testSpec.config.repetitions } + setup { + eachRun { + testApp1.launchViaIntent(wmHelper) + wmHelper.waitForFullScreenApp(testApp1.component) + + testApp2.launchViaIntent(wmHelper) + wmHelper.waitForFullScreenApp(testApp2.component) + + // Swipe right from bottom to quick switch back + // NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle + // as to not accidentally trigger a swipe back or forward action which would result + // in the same behavior but not testing quick swap. + device.swipe( + startDisplayBounds.bounds.right / 3, + startDisplayBounds.bounds.bottom, + 2 * startDisplayBounds.bounds.right / 3, + startDisplayBounds.bounds.bottom, + if (testSpec.config.startRotation.isRotated()) 75 else 30 + ) + + wmHelper.waitForFullScreenApp(testApp1.component) + wmHelper.waitForAppTransitionIdle() + } + } + transitions { + // Swipe left from bottom to quick switch forward + // NOTE: We don't perform an edge-to-edge swipe but instead only swipe in the middle + // as to not accidentally trigger a swipe back or forward action which would result + // in the same behavior but not testing quick swap. + device.swipe( + 2 * startDisplayBounds.bounds.right / 3, + startDisplayBounds.bounds.bottom, + startDisplayBounds.bounds.right / 3, + startDisplayBounds.bounds.bottom, + if (testSpec.config.startRotation.isRotated()) 75 else 30 + ) + + wmHelper.waitForFullScreenApp(testApp2.component) + wmHelper.waitForAppTransitionIdle() + } + + teardown { + test { + testApp1.exit() + testApp2.exit() + } + } + } + } + + /** + * Checks that the transition starts with [testApp1]'s windows filling/covering exactly the + * entirety of the display. + */ + @Postsubmit + @Test + fun startsWithApp1WindowsCoverFullScreen() { + testSpec.assertWmStart { + this.frameRegion(testApp1.component).coversExactly(startDisplayBounds) + } + } + + /** + * Checks that the transition starts with [testApp1]'s layers filling/covering exactly the + * entirety of the display. + */ + @Postsubmit + @Test + fun startsWithApp1LayersCoverFullScreen() { + testSpec.assertLayersStart { + this.visibleRegion(testApp1.component).coversExactly(startDisplayBounds) + } + } + + /** + * Checks that the transition starts with [testApp1] being the top window. + */ + @Postsubmit + @Test + fun startsWithApp1WindowBeingOnTop() { + testSpec.assertWmStart { + this.isAppWindowOnTop(testApp1.component) + } + } + + /** + * Checks that [testApp2] windows fill the entire screen (i.e. is "fullscreen") at the end of the + * transition once we have fully quick switched from [testApp1] back to the [testApp2]. + */ + @Postsubmit + @Test + fun endsWithApp2WindowsCoveringFullScreen() { + testSpec.assertWmEnd { + this.frameRegion(testApp2.component).coversExactly(startDisplayBounds) + } + } + + /** + * Checks that [testApp2] layers fill the entire screen (i.e. is "fullscreen") at the end of the + * transition once we have fully quick switched from [testApp1] back to the [testApp2]. + */ + @Postsubmit + @Test + fun endsWithApp2LayersCoveringFullScreen() { + testSpec.assertLayersEnd { + this.visibleRegion(testApp2.component).coversExactly(startDisplayBounds) + } + } + + /** + * Checks that [testApp2] is the top window at the end of the transition once we have fully quick + * switched from [testApp1] back to the [testApp2]. + */ + @Postsubmit + @Test + fun endsWithApp2BeingOnTop() { + testSpec.assertWmEnd { + this.isAppWindowOnTop(testApp2.component) + } + } + + /** + * Checks that [testApp2]'s window starts off invisible and becomes visible at some point before + * the end of the transition and then stays visible until the end of the transition. + */ + @Postsubmit + @Test + fun app2WindowBecomesAndStaysVisible() { + testSpec.assertWm { + this.isAppWindowInvisible(testApp2.component) + .then() + .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true) + .then() + .isAppWindowVisible(testApp2.component) + } + } + + /** + * Checks that [testApp2]'s layer starts off invisible and becomes visible at some point before + * the end of the transition and then stays visible until the end of the transition. + */ + @Postsubmit + @Test + fun app2LayerBecomesAndStaysVisible() { + testSpec.assertLayers { + this.isInvisible(testApp2.component) + .then() + .isVisible(testApp2.component) + } + } + + /** + * Checks that [testApp1]'s window starts off visible and becomes invisible at some point before + * the end of the transition and then stays invisible until the end of the transition. + */ + @Postsubmit + @Test + fun app1WindowBecomesAndStaysInvisible() { + testSpec.assertWm { + this.isAppWindowVisible(testApp1.component) + .then() + .isAppWindowInvisible(testApp1.component) + } + } + + /** + * Checks that [testApp1]'s layer starts off visible and becomes invisible at some point before + * the end of the transition and then stays invisible until the end of the transition. + */ + @Postsubmit + @Test + fun app1LayerBecomesAndStaysInvisible() { + testSpec.assertLayers { + this.isVisible(testApp1.component) + .then() + .isInvisible(testApp1.component) + } + } + + /** + * Checks that [testApp1]'s window is visible at least until [testApp2]'s window is visible. + * Ensures that at any point, either [testApp2] or [testApp1]'s windows are at least partially + * visible. + */ + @Postsubmit + @Test + fun app2WindowIsVisibleOnceApp1WindowIsInvisible() { + testSpec.assertWm { + this.isAppWindowVisible(testApp1.component) + .then() + .isAppWindowVisible(LAUNCHER_COMPONENT, isOptional = true) + .then() + .isAppWindowVisible(FlickerComponentName.SNAPSHOT, isOptional = true) + .then() + .isAppWindowVisible(testApp2.component) + } + } + + /** + * Checks that [testApp1]'s layer is visible at least until [testApp2]'s window is visible. + * Ensures that at any point, either [testApp2] or [testApp1]'s windows are at least partially + * visible. + */ + @Postsubmit + @Test + fun app2LayerIsVisibleOnceApp1LayerIsInvisible() { + testSpec.assertLayers { + this.isVisible(testApp1.component) + .then() + .isVisible(LAUNCHER_COMPONENT, isOptional = true) + .then() + .isVisible(FlickerComponentName.SNAPSHOT, isOptional = true) + .then() + .isVisible(testApp2.component) + } + } + + /** + * Checks that the navbar window is visible throughout the entire transition. + */ + @Postsubmit + @Test + fun navBarWindowIsAlwaysVisible() = testSpec.navBarWindowIsVisible() + + /** + * Checks that the navbar layer is visible throughout the entire transition. + */ + @Postsubmit + @Test + fun navBarLayerAlwaysIsVisible() = testSpec.navBarLayerIsVisible() + + /** + * Checks that the navbar is always in the right position and covers the expected region. + * + * NOTE: This doesn't check that the navbar is visible or not. + */ + @Postsubmit + @Test + fun navbarIsAlwaysInRightPosition() = + testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation) + + /** + * Checks that the status bar window is visible throughout the entire transition. + */ + @Postsubmit + @Test + fun statusBarWindowIsAlwaysVisible() = testSpec.statusBarWindowIsVisible() + + /** + * Checks that the status bar layer is visible throughout the entire transition. + */ + @Postsubmit + @Test + fun statusBarLayerIsAlwaysVisible() = testSpec.statusBarLayerIsVisible() + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection { + return FlickerTestParameterFactory.getInstance() + .getConfigNonRotationTests( + repetitions = 5, + supportedNavigationModes = listOf( + WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY + ), + supportedRotations = listOf(Surface.ROTATION_0, Surface.ROTATION_90) + ) + } + } +} \ No newline at end of file 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 ca8f8af2df949..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 @@ -27,7 +27,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.LAUNCHER_COMPONENT -import com.android.server.wm.flicker.annotation.Group1 +import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.helpers.SimpleAppHelper @@ -38,7 +38,7 @@ import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.SNAPSHOT_COMPONENT +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -60,7 +60,7 @@ import org.junit.runners.Parameterized @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -@Group1 +@Group4 class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val testApp = SimpleAppHelper(instrumentation) @@ -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,9 +260,9 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { @Test fun appWindowIsVisibleOnceLauncherWindowIsInvisible() { testSpec.assertWm { - this.isAppWindowVisible(LAUNCHER_COMPONENT) + this.isAppWindowOnTop(LAUNCHER_COMPONENT) .then() - .isAppWindowVisible(SNAPSHOT_COMPONENT) + .isAppWindowVisible(FlickerComponentName.SNAPSHOT) .then() .isAppWindowVisible(testApp.component) } @@ -278,7 +278,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) { testSpec.assertLayers { this.isVisible(LAUNCHER_COMPONENT) .then() - .isVisible(SNAPSHOT_COMPONENT) + .isVisible(FlickerComponentName.SNAPSHOT) .then() .isVisible(testApp.component) } 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 d57c6698e35c8..878821a80d0ed 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 @@ -30,7 +30,7 @@ import com.android.server.wm.flicker.startRotation import com.android.server.wm.flicker.statusBarLayerIsVisible import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.statusBarWindowIsVisible -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper.Companion.ROTATION_COMPONENT +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -38,8 +38,39 @@ import org.junit.runners.MethodSorters import org.junit.runners.Parameterized /** - * Cycle through supported app rotations. + * Test opening an app and cycling through app rotations + * + * Currently runs: + * 0 -> 90 degrees + * 90 -> 0 degrees + * + * Actions: + * Launch an app (via intent) + * Set initial device orientation + * Start tracing + * Change device orientation + * Stop tracing + * * To run this test: `atest FlickerTests:ChangeAppRotationTest` + * + * To run only the presubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit` + * + * To run only the postsubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit` + * + * To run only the flaky assertions add: `-- + * --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest` + * + * Notes: + * 1. Some default assertions (e.g., nav bar, status bar and screen covered) + * are inherited [RotationTransition] + * 2. Part of the test setup occurs automatically via + * [com.android.server.wm.flicker.TransitionRunnerWithRules], + * including configuring navigation mode, initial orientation and ensuring no + * apps are running before setup */ @RequiresDevice @RunWith(Parameterized::class) @@ -60,36 +91,51 @@ class ChangeAppRotationTest( } } + /** {@inheritDoc} */ @FlakyTest(bugId = 190185577) @Test override fun focusDoesNotChange() { super.focusDoesNotChange() } + /** + * Checks that the [FlickerComponentName.ROTATION] layer appears during the transition, + * doesn't flicker, and disappears before the transition is complete + */ @Presubmit @Test - fun screenshotLayerBecomesInvisible() { + fun rotationLayerAppearsAndVanishes() { testSpec.assertLayers { this.isVisible(testApp.component) .then() - .isVisible(ROTATION_COMPONENT) + .isVisible(FlickerComponentName.ROTATION) .then() .isVisible(testApp.component) } } + /** + * Checks that the status bar window is visible and above the app windows in all WM + * trace entries + */ @Presubmit @Test fun statusBarWindowIsVisible() { testSpec.statusBarWindowIsVisible() } + /** + * Checks that the status bar layer is visible at the start and end of the transition + */ @Presubmit @Test fun statusBarLayerIsVisible() { testSpec.statusBarLayerIsVisible() } + /** + * Checks the position of the status bar at the start and end of the transition + */ @Presubmit @Test fun statusBarLayerRotatesScales() { @@ -97,13 +143,26 @@ class ChangeAppRotationTest( testSpec.config.startRotation, testSpec.config.endRotation) } + /** {@inheritDoc} */ @FlakyTest @Test override fun navBarLayerRotatesAndScales() { super.navBarLayerRotatesAndScales() } + /** {@inheritDoc} */ + @FlakyTest + @Test + override fun visibleLayersShownMoreThanOneConsecutiveEntry() = + super.visibleLayersShownMoreThanOneConsecutiveEntry() + companion object { + /** + * Creates the test configurations. + * + * See [FlickerTestParameterFactory.getConfigRotationTests] for configuring + * repetitions, screen orientation and navigation modes. + */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection { 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 612ff9d3a1536..2b03396c62964 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.content.ComponentName import android.platform.test.annotations.Presubmit import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.FlickerBuilderProvider @@ -31,9 +30,12 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales import com.android.server.wm.flicker.navBarWindowIsVisible import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.startRotation -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.Test +/** + * Base class for app rotation tests + */ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) { protected abstract val testApp: StandardAppHelper @@ -55,6 +57,10 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Entry point for the test runner. It will use this method to initialize and cache + * flicker executions + */ @FlickerBuilderProvider fun buildFlicker(): FlickerBuilder { return FlickerBuilder(instrumentation).apply { @@ -62,18 +68,28 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that the navigation bar window is visible and above the app windows in all WM + * trace entries + */ @Presubmit @Test open fun navBarWindowIsVisible() { testSpec.navBarWindowIsVisible() } + /** + * Checks that the navigation bar layer is visible at the start and end of the transition + */ @Presubmit @Test open fun navBarLayerIsVisible() { testSpec.navBarLayerIsVisible() } + /** + * Checks the position of the navigation bar at the start and end of the transition + */ @Presubmit @Test open fun navBarLayerRotatesAndScales() { @@ -81,19 +97,27 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) testSpec.config.startRotation, testSpec.config.endRotation) } + /** + * Checks that all layers that are visible on the trace, are visible for at least 2 + * consecutive entries. + */ @Presubmit @Test open fun visibleLayersShownMoreThanOneConsecutiveEntry() { testSpec.assertLayers { this.visibleLayersShownMoreThanOneConsecutiveEntry( - ignoreLayers = listOf(WindowManagerStateHelper.SPLASH_SCREEN_COMPONENT, - WindowManagerStateHelper.SNAPSHOT_COMPONENT, - ComponentName("", "SecondaryHomeHandle") + ignoreLayers = listOf(FlickerComponentName.SPLASH_SCREEN, + FlickerComponentName.SNAPSHOT, + FlickerComponentName("", "SecondaryHomeHandle") ) ) } } + /** + * Checks that all windows that are visible on the trace, are visible for at least 2 + * consecutive entries. + */ @Presubmit @Test open fun visibleWindowsShownMoreThanOneConsecutiveEntry() { @@ -102,10 +126,16 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that all parts of the screen are covered during the transition + */ @Presubmit @Test open fun entireScreenCovered() = testSpec.entireScreenCovered() + /** + * Checks that the focus doesn't change during animation + */ @Presubmit @Test open fun focusDoesNotChange() { @@ -114,6 +144,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that [testApp] layer covers the entire screen at the start of the transition + */ @Presubmit @Test open fun appLayerRotates_StartingPos() { @@ -124,6 +157,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter) } } + /** + * Checks that [testApp] layer covers the entire screen at the end of the transition + */ @Presubmit @Test open fun appLayerRotates_EndingPos() { 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 48efe73312c36..310f04b9710fc 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 @@ -27,7 +27,7 @@ import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SeamlessRotationAppHelper import com.android.server.wm.flicker.testapp.ActivityOptions -import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper +import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -35,8 +35,41 @@ import org.junit.runners.MethodSorters import org.junit.runners.Parameterized /** - * Cycle through supported app rotations using seamless rotations. + * Test opening an app and cycling through app rotations using seamless rotations + * + * Currently runs: + * 0 -> 90 degrees + * 0 -> 90 degrees (with starved UI thread) + * 90 -> 0 degrees + * 90 -> 0 degrees (with starved UI thread) + * + * Actions: + * Launch an app in fullscreen and supporting seamless rotation (via intent) + * Set initial device orientation + * Start tracing + * Change device orientation + * Stop tracing + * * To run this test: `atest FlickerTests:SeamlessAppRotationTest` + * + * To run only the presubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Presubmit` + * + * To run only the postsubmit assertions add: `-- + * --module-arg FlickerTests:exclude-annotation:androidx.test.filters.FlakyTest + * --module-arg FlickerTests:include-annotation:android.platform.test.annotations.Postsubmit` + * + * To run only the flaky assertions add: `-- + * --module-arg FlickerTests:include-annotation:androidx.test.filters.FlakyTest` + * + * Notes: + * 1. Some default assertions (e.g., nav bar, status bar and screen covered) + * are inherited [RotationTransition] + * 2. Part of the test setup occurs automatically via + * [com.android.server.wm.flicker.TransitionRunnerWithRules], + * including configuring navigation mode, initial orientation and ensuring no + * apps are running before setup */ @RequiresDevice @RunWith(Parameterized::class) @@ -61,6 +94,9 @@ class SeamlessAppRotationTest( } } + /** + * Checks that [testApp] window is always in full screen + */ @Presubmit @Test fun appWindowFullScreen() { @@ -75,6 +111,9 @@ class SeamlessAppRotationTest( } } + /** + * Checks that [testApp] window is always with seamless rotation + */ @Presubmit @Test fun appWindowSeamlessRotation() { @@ -90,6 +129,9 @@ class SeamlessAppRotationTest( } } + /** + * Checks that [testApp] window is always visible + */ @Presubmit @Test fun appLayerAlwaysVisible() { @@ -98,6 +140,9 @@ class SeamlessAppRotationTest( } } + /** + * Checks that [testApp] layer covers the entire screen during the whole transition + */ @Presubmit @Test fun appLayerRotates() { @@ -110,29 +155,36 @@ class SeamlessAppRotationTest( } } + /** + * Checks that the [FlickerComponentName.STATUS_BAR] window is invisible during the whole + * transition + */ @Presubmit @Test fun statusBarWindowIsAlwaysInvisible() { testSpec.assertWm { - this.isAboveAppWindowInvisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + this.isAboveAppWindowInvisible(FlickerComponentName.STATUS_BAR) } } + /** + * Checks that the [FlickerComponentName.STATUS_BAR] layer is invisible during the whole + * transition + */ @Presubmit @Test fun statusBarLayerIsAlwaysInvisible() { testSpec.assertLayers { - this.isInvisible(WindowManagerStateHelper.STATUS_BAR_COMPONENT) + this.isInvisible(FlickerComponentName.STATUS_BAR) } } + /** {@inheritDoc} */ @FlakyTest @Test override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() companion object { - private val testFactory = FlickerTestParameterFactory.getInstance() - private val Map.starveUiThread get() = this.getOrDefault(ActivityOptions.EXTRA_STARVE_UI_THREAD, false) as Boolean @@ -144,20 +196,34 @@ class SeamlessAppRotationTest( return config } + /** + * Creates the test configurations for seamless rotation based on the default rotation + * tests from [FlickerTestParameterFactory.getConfigRotationTests], but adding an + * additional flag ([ActivityOptions.EXTRA_STARVE_UI_THREAD]) to indicate if the app + * should starve the UI thread of not + */ @JvmStatic private fun getConfigurations(): List { - return testFactory.getConfigRotationTests(repetitions = 2).flatMap { - val defaultRun = it.createConfig(starveUiThread = false) - val busyUiRun = it.createConfig(starveUiThread = true) - listOf( - FlickerTestParameter(defaultRun), - FlickerTestParameter(busyUiRun, - name = "${FlickerTestParameter.defaultName(busyUiRun)}_BUSY_UI_THREAD" + return FlickerTestParameterFactory.getInstance() + .getConfigRotationTests(repetitions = 2) + .flatMap { + val defaultRun = it.createConfig(starveUiThread = false) + val busyUiRun = it.createConfig(starveUiThread = true) + listOf( + FlickerTestParameter(defaultRun), + FlickerTestParameter(busyUiRun, + name = "${FlickerTestParameter.defaultName(busyUiRun)}_BUSY_UI_THREAD" + ) ) - ) - } + } } + /** + * Creates the test configurations. + * + * See [FlickerTestParameterFactory.getConfigRotationTests] for configuring + * repetitions, screen orientation and navigation modes. + */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection { From 865a06b23681ac439d1a0b6aab0b885cfe91e450 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Wed, 1 Sep 2021 15:24:32 +0000 Subject: [PATCH 2/5] [DO NOT MERGE] Expose SurfaceControl's native mLayerId property to Java Expose the layerId so that we can dump it in WindowManager proto traces. This is to allow us to link windows to their respective layer accurately and consistently from the trace data. This enables Flicker as a Service (go/wm-fass) to tag and assocaite animations across the WindowManager trace and SurfaceFlinger trace and allows us to better display and associate errors across both WM and SF hierarchy views in Winscope. Test: N/A Bug: 197712697 Change-Id: Ic11f33b8dc3e134d6c19ac68bfe03f801af04d06 (cherry picked from commit 9e98140a17e2e76a177112d993e307396f028a2c) --- core/java/android/view/SurfaceControl.java | 14 ++++++++++++-- core/jni/android_view_SurfaceControl.cpp | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 5b8dc4055509f..1121133892051 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -242,6 +242,7 @@ public final class SurfaceControl implements Parcelable { private static native int nativeGetGPUContextPriority(); private static native void nativeSetTransformHint(long nativeObject, int transformHint); private static native int nativeGetTransformHint(long nativeObject); + private static native int nativeGetLayerId(long nativeObject); @Nullable @GuardedBy("mLock") @@ -357,8 +358,6 @@ public final class SurfaceControl implements Parcelable { @GuardedBy("mLock") private int mHeight; - private int mTransformHint; - private WeakReference mLocalOwnerView; static GlobalTransactionWrapper sGlobalTransaction; @@ -3675,4 +3674,15 @@ public final class SurfaceControl implements Parcelable { public void setTransformHint(@Surface.Rotation int transformHint) { nativeSetTransformHint(mNativeObject, transformHint); } + + /** + * @hide + */ + public int getLayerId() { + if (mNativeObject != 0) { + return nativeGetLayerId(mNativeObject); + } + + return -1; + } } diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 5ce43df538199..65ff7c7f5a0fd 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -1827,6 +1827,12 @@ static jint nativeGetTransformHint(JNIEnv* env, jclass clazz, jlong nativeSurfac return toRotationInt(ui::Transform::toRotation((transformHintRotationFlags))); } +static jint nativeGetLayerId(JNIEnv* env, jclass clazz, jlong nativeSurfaceControl) { + sp surface(reinterpret_cast(nativeSurfaceControl)); + + return surface->getLayerId(); +} + // ---------------------------------------------------------------------------- static const JNINativeMethod sSurfaceControlMethods[] = { @@ -2026,6 +2032,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetTrustedOverlay }, {"nativeSetDropInputMode", "(JJI)V", (void*)nativeSetDropInputMode }, + {"nativeGetLayerId", "(J)I", + (void*)nativeGetLayerId }, // clang-format on }; From fd48767da7d26c07b595286b82f6731029a80c9a Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Wed, 1 Sep 2021 15:26:50 +0000 Subject: [PATCH 3/5] [DO NOT MERGE] Dump WindowContainer SurfaceControls to proto Test: Data appears in Winscope Bug: 197712697 Change-Id: I5a2704f4e910529d81698768a6e657e4f823d829 (cherry picked from commit afaa2fedf06b1ceb864699df6b936ec76e585a8e) --- core/proto/android/server/windowmanagerservice.proto | 1 + services/core/java/com/android/server/wm/WindowContainer.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index 0121bff3e7ef0..4af9d75682bbd 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -480,6 +480,7 @@ message WindowContainerProto { optional SurfaceAnimatorProto surface_animator = 4; repeated WindowContainerChildProto children = 5; optional IdentifierProto identifier = 6; + optional .android.view.SurfaceControlProto surface_control = 7; } /* represents a generic child of a WindowContainer */ diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 2a8fa1086799e..fe3e560acb9c3 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -57,6 +57,7 @@ import static com.android.server.wm.WindowContainerProto.CONFIGURATION_CONTAINER import static com.android.server.wm.WindowContainerProto.IDENTIFIER; import static com.android.server.wm.WindowContainerProto.ORIENTATION; import static com.android.server.wm.WindowContainerProto.SURFACE_ANIMATOR; +import static com.android.server.wm.WindowContainerProto.SURFACE_CONTROL; import static com.android.server.wm.WindowContainerProto.VISIBLE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; @@ -2428,6 +2429,9 @@ class WindowContainer extends ConfigurationContainer< if (mSurfaceAnimator.isAnimating()) { mSurfaceAnimator.dumpDebug(proto, SURFACE_ANIMATOR); } + if (mSurfaceControl != null) { + mSurfaceControl.dumpDebug(proto, SURFACE_CONTROL); + } // add children to proto for (int i = 0; i < getChildCount(); i++) { From b88b5349d6c97b386cd9f45f19bf3d4be4887735 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Wed, 1 Sep 2021 15:25:42 +0000 Subject: [PATCH 4/5] [DO NOT MERGE] Dump SurfaceControl's layerId to proto Test: Data appears in Winscope Bug: 197712697 Change-Id: Ida47f5506a56b19902fcaafc644d1df34ce6c4a3 (cherry picked from commit 120ee45bd05755f5325ba33b706f2c1e431122dc) --- core/java/android/view/SurfaceControl.java | 2 ++ core/proto/android/view/surfacecontrol.proto | 1 + 2 files changed, 3 insertions(+) diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 1121133892051..c786f0f3cc680 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -23,6 +23,7 @@ import static android.graphics.Matrix.MSKEW_Y; import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_Y; import static android.view.SurfaceControlProto.HASH_CODE; +import static android.view.SurfaceControlProto.LAYER_ID; import static android.view.SurfaceControlProto.NAME; import android.annotation.FloatRange; @@ -1540,6 +1541,7 @@ public final class SurfaceControl implements Parcelable { final long token = proto.start(fieldId); proto.write(HASH_CODE, System.identityHashCode(this)); proto.write(NAME, mName); + proto.write(LAYER_ID, getLayerId()); proto.end(token); } diff --git a/core/proto/android/view/surfacecontrol.proto b/core/proto/android/view/surfacecontrol.proto index cbb243ba7872f..5a5f035412b2c 100644 --- a/core/proto/android/view/surfacecontrol.proto +++ b/core/proto/android/view/surfacecontrol.proto @@ -29,4 +29,5 @@ message SurfaceControlProto { optional int32 hash_code = 1; optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; + optional int32 layerId = 3; } From 732fa80c97b822cea1fcf957da303d1069a7f030 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Fri, 10 Sep 2021 00:17:49 +0000 Subject: [PATCH 5/5] [DO NOT MERGE] Dump windowing mode in Winscope traces To be used by Fass in Winscope to automatically detect pip transitions Bug: 183993924 Test: Existing tests Change-Id: I066982c9de104acd307b8b016bce167ae9765ac8 (cherry picked from commit 786fe1e12866513dedef9340e0f2319ec890dfc5) --- .../server/wm/ConfigurationContainer.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java index eeb85c585876d..5a2cf17ffd183 100644 --- a/services/core/java/com/android/server/wm/ConfigurationContainer.java +++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java @@ -28,6 +28,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMAR import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.app.WindowConfiguration.activityTypeToString; import static android.app.WindowConfiguration.windowingModeToString; +import static android.app.WindowConfigurationProto.WINDOWING_MODE; +import static android.content.ConfigurationProto.WINDOW_CONFIGURATION; import static com.android.server.wm.ConfigurationContainerProto.FULL_CONFIGURATION; import static com.android.server.wm.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION; @@ -695,22 +697,40 @@ public abstract class ConfigurationContainer { @CallSuper protected void dumpDebug(ProtoOutputStream proto, long fieldId, @WindowTraceLogLevel int logLevel) { - // Critical log level logs only visible elements to mitigate performance overheard - if (logLevel != WindowTraceLogLevel.ALL && !mHasOverrideConfiguration) { - return; + final long token = proto.start(fieldId); + + if (logLevel == WindowTraceLogLevel.ALL || mHasOverrideConfiguration) { + mRequestedOverrideConfiguration.dumpDebug(proto, OVERRIDE_CONFIGURATION, + logLevel == WindowTraceLogLevel.CRITICAL); } - final long token = proto.start(fieldId); - mRequestedOverrideConfiguration.dumpDebug(proto, OVERRIDE_CONFIGURATION, - logLevel == WindowTraceLogLevel.CRITICAL); + // Unless trace level is set to `WindowTraceLogLevel.ALL` don't dump anything that isn't + // required to mitigate performance overhead if (logLevel == WindowTraceLogLevel.ALL) { mFullConfiguration.dumpDebug(proto, FULL_CONFIGURATION, false /* critical */); mMergedOverrideConfiguration.dumpDebug(proto, MERGED_OVERRIDE_CONFIGURATION, false /* critical */); } + + if (logLevel == WindowTraceLogLevel.TRIM) { + // Required for Fass to automatically detect pip transitions in Winscope traces + dumpDebugWindowingMode(proto); + } + proto.end(token); } + private void dumpDebugWindowingMode(ProtoOutputStream proto) { + final long fullConfigToken = proto.start(FULL_CONFIGURATION); + final long windowConfigToken = proto.start(WINDOW_CONFIGURATION); + + int windowingMode = mFullConfiguration.windowConfiguration.getWindowingMode(); + proto.write(WINDOWING_MODE, windowingMode); + + proto.end(windowConfigToken); + proto.end(fullConfigToken); + } + /** * Dumps the names of this container children in the input print writer indenting each * level with the input prefix.