diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/OpenAppInSizeCompatModeTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/OpenAppInSizeCompatModeTest.kt index 67d5718e6c1ff..1e5e42fb077e6 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/OpenAppInSizeCompatModeTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/OpenAppInSizeCompatModeTest.kt @@ -66,7 +66,8 @@ class OpenAppInSizeCompatModeTest(flicker: LegacyFlickerTest) : BaseAppCompat(fl */ @Postsubmit @Test - fun letterboxAppFocusedAtEnd() = flicker.assertEventLog { focusChanges(letterboxApp.`package`) } + fun letterboxAppFocusedAtEnd() = + flicker.assertEventLog { focusChanges(letterboxApp.packageName) } @Postsubmit @Test diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/BaseBubbleScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/BaseBubbleScreen.kt index 5c7d1d8df2e82..97147a3e16720 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/BaseBubbleScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/BaseBubbleScreen.kt @@ -47,7 +47,7 @@ abstract class BaseBubbleScreen(flicker: LegacyFlickerTest) : BaseTest(flicker) private val uid = context.packageManager - .getApplicationInfo(testApp.`package`, PackageManager.ApplicationInfoFlags.of(0)) + .getApplicationInfo(testApp.packageName, PackageManager.ApplicationInfoFlags.of(0)) .uid @JvmOverloads @@ -57,7 +57,7 @@ abstract class BaseBubbleScreen(flicker: LegacyFlickerTest) : BaseTest(flicker) return { setup { notifyManager.setBubblesAllowed( - testApp.`package`, + testApp.packageName, uid, NotificationManager.BUBBLE_PREFERENCE_ALL ) @@ -68,7 +68,7 @@ abstract class BaseBubbleScreen(flicker: LegacyFlickerTest) : BaseTest(flicker) teardown { notifyManager.setBubblesAllowed( - testApp.`package`, + testApp.packageName, uid, NotificationManager.BUBBLE_PREFERENCE_NONE ) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTransition.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTransition.kt index 6d20740e239c4..dfa369653caf3 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTransition.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTransition.kt @@ -117,7 +117,7 @@ abstract class EnterPipTransition(flicker: LegacyFlickerTest) : PipTransition(fl @Presubmit @Test open fun focusChanges() { - flicker.assertEventLog { this.focusChanges(pipApp.`package`, "NexusLauncherActivity") } + flicker.assertEventLog { this.focusChanges(pipApp.packageName, "NexusLauncherActivity") } } companion object { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/tv/PipAppHelperTv.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/tv/PipAppHelperTv.kt index 000ae8f9458e2..c6cbcd052fe08 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/tv/PipAppHelperTv.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/tv/PipAppHelperTv.kt @@ -26,7 +26,7 @@ import com.android.server.wm.flicker.helpers.PipAppHelper /** Helper class for PIP app on AndroidTV */ open class PipAppHelperTv(instrumentation: Instrumentation) : PipAppHelper(instrumentation) { - private val appSelector = By.pkg(`package`).depth(0) + private val appSelector = By.pkg(packageName).depth(0) val ui: UiObject2? get() = uiDevice.findObject(appSelector) @@ -46,7 +46,7 @@ open class PipAppHelperTv(instrumentation: Instrumentation) : PipAppHelper(instr } override fun clickObject(resId: String) { - val selector = By.res(`package`, resId) + val selector = By.res(packageName, resId) focusOnObject(selector) || error("Could not focus on `$resId` object") uiDevice.pressDPadCenter() } @@ -68,7 +68,7 @@ open class PipAppHelperTv(instrumentation: Instrumentation) : PipAppHelper(instr } fun waitUntilClosed(): Boolean { - val appSelector = By.pkg(`package`).depth(0) + val appSelector = By.pkg(packageName).depth(0) return uiDevice.wait(Until.gone(appSelector), APP_CLOSE_WAIT_TIME_MS) } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromAllApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromAllApps.kt index a3aae85568c01..9b438163daa81 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromAllApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromAllApps.kt @@ -61,7 +61,7 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { tapl.launchedAppState.taskbar .openAllApps() .getAppIcon(secondaryApp.appName) - .dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`) + .dragToSplitscreen(secondaryApp.packageName, primaryApp.packageName) SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp) } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromShortcut.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromShortcut.kt index 5d67dc7e231ba..76fbf60897ca8 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromShortcut.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromShortcut.kt @@ -63,7 +63,7 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { .getAppIcon(secondaryApp.appName) .openDeepShortcutMenu() .getMenuItem("Split Screen Secondary Activity") - .dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`) + .dragToSplitscreen(secondaryApp.packageName, primaryApp.packageName) SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp) // TODO: Do we want this check in here? Add to the other tests? diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromTaskbar.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromTaskbar.kt index ae5bb68818636..f8e43f1207e2e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromTaskbar.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/service/splitscreen/scenarios/EnterSplitScreenByDragFromTaskbar.kt @@ -61,7 +61,7 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { open fun enterSplitScreenByDragFromTaskbar() { tapl.launchedAppState.taskbar .getAppIcon(secondaryApp.appName) - .dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`) + .dragToSplitscreen(secondaryApp.packageName, primaryApp.packageName) SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp) } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromAllAppsBenchmark.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromAllAppsBenchmark.kt index 80ccaa144c588..394864ad9d4dd 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromAllAppsBenchmark.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromAllAppsBenchmark.kt @@ -47,7 +47,7 @@ abstract class EnterSplitScreenByDragFromAllAppsBenchmark(override val flicker: tapl.launchedAppState.taskbar .openAllApps() .getAppIcon(secondaryApp.appName) - .dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`) + .dragToSplitscreen(secondaryApp.packageName, primaryApp.packageName) SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromShortcutBenchmark.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromShortcutBenchmark.kt index a06ae6bc63a1f..3b3be84f98413 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromShortcutBenchmark.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromShortcutBenchmark.kt @@ -53,7 +53,7 @@ abstract class EnterSplitScreenByDragFromShortcutBenchmark( .getAppIcon(secondaryApp.appName) .openDeepShortcutMenu() .getMenuItem("Split Screen Secondary Activity") - .dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`) + .dragToSplitscreen(secondaryApp.packageName, primaryApp.packageName) SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromTaskbarBenchmark.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromTaskbarBenchmark.kt index de4ec6d126572..eff355987cc09 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromTaskbarBenchmark.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/benchmark/EnterSplitScreenByDragFromTaskbarBenchmark.kt @@ -46,7 +46,7 @@ abstract class EnterSplitScreenByDragFromTaskbarBenchmark(override val flicker: transitions { tapl.launchedAppState.taskbar .getAppIcon(secondaryApp.appName) - .dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`) + .dragToSplitscreen(secondaryApp.packageName, primaryApp.packageName) SplitScreenUtils.waitForSplitComplete(wmHelper, primaryApp, secondaryApp) } } 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 1a77785150742..4032121d4211c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -170,9 +170,7 @@ fun LegacyFlickerTest.statusBarLayerIsVisibleAtStartAndEnd() { * the SF trace */ fun LegacyFlickerTest.navBarLayerPositionAtStart() { - assertLayersStart { - assertNavBarPosition(this, scenario.isGesturalNavigation) - } + assertLayersStart { assertNavBarPosition(this, scenario.isGesturalNavigation) } } /** @@ -180,9 +178,7 @@ fun LegacyFlickerTest.navBarLayerPositionAtStart() { * the SF trace */ fun LegacyFlickerTest.navBarLayerPositionAtEnd() { - assertLayersEnd { - assertNavBarPosition(this, scenario.isGesturalNavigation) - } + assertLayersEnd { assertNavBarPosition(this, scenario.isGesturalNavigation) } } private fun assertNavBarPosition(sfState: LayerTraceEntrySubject, isGesturalNavigation: Boolean) { @@ -195,19 +191,23 @@ private fun assertNavBarPosition(sfState: LayerTraceEntrySubject, isGesturalNavi when (navBarPosition) { Position.TOP -> - navBarRegion.hasSameTopPosition(displayArea) + navBarRegion + .hasSameTopPosition(displayArea) .hasSameLeftPosition(displayArea) .hasSameRightPosition(displayArea) Position.BOTTOM -> - navBarRegion.hasSameBottomPosition(displayArea) + navBarRegion + .hasSameBottomPosition(displayArea) .hasSameLeftPosition(displayArea) .hasSameRightPosition(displayArea) Position.LEFT -> - navBarRegion.hasSameLeftPosition(displayArea) + navBarRegion + .hasSameLeftPosition(displayArea) .hasSameTopPosition(displayArea) .hasSameBottomPosition(displayArea) Position.RIGHT -> - navBarRegion.hasSameRightPosition(displayArea) + navBarRegion + .hasSameRightPosition(displayArea) .hasSameTopPosition(displayArea) .hasSameBottomPosition(displayArea) else -> error("Unknown position $navBarPosition") diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt index e1af6e93de2cf..6209a0838d9be 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/ActivityEmbeddingTestBase.kt @@ -16,9 +16,9 @@ package com.android.server.wm.flicker.activityembedding -import android.tools.device.flicker.legacy.LegacyFlickerTest import android.platform.test.annotations.Presubmit import android.tools.common.traces.component.ComponentNameMatcher +import android.tools.device.flicker.legacy.LegacyFlickerTest import com.android.server.wm.flicker.BaseTest import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper import org.junit.Before @@ -38,8 +38,6 @@ abstract class ActivityEmbeddingTestBase(flicker: LegacyFlickerTest) : BaseTest( @Test open fun backgroundLayerNeverVisible() { val backgroundColorLayer = ComponentNameMatcher("", "Animation Background") - flicker.assertLayers { - isInvisible(backgroundColorLayer) - } + flicker.assertLayers { isInvisible(backgroundColorLayer) } } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt index d41840746cf90..c3529bae5c756 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/layoutchange/HorizontalSplitChangeRatioTest.kt @@ -23,8 +23,8 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory -import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -35,9 +35,8 @@ import org.junit.runners.Parameterized * Test changing split ratio at runtime on a horizona split. * * Setup: Launch A|B in horizontal split with B being the secondary activity, by default A and B - * windows are equal in size. B is on the top and A is on the bottom. - * Transitions: - * Change the split ratio to A:B=0.7:0.3, expect bounds change for both A and B. + * windows are equal in size. B is on the top and A is on the bottom. Transitions: Change the split + * ratio to A:B=0.7:0.3, expect bounds change for both A and B. * * To run this test: `atest FlickerTests:HorizontalSplitChangeRatioTest` */ @@ -46,7 +45,7 @@ import org.junit.runners.Parameterized @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class HorizontalSplitChangeRatioTest(flicker: LegacyFlickerTest) : - ActivityEmbeddingTestBase(flicker) { + ActivityEmbeddingTestBase(flicker) { /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit = { setup { @@ -54,12 +53,9 @@ class HorizontalSplitChangeRatioTest(flicker: LegacyFlickerTest) : testApp.launchViaIntent(wmHelper) testApp.launchSecondaryActivityHorizontally(wmHelper) startDisplayBounds = - wmHelper.currentState.layerState.physicalDisplayBounds - ?: error("Display not found") - } - transitions { - testApp.changeSecondaryActivityRatio(wmHelper) + wmHelper.currentState.layerState.physicalDisplayBounds ?: error("Display not found") } + transitions { testApp.changeSecondaryActivityRatio(wmHelper) } teardown { tapl.goHome() testApp.exit(wmHelper) @@ -94,7 +90,8 @@ class HorizontalSplitChangeRatioTest(flicker: LegacyFlickerTest) : @Test fun secondaryActivityWindowIsAlwaysVisible() { flicker.assertWm { - isAppWindowVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) } + isAppWindowVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + } } /** Assert the Secondary activity window is always visible. */ @@ -110,15 +107,17 @@ class HorizontalSplitChangeRatioTest(flicker: LegacyFlickerTest) : fun secondaryActivityAdjustsHeightRuntime() { flicker.assertLayersStart { val topLayerRegion = - this.visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + this.visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) val bottomLayerRegion = - this.visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + this.visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) // Compare dimensions of two splits, given we're using default split attributes, // both activities take up the same visible size on the display. check { "height" } - .that(topLayerRegion.region.height).isEqual(bottomLayerRegion.region.height) + .that(topLayerRegion.region.height) + .isEqual(bottomLayerRegion.region.height) check { "width" } - .that(topLayerRegion.region.width).isEqual(bottomLayerRegion.region.width) + .that(topLayerRegion.region.width) + .isEqual(bottomLayerRegion.region.width) topLayerRegion.notOverlaps(bottomLayerRegion.region) // Layers of two activities sum to be fullscreen size on display. topLayerRegion.plus(bottomLayerRegion.region).coversExactly(startDisplayBounds) @@ -126,20 +125,20 @@ class HorizontalSplitChangeRatioTest(flicker: LegacyFlickerTest) : flicker.assertLayersEnd { val topLayerRegion = - this.visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + this.visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) val bottomLayerRegion = - this.visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + this.visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) // Compare dimensions of two splits, given we're using default split attributes, // both activities take up the same visible size on the display. check { "height" } - .that(topLayerRegion.region.height).isLower(bottomLayerRegion.region.height) + .that(topLayerRegion.region.height) + .isLower(bottomLayerRegion.region.height) check { "height" } - .that( - topLayerRegion.region.height / 0.3f - - bottomLayerRegion.region.height / 0.7f) - .isLower(0.1f) + .that(topLayerRegion.region.height / 0.3f - bottomLayerRegion.region.height / 0.7f) + .isLower(0.1f) check { "width" } - .that(topLayerRegion.region.width).isEqual(bottomLayerRegion.region.width) + .that(topLayerRegion.region.width) + .isEqual(bottomLayerRegion.region.width) topLayerRegion.notOverlaps(bottomLayerRegion.region) // Layers of two activities sum to be fullscreen size on display. topLayerRegion.plus(bottomLayerRegion.region).coversExactly(startDisplayBounds) @@ -159,4 +158,4 @@ class HorizontalSplitChangeRatioTest(flicker: LegacyFlickerTest) : @JvmStatic fun getParams() = LegacyFlickerTestFactory.nonRotationTests() } -} \ No newline at end of file +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt index 845e649492302..244c5dc9eed36 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt @@ -70,8 +70,7 @@ class MainActivityStartsSecondaryWithAlwaysExpandTest(flicker: LegacyFlickerTest @Ignore("Not applicable to this CUJ.") override fun navBarWindowIsVisibleAtStartAndEnd() {} - @FlakyTest(bugId = 291575593) - override fun entireScreenCovered() {} + @FlakyTest(bugId = 291575593) override fun entireScreenCovered() {} @Ignore("Not applicable to this CUJ.") override fun statusBarWindowIsAlwaysVisible() {} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt index 404f3290f04af..4bb2246201755 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenThirdActivityOverSplitTest.kt @@ -18,7 +18,6 @@ package com.android.server.wm.flicker.activityembedding.open import android.platform.test.annotations.Presubmit import android.tools.common.datatypes.Rect -import android.tools.common.traces.component.ComponentNameMatcher import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt index 68b7e17a11381..f409c4e59a930 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt @@ -104,8 +104,10 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding flicker.assertWm { notContains(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) .then() - .isAppWindowInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT, - isOptional = true) + .isAppWindowInvisible( + ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT, + isOptional = true + ) .then() .isAppWindowVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) } @@ -133,8 +135,10 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding } // Begin of transition. .then() - .isAppWindowInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT, - isOptional = true) + .isAppWindowInvisible( + ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT, + isOptional = true + ) .then() .invoke("mainAndSecondaryInSplit") { val mainActivityRegion = @@ -174,8 +178,10 @@ class OpenTrampolineActivityTest(flicker: LegacyFlickerTest) : ActivityEmbedding .coversExactly(startDisplayBounds) } .then() - .isInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT, - isOptional = true) + .isInvisible( + ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT, + isOptional = true + ) .then() .isVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt index 0417f9dbb4bf7..e4c35b2eb6b24 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/pip/SecondaryActivityEnterPipTest.kt @@ -35,92 +35,84 @@ import org.junit.runners.Parameterized /** * Test launching a secondary Activity into Picture-In-Picture mode. * - * Setup: Start from a split A|B. - * Transition: B enters PIP, observe the window shrink to the bottom right corner on screen. + * Setup: Start from a split A|B. Transition: B enters PIP, observe the window shrink to the bottom + * right corner on screen. * * To run this test: `atest FlickerTests:SecondaryActivityEnterPipTest` - * */ @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) -class SecondaryActivityEnterPipTest (flicker: LegacyFlickerTest) : - ActivityEmbeddingTestBase(flicker) { +class SecondaryActivityEnterPipTest(flicker: LegacyFlickerTest) : + ActivityEmbeddingTestBase(flicker) { override val transition: FlickerBuilder.() -> Unit = { setup { tapl.setExpectedRotationCheckEnabled(false) testApp.launchViaIntent(wmHelper) testApp.launchSecondaryActivity(wmHelper) startDisplayBounds = - wmHelper.currentState.layerState.physicalDisplayBounds - ?: error("Can't get display bounds") - } - transitions { - testApp.secondaryActivityEnterPip(wmHelper) + wmHelper.currentState.layerState.physicalDisplayBounds + ?: error("Can't get display bounds") } + transitions { testApp.secondaryActivityEnterPip(wmHelper) } teardown { tapl.goHome() testApp.exit(wmHelper) } } - /** - * Main and secondary activity start from a split each taking half of the screen. - */ + /** Main and secondary activity start from a split each taking half of the screen. */ @Presubmit @Test fun layersStartFromEqualSplit() { flicker.assertLayersStart { - val leftLayerRegion = - visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + val leftLayerRegion = visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) val rightLayerRegion = - visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) // Compare dimensions of two splits, given we're using default split attributes, // both activities take up the same visible size on the display. check { "height" } - .that(leftLayerRegion.region.height).isEqual(rightLayerRegion.region.height) + .that(leftLayerRegion.region.height) + .isEqual(rightLayerRegion.region.height) check { "width" } - .that(leftLayerRegion.region.width).isEqual(rightLayerRegion.region.width) + .that(leftLayerRegion.region.width) + .isEqual(rightLayerRegion.region.width) leftLayerRegion.notOverlaps(rightLayerRegion.region) leftLayerRegion.plus(rightLayerRegion.region).coversExactly(startDisplayBounds) } flicker.assertLayersEnd { visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .coversExactly(startDisplayBounds) + .coversExactly(startDisplayBounds) } } - /** - * Main Activity is visible throughout the transition and becomes fullscreen. - */ + /** Main Activity is visible throughout the transition and becomes fullscreen. */ @Presubmit @Test fun mainActivityWindowBecomesFullScreen() { flicker.assertWm { isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) } flicker.assertWmEnd { visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .coversExactly(startDisplayBounds) + .coversExactly(startDisplayBounds) } } - /** - * Main Activity is visible throughout the transition and becomes fullscreen. - */ + /** Main Activity is visible throughout the transition and becomes fullscreen. */ @Presubmit @Test fun mainActivityLayerBecomesFullScreen() { flicker.assertLayers { isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .then() - .isVisible(TRANSITION_SNAPSHOT) - .isInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .then() - .isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + .then() + .isVisible(TRANSITION_SNAPSHOT) + .isInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + .then() + .isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) } flicker.assertLayersEnd { visibleRegion(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .coversExactly(startDisplayBounds) + .coversExactly(startDisplayBounds) } } @@ -136,18 +128,15 @@ class SecondaryActivityEnterPipTest (flicker: LegacyFlickerTest) : } flicker.assertWmEnd { val pipWindowRegion = - visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - check{"height"} - .that(pipWindowRegion.region.height) - .isLower(startDisplayBounds.height / 2) - check{"width"} - .that(pipWindowRegion.region.width).isLower(startDisplayBounds.width) + visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + check { "height" } + .that(pipWindowRegion.region.height) + .isLower(startDisplayBounds.height / 2) + check { "width" }.that(pipWindowRegion.region.width).isLower(startDisplayBounds.width) } } - /** - * During the transition Secondary Activity shrinks to the bottom right corner. - */ + /** During the transition Secondary Activity shrinks to the bottom right corner. */ @Presubmit @Test fun secondaryLayerShrinks() { @@ -162,13 +151,9 @@ class SecondaryActivityEnterPipTest (flicker: LegacyFlickerTest) : } } flicker.assertLayersEnd { - val pipRegion = visibleRegion( - ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - check { "height" } - .that(pipRegion.region.height) - .isLower(startDisplayBounds.height / 2) - check { "width" } - .that(pipRegion.region.width).isLower(startDisplayBounds.width) + val pipRegion = visibleRegion(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + check { "height" }.that(pipRegion.region.height).isLower(startDisplayBounds.height / 2) + check { "width" }.that(pipRegion.region.width).isLower(startDisplayBounds.width) } } @@ -185,4 +170,4 @@ class SecondaryActivityEnterPipTest (flicker: LegacyFlickerTest) : @JvmStatic fun getParams() = LegacyFlickerTestFactory.nonRotationTests() } -} \ No newline at end of file +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt index f20e8e9b66d21..11e6bbe4eb13a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt @@ -56,9 +56,7 @@ constructor( launchSecondaryActivityFromButton(wmHelper, "launch_secondary_activity_rtl_button") } - /** - * Clicks the button to launch the secondary activity in a horizontal split. - */ + /** Clicks the button to launch the secondary activity in a horizontal split. */ fun launchSecondaryActivityHorizontally(wmHelper: WindowManagerStateHelper) { launchSecondaryActivityFromButton(wmHelper, "launch_secondary_activity_horizontally_button") } @@ -67,7 +65,7 @@ constructor( fun launchThirdActivity(wmHelper: WindowManagerStateHelper) { val launchButton = uiDevice.wait( - Until.findObject(By.res(getPackage(), "launch_third_activity_button")), + Until.findObject(By.res(packageName, "launch_third_activity_button")), FIND_TIMEOUT ) require(launchButton != null) { "Can't find launch third activity button on screen." } @@ -87,7 +85,7 @@ constructor( fun launchTrampolineActivity(wmHelper: WindowManagerStateHelper) { val launchButton = uiDevice.wait( - Until.findObject(By.res(getPackage(), "launch_trampoline_button")), + Until.findObject(By.res(packageName, "launch_trampoline_button")), FIND_TIMEOUT ) require(launchButton != null) { "Can't find launch trampoline activity button on screen." } @@ -105,53 +103,45 @@ constructor( */ fun finishSecondaryActivity(wmHelper: WindowManagerStateHelper) { val finishButton = - uiDevice.wait( - Until.findObject(By.res(getPackage(), "finish_secondary_activity_button")), - FIND_TIMEOUT - ) + uiDevice.wait( + Until.findObject(By.res(packageName, "finish_secondary_activity_button")), + FIND_TIMEOUT + ) require(finishButton != null) { "Can't find finish secondary activity button on screen." } finishButton.click() wmHelper - .StateSyncBuilder() - .withActivityRemoved(SECONDARY_ACTIVITY_COMPONENT) - .waitForAndVerify() - } + .StateSyncBuilder() + .withActivityRemoved(SECONDARY_ACTIVITY_COMPONENT) + .waitForAndVerify() + } - /** - * Clicks the button to toggle the split ratio of secondary activity. - */ + /** Clicks the button to toggle the split ratio of secondary activity. */ fun changeSecondaryActivityRatio(wmHelper: WindowManagerStateHelper) { val launchButton = - uiDevice.wait( - Until.findObject( - By.res(getPackage(), - "toggle_split_ratio_button")), - FIND_TIMEOUT - ) + uiDevice.wait( + Until.findObject(By.res(packageName, "toggle_split_ratio_button")), + FIND_TIMEOUT + ) require(launchButton != null) { "Can't find toggle ratio for secondary activity button on screen." } launchButton.click() wmHelper - .StateSyncBuilder() - .withAppTransitionIdle() - .withTransitionSnapshotGone() - .waitForAndVerify() + .StateSyncBuilder() + .withAppTransitionIdle() + .withTransitionSnapshotGone() + .waitForAndVerify() } fun secondaryActivityEnterPip(wmHelper: WindowManagerStateHelper) { val pipButton = - uiDevice.wait( - Until.findObject(By.res(getPackage(), "secondary_enter_pip_button")), - FIND_TIMEOUT - ) + uiDevice.wait( + Until.findObject(By.res(packageName, "secondary_enter_pip_button")), + FIND_TIMEOUT + ) require(pipButton != null) { "Can't find enter pip button on screen." } pipButton.click() - wmHelper - .StateSyncBuilder() - .withAppTransitionIdle() - .withPipShown() - .waitForAndVerify() + wmHelper.StateSyncBuilder().withAppTransitionIdle().withPipShown().waitForAndVerify() } /** @@ -161,7 +151,7 @@ constructor( fun launchAlwaysExpandActivity(wmHelper: WindowManagerStateHelper) { val launchButton = uiDevice.wait( - Until.findObject(By.res(getPackage(), "launch_always_expand_activity_button")), + Until.findObject(By.res(packageName, "launch_always_expand_activity_button")), FIND_TIMEOUT ) require(launchButton != null) { @@ -171,8 +161,11 @@ constructor( wmHelper .StateSyncBuilder() .withActivityState(ALWAYS_EXPAND_ACTIVITY_COMPONENT, PlatformConsts.STATE_RESUMED) - .withActivityState(MAIN_ACTIVITY_COMPONENT, PlatformConsts.STATE_PAUSED, - PlatformConsts.STATE_STOPPED) + .withActivityState( + MAIN_ACTIVITY_COMPONENT, + PlatformConsts.STATE_PAUSED, + PlatformConsts.STATE_STOPPED + ) .waitForAndVerify() } @@ -181,16 +174,16 @@ constructor( buttonName: String ) { val launchButton = - uiDevice.wait(Until.findObject(By.res(getPackage(), buttonName)), FIND_TIMEOUT) + uiDevice.wait(Until.findObject(By.res(packageName, buttonName)), FIND_TIMEOUT) require(launchButton != null) { "Can't find launch secondary activity button : " + buttonName + "on screen." } launchButton.click() wmHelper - .StateSyncBuilder() - .withActivityState(SECONDARY_ACTIVITY_COMPONENT, PlatformConsts.STATE_RESUMED) - .withActivityState(MAIN_ACTIVITY_COMPONENT, PlatformConsts.STATE_RESUMED) - .waitForAndVerify() + .StateSyncBuilder() + .withActivityState(SECONDARY_ACTIVITY_COMPONENT, PlatformConsts.STATE_RESUMED) + .withActivityState(MAIN_ACTIVITY_COMPONENT, PlatformConsts.STATE_RESUMED) + .waitForAndVerify() } /** @@ -200,7 +193,7 @@ constructor( fun launchPlaceholderSplit(wmHelper: WindowManagerStateHelper) { val launchButton = uiDevice.wait( - Until.findObject(By.res(getPackage(), "launch_placeholder_split_button")), + Until.findObject(By.res(packageName, "launch_placeholder_split_button")), FIND_TIMEOUT ) require(launchButton != null) { "Can't find launch placeholder split button on screen." } @@ -219,7 +212,7 @@ constructor( fun launchPlaceholderSplitRTL(wmHelper: WindowManagerStateHelper) { val launchButton = uiDevice.wait( - Until.findObject(By.res(getPackage(), "launch_placeholder_split_rtl_button")), + Until.findObject(By.res(packageName, "launch_placeholder_split_rtl_button")), FIND_TIMEOUT ) require(launchButton != null) { "Can't find launch placeholder split button on screen." } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt index 747cf3742bf7e..3146139757c13 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/GameAppHelper.kt @@ -41,7 +41,7 @@ constructor( */ fun swipeDown(): Boolean { val gameView = - uiDevice.wait(Until.findObject(By.res(getPackage(), GAME_APP_VIEW_RES)), WAIT_TIME_MS) + uiDevice.wait(Until.findObject(By.res(packageName, GAME_APP_VIEW_RES)), WAIT_TIME_MS) require(gameView != null) { "Mock game app view not found." } val bound = gameView.getVisibleBounds() 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 d1722521bba84..252f7d3e1bed7 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 @@ -40,7 +40,7 @@ constructor( */ open fun openIME(wmHelper: WindowManagerStateHelper) { val editText = - uiDevice.wait(Until.findObject(By.res(getPackage(), "plain_text_input")), FIND_TIMEOUT) + uiDevice.wait(Until.findObject(By.res(packageName, "plain_text_input")), FIND_TIMEOUT) requireNotNull(editText) { "Text field not found, this usually happens when the device " + @@ -67,7 +67,7 @@ constructor( open fun finishActivity(wmHelper: WindowManagerStateHelper) { val finishButton = uiDevice.wait( - Until.findObject(By.res(getPackage(), "finish_activity_btn")), + Until.findObject(By.res(packageName, "finish_activity_btn")), FIND_TIMEOUT ) requireNotNull(finishButton) { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt index 83a41abbd4bd2..1a65611757c09 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeShownOnAppStartHelper.kt @@ -71,7 +71,7 @@ constructor( if (rotation.isRotated()) { imePackageName } else { - getPackage() + packageName } open(expectedPackage) } @@ -79,7 +79,7 @@ constructor( fun startDialogThemedActivity(wmHelper: WindowManagerStateHelper) { val button = uiDevice.wait( - Until.findObject(By.res(getPackage(), "start_dialog_themed_activity_btn")), + Until.findObject(By.res(packageName, "start_dialog_themed_activity_btn")), FIND_TIMEOUT ) @@ -132,7 +132,7 @@ constructor( fun toggleFixPortraitOrientation(wmHelper: WindowManagerStateHelper) { val button = uiDevice.wait( - Until.findObject(By.res(getPackage(), "toggle_fixed_portrait_btn")), + Until.findObject(By.res(packageName, "toggle_fixed_portrait_btn")), FIND_TIMEOUT ) require(button != null) { @@ -140,7 +140,7 @@ constructor( "was left in an unknown state (e.g. Screen turned off)" } button.click() - mInstrumentation.waitForIdleSync() + instrumentation.waitForIdleSync() // Ensure app relaunching transition finish and the IME has shown waitIMEShown(wmHelper) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt index d83b6d39fcd84..9b539c8641d45 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/LetterboxAppHelper.kt @@ -38,7 +38,7 @@ constructor( ActivityOptions.NonResizeablePortraitActivity.COMPONENT.toFlickerComponent() ) : StandardAppHelper(instr, launcherName, component) { - private val gestureHelper: GestureHelper = GestureHelper(mInstrumentation) + private val gestureHelper: GestureHelper = GestureHelper(instrumentation) fun clickRestart(wmHelper: WindowManagerStateHelper) { val restartButton = diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt index c98f1c4b4d292..9895bda7f5900 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/MailAppHelper.kt @@ -37,7 +37,7 @@ constructor( fun openMail(rowIdx: Int) { val rowSel = - By.res(getPackage(), "mail_row_item_text").textEndsWith(String.format("%04d", rowIdx)) + By.res(packageName, "mail_row_item_text").textEndsWith(String.format("%04d", rowIdx)) var row: UiObject2? = null for (i in 1..1000) { row = uiDevice.wait(Until.findObject(rowSel), SHORT_WAIT_TIME_MS) @@ -46,7 +46,7 @@ constructor( } require(row != null) { "" } row.click() - uiDevice.wait(Until.gone(By.res(getPackage(), MAIL_LIST_RES_ID)), FIND_TIMEOUT) + uiDevice.wait(Until.gone(By.res(packageName, MAIL_LIST_RES_ID)), FIND_TIMEOUT) } fun scrollDown() { @@ -55,7 +55,7 @@ constructor( } fun waitForMailList(): UiObject2 { - val sel = By.res(getPackage(), MAIL_LIST_RES_ID).scrollable(true) + val sel = By.res(packageName, MAIL_LIST_RES_ID).scrollable(true) val ret = uiDevice.wait(Until.findObject(sel), FIND_TIMEOUT) requireNotNull(ret) { "Unable to find $MAIL_LIST_RES_ID object" } return ret diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt index 5b3d3083fe1c3..b2f8d4748c07a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NewTasksAppHelper.kt @@ -36,7 +36,7 @@ constructor( ) : StandardAppHelper(instr, launcherName, component) { fun openNewTask(device: UiDevice, wmHelper: WindowManagerStateHelper) { val button = - device.wait(Until.findObject(By.res(getPackage(), "launch_new_task")), FIND_TIMEOUT) + device.wait(Until.findObject(By.res(packageName, "launch_new_task")), FIND_TIMEOUT) requireNotNull(button) { "Button not found, this usually happens when the device " + diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt index 7665690a31223..e60c20df99671 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/NotificationAppHelper.kt @@ -35,7 +35,7 @@ constructor( ) : StandardAppHelper(instr, launcherName, component) { fun postNotification(wmHelper: WindowManagerStateHelper) { val button = - uiDevice.wait(Until.findObject(By.res(getPackage(), "post_notification")), FIND_TIMEOUT) + uiDevice.wait(Until.findObject(By.res(packageName, "post_notification")), FIND_TIMEOUT) requireNotNull(button) { "Post notification button not found, this usually happens when the device " + diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt index 82de646f72353..82d2ae0988708 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt @@ -46,12 +46,14 @@ open class PipAppHelper(instrumentation: Instrumentation) : private val mediaController: MediaController? get() = - mediaSessionManager.getActiveSessions(null).firstOrNull { it.packageName == `package` } + mediaSessionManager.getActiveSessions(null).firstOrNull { + it.packageName == packageName + } - private val gestureHelper: GestureHelper = GestureHelper(mInstrumentation) + private val gestureHelper: GestureHelper = GestureHelper(instrumentation) open fun clickObject(resId: String) { - val selector = By.res(`package`, resId) + val selector = By.res(packageName, resId) val obj = uiDevice.findObject(selector) ?: error("Could not find `$resId` object") obj.click() @@ -286,7 +288,7 @@ open class PipAppHelper(instrumentation: Instrumentation) : fun checkWithCustomActionsCheckbox() = uiDevice - .findObject(By.res(`package`, WITH_CUSTOM_ACTIONS_BUTTON_ID)) + .findObject(By.res(packageName, WITH_CUSTOM_ACTIONS_BUTTON_ID)) ?.takeIf { it.isCheckable } ?.apply { if (!isChecked) clickObject(WITH_CUSTOM_ACTIONS_BUTTON_ID) } ?: error("'With custom actions' checkbox not found") @@ -302,7 +304,7 @@ open class PipAppHelper(instrumentation: Instrumentation) : ReplaceWith("closePipWindow(wmHelper)") ) open fun closePipWindow() { - closePipWindow(WindowManagerStateHelper(mInstrumentation)) + closePipWindow(WindowManagerStateHelper(instrumentation)) } /** Returns the pip window bounds. */ @@ -386,8 +388,10 @@ open class PipAppHelper(instrumentation: Instrumentation) : Log.d(TAG, "window " + pipAppWindow) if (pipAppWindow == null) return@add false val pipRegion = pipAppWindow.frameRegion - Log.d(TAG, "region " + pipRegion + - " covers " + windowRect.coversMoreThan(pipRegion)) + Log.d( + TAG, + "region " + pipRegion + " covers " + windowRect.coversMoreThan(pipRegion) + ) return@add windowRect.coversMoreThan(pipRegion) } .waitForAndVerify() 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 895725c1efef9..8be5769f47cfc 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 @@ -40,7 +40,7 @@ constructor( ActivityOptions.SimpleActivity.COMPONENT.toFlickerComponent() fun openSecondActivity(device: UiDevice, wmHelper: WindowManagerStateHelper) { - val launchActivityButton = By.res(getPackage(), LAUNCH_SECOND_ACTIVITY) + val launchActivityButton = By.res(packageName, LAUNCH_SECOND_ACTIVITY) val button = device.wait(Until.findObject(launchActivityButton), FIND_TIMEOUT) requireNotNull(button) { diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt index 57eb1728f3029..3a784ff30e912 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromIconColdTest.kt @@ -70,8 +70,8 @@ class OpenAppFromIconColdTest(flicker: LegacyFlickerTest) : OpenAppFromLauncherT tapl .goHome() .switchToAllApps() - .getAppIcon(testApp.launcherName) - .launch(testApp.`package`) + .getAppIcon(testApp.appName) + .launch(testApp.packageName) } teardown { testApp.exit(wmHelper) } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLauncherTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLauncherTransition.kt index 62fb5704b2e88..4fc9bcb309c5f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLauncherTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLauncherTransition.kt @@ -30,7 +30,7 @@ abstract class OpenAppFromLauncherTransition(flicker: LegacyFlickerTest) : @Presubmit @Test open fun focusChanges() { - flicker.assertEventLog { this.focusChanges("NexusLauncherActivity", testApp.`package`) } + flicker.assertEventLog { this.focusChanges("NexusLauncherActivity", testApp.packageName) } } /** diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenTransition.kt index 687bc1958a5af..36e66c7e46cd0 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockscreenTransition.kt @@ -46,7 +46,7 @@ abstract class OpenAppFromLockscreenTransition(flicker: LegacyFlickerTest) : @Presubmit @Test open fun focusChanges() { - flicker.assertEventLog { this.focusChanges("", testApp.`package`) } + flicker.assertEventLog { this.focusChanges("", testApp.packageName) } } /** diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/Consts.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/notification/Consts.kt index 00e75c718c71a..b81439e8a1d15 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/Consts.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/notification/Consts.kt @@ -20,4 +20,4 @@ import android.tools.common.traces.component.ComponentNameMatcher object Consts { val IMAGE_WALLPAPER = ComponentNameMatcher("", "com.android.systemui.wallpapers.ImageWallpaper") -} \ No newline at end of file +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt index 0e33390353e92..2aa444e45ea2a 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt @@ -67,7 +67,8 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() testApp.postNotification(wmHelper) device.pressHome() - wmHelper.StateSyncBuilder() + wmHelper + .StateSyncBuilder() .withHomeActivityVisible() .withWindowSurfaceDisappeared(ComponentNameMatcher.NOTIFICATION_SHADE) .waitForAndVerify() 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 1987a68745520..bdbf0d24e624c 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 @@ -98,7 +98,7 @@ class ChangeAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(fli @Presubmit @Test fun focusChanges() { - flicker.assertEventLog { this.focusChanges(testApp.`package`) } + flicker.assertEventLog { this.focusChanges(testApp.packageName) } } /** 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 5b127c887da85..6d3ae43c14721 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 @@ -116,8 +116,8 @@ class SeamlessAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(f flicker.assertWm { this.invoke("isFullScreen") { val appWindow = - it.windowState(testApp.`package`) - ?: error("App window for package ${testApp.`package`} not found") + it.windowState(testApp.packageName) + ?: error("App window for package ${testApp.packageName} not found") val flags = appWindow.windowState.attributes.flags appWindow .check { "isFullScreen" } @@ -134,8 +134,8 @@ class SeamlessAppRotationTest(flicker: LegacyFlickerTest) : RotationTransition(f flicker.assertWm { this.invoke("isRotationSeamless") { val appWindow = - it.windowState(testApp.`package`) - ?: error("App window for package ${testApp.`package`} not found") + it.windowState(testApp.packageName) + ?: error("App window for package ${testApp.packageName} not found") val rotationAnimation = appWindow.windowState.attributes.rotationAnimation appWindow .check { "isRotationSeamless" }