Loading libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/fundamentals/ExitDesktopToSplitScreenWithAppHeaderMenuFlickerTest.kt 0 → 100644 +84 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 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.wm.shell.flicker.fundamentals import android.platform.test.annotations.RequiresDevice import android.tools.NavBar import android.tools.flicker.assertions.FlickerTest import android.tools.flicker.junit.FlickerParametersRunnerFactory import android.tools.flicker.legacy.FlickerBuilder import android.tools.flicker.legacy.LegacyFlickerTest import android.tools.flicker.legacy.LegacyFlickerTestFactory import com.android.wm.shell.flicker.DesktopModeBaseTest import com.android.wm.shell.scenarios.ExitDesktopToSplitScreenWithAppHeaderMenu import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd import com.android.wm.shell.flicker.utils.layerBecomesVisible import com.android.wm.shell.flicker.utils.splitScreenDividerBecomesVisible import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized /** * Exit the app in desktop mode to split screen via app header menu. */ @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) class ExitDesktopToSplitScreenWithAppHeaderMenuFlickerTest(flicker: LegacyFlickerTest) : DesktopModeBaseTest(flicker) { inner class ExitDesktopToSplitScreenWithAppHeaderMenuScenario : ExitDesktopToSplitScreenWithAppHeaderMenu(flicker.scenario.startRotation) @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation) val scenario = ExitDesktopToSplitScreenWithAppHeaderMenuScenario() private val firstApp = scenario.testApp private val secondApp = scenario.calculatorApp override val transition: FlickerBuilder.() -> Unit get() = { setup { scenario.setup() } transitions { scenario.exitDesktopToSplitScreen() } teardown { scenario.teardown() } } @Test fun appWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(firstApp) @Test fun splitScreenDividerBecomesVisible() = flicker.splitScreenDividerBecomesVisible() @Test fun layerBecomesVisible() = flicker.layerBecomesVisible(secondApp) companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection<FlickerTest> { return LegacyFlickerTestFactory.nonRotationTests( supportedNavigationModes = listOf(NavBar.MODE_GESTURAL) ) } } } libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/fundamentals/ExitDesktopToSplitScreenWithAppHeaderMenuTest.kt 0 → 100644 +30 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 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.wm.shell.functional.fundamentals import android.platform.test.annotations.Postsubmit import android.platform.test.rule.ScreenRecordRule import com.android.wm.shell.scenarios.ExitDesktopToSplitScreenWithAppHeaderMenu import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [ExitDesktopToSplitScreenWithAppHeaderMenu]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit @ScreenRecordRule.ScreenRecord class ExitDesktopToSplitScreenWithAppHeaderMenuTest : ExitDesktopToSplitScreenWithAppHeaderMenu() libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ExitDesktopToSplitScreenWithAppHeaderMenu.kt 0 → 100644 +88 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 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.wm.shell.scenarios import android.app.Instrumentation import android.tools.NavBar import android.tools.PlatformConsts.DEFAULT_DISPLAY import android.tools.Rotation import android.tools.device.apphelpers.CalculatorAppHelper import android.tools.flicker.rules.ChangeDisplayOrientationRule import android.tools.traces.parsers.WindowManagerStateHelper import android.view.KeyEvent.KEYCODE_META_RIGHT import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.server.wm.flicker.helpers.DesktopModeAppHelper import com.android.server.wm.flicker.helpers.KeyEventHelper import com.android.wm.shell.shared.desktopmode.DesktopState import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.wm.shell.Utils import org.junit.After import org.junit.Assume import org.junit.Before import org.junit.Ignore import org.junit.Rule import org.junit.Test @Ignore("Test Base Class") abstract class ExitDesktopToSplitScreenWithAppHeaderMenu(val rotation: Rotation = Rotation.ROTATION_0) : TestScenarioBase() { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val tapl = LauncherInstrumentation() private val wmHelper = WindowManagerStateHelper(instrumentation) private val device = UiDevice.getInstance(instrumentation) private val simpleAppHelper = SimpleAppHelper(instrumentation) val testApp = DesktopModeAppHelper(simpleAppHelper) val calculatorApp = CalculatorAppHelper(instrumentation) val keyEventHelper = KeyEventHelper(InstrumentationRegistry.getInstrumentation()) @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation) @Before fun setup() { Assume.assumeTrue( DesktopState.fromContext(instrumentation.context) .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY) ) tapl.setEnableRotation(true) tapl.setExpectedRotation(rotation.value) tapl.enableTransientTaskbar(false) ChangeDisplayOrientationRule.setRotation(rotation) // Launch app in order to enter desktop mode simpleAppHelper.launchViaIntent(wmHelper) testApp.enterDesktopMode(wmHelper, device) } @Test open fun exitDesktopToSplitScreen() { testApp.exitDesktopModeToSplitScreenWithAppHeader(wmHelper) // Open allApps via keyboard shortcut keyEventHelper.press(KEYCODE_META_RIGHT) tapl.allApps .getAppIcon(calculatorApp.appName) .launch(calculatorApp.packageName) } @After fun teardown() { testApp.exit(wmHelper) calculatorApp.exit(wmHelper) } } tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/DesktopModeAppHelper.kt +16 −0 Original line number Original line Diff line number Diff line Loading @@ -597,6 +597,21 @@ open class DesktopModeAppHelper(private val innerHelper: StandardAppHelper) : wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() } } fun exitDesktopModeToSplitScreenWithAppHeader(wmHelper:WindowManagerStateHelper) { val openMenuButton = getDesktopAppViewByRes(OPEN_MENU_BUTTON) openMenuButton?.click() wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() val pill = getDesktopAppViewByRes(PILL_CONTAINER) val splitScreenModeButton = pill ?.children ?.find { it.resourceName.endsWith(SPLIT_SCREEN_BUTTON) } splitScreenModeButton?.click() wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() } fun restartFromAppHandleMenu(wmHelper: WindowManagerStateHelper) { fun restartFromAppHandleMenu(wmHelper: WindowManagerStateHelper) { val openMenuButton = getDesktopAppViewByRes(OPEN_MENU_BUTTON) val openMenuButton = getDesktopAppViewByRes(OPEN_MENU_BUTTON) openMenuButton?.click() openMenuButton?.click() Loading Loading @@ -744,6 +759,7 @@ open class DesktopModeAppHelper(private val innerHelper: StandardAppHelper) : const val RESTART_BUTTON: String = "handle_menu_restart_button" const val RESTART_BUTTON: String = "handle_menu_restart_button" const val RESTART_DIALOG_RESTART_BUTTON: String = "letterbox_restart_dialog_restart_button" const val RESTART_DIALOG_RESTART_BUTTON: String = "letterbox_restart_dialog_restart_button" const val FULL_SCREEN_BUTTON: String = "fullscreen_button" const val FULL_SCREEN_BUTTON: String = "fullscreen_button" const val SPLIT_SCREEN_BUTTON: String = "split_screen_button" val caption: BySelector val caption: BySelector get() = By.res(SYSTEMUI_PACKAGE, CAPTION) get() = By.res(SYSTEMUI_PACKAGE, CAPTION) Loading Loading
libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/fundamentals/ExitDesktopToSplitScreenWithAppHeaderMenuFlickerTest.kt 0 → 100644 +84 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 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.wm.shell.flicker.fundamentals import android.platform.test.annotations.RequiresDevice import android.tools.NavBar import android.tools.flicker.assertions.FlickerTest import android.tools.flicker.junit.FlickerParametersRunnerFactory import android.tools.flicker.legacy.FlickerBuilder import android.tools.flicker.legacy.LegacyFlickerTest import android.tools.flicker.legacy.LegacyFlickerTestFactory import com.android.wm.shell.flicker.DesktopModeBaseTest import com.android.wm.shell.scenarios.ExitDesktopToSplitScreenWithAppHeaderMenu import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd import com.android.wm.shell.flicker.utils.layerBecomesVisible import com.android.wm.shell.flicker.utils.splitScreenDividerBecomesVisible import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized /** * Exit the app in desktop mode to split screen via app header menu. */ @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) class ExitDesktopToSplitScreenWithAppHeaderMenuFlickerTest(flicker: LegacyFlickerTest) : DesktopModeBaseTest(flicker) { inner class ExitDesktopToSplitScreenWithAppHeaderMenuScenario : ExitDesktopToSplitScreenWithAppHeaderMenu(flicker.scenario.startRotation) @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation) val scenario = ExitDesktopToSplitScreenWithAppHeaderMenuScenario() private val firstApp = scenario.testApp private val secondApp = scenario.calculatorApp override val transition: FlickerBuilder.() -> Unit get() = { setup { scenario.setup() } transitions { scenario.exitDesktopToSplitScreen() } teardown { scenario.teardown() } } @Test fun appWindowOnTopAtEnd() = flicker.appWindowOnTopAtEnd(firstApp) @Test fun splitScreenDividerBecomesVisible() = flicker.splitScreenDividerBecomesVisible() @Test fun layerBecomesVisible() = flicker.layerBecomesVisible(secondApp) companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection<FlickerTest> { return LegacyFlickerTestFactory.nonRotationTests( supportedNavigationModes = listOf(NavBar.MODE_GESTURAL) ) } } }
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/fundamentals/ExitDesktopToSplitScreenWithAppHeaderMenuTest.kt 0 → 100644 +30 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 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.wm.shell.functional.fundamentals import android.platform.test.annotations.Postsubmit import android.platform.test.rule.ScreenRecordRule import com.android.wm.shell.scenarios.ExitDesktopToSplitScreenWithAppHeaderMenu import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [ExitDesktopToSplitScreenWithAppHeaderMenu]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit @ScreenRecordRule.ScreenRecord class ExitDesktopToSplitScreenWithAppHeaderMenuTest : ExitDesktopToSplitScreenWithAppHeaderMenu()
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ExitDesktopToSplitScreenWithAppHeaderMenu.kt 0 → 100644 +88 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2025 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.wm.shell.scenarios import android.app.Instrumentation import android.tools.NavBar import android.tools.PlatformConsts.DEFAULT_DISPLAY import android.tools.Rotation import android.tools.device.apphelpers.CalculatorAppHelper import android.tools.flicker.rules.ChangeDisplayOrientationRule import android.tools.traces.parsers.WindowManagerStateHelper import android.view.KeyEvent.KEYCODE_META_RIGHT import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.server.wm.flicker.helpers.DesktopModeAppHelper import com.android.server.wm.flicker.helpers.KeyEventHelper import com.android.wm.shell.shared.desktopmode.DesktopState import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.wm.shell.Utils import org.junit.After import org.junit.Assume import org.junit.Before import org.junit.Ignore import org.junit.Rule import org.junit.Test @Ignore("Test Base Class") abstract class ExitDesktopToSplitScreenWithAppHeaderMenu(val rotation: Rotation = Rotation.ROTATION_0) : TestScenarioBase() { private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() private val tapl = LauncherInstrumentation() private val wmHelper = WindowManagerStateHelper(instrumentation) private val device = UiDevice.getInstance(instrumentation) private val simpleAppHelper = SimpleAppHelper(instrumentation) val testApp = DesktopModeAppHelper(simpleAppHelper) val calculatorApp = CalculatorAppHelper(instrumentation) val keyEventHelper = KeyEventHelper(InstrumentationRegistry.getInstrumentation()) @Rule @JvmField val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation) @Before fun setup() { Assume.assumeTrue( DesktopState.fromContext(instrumentation.context) .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY) ) tapl.setEnableRotation(true) tapl.setExpectedRotation(rotation.value) tapl.enableTransientTaskbar(false) ChangeDisplayOrientationRule.setRotation(rotation) // Launch app in order to enter desktop mode simpleAppHelper.launchViaIntent(wmHelper) testApp.enterDesktopMode(wmHelper, device) } @Test open fun exitDesktopToSplitScreen() { testApp.exitDesktopModeToSplitScreenWithAppHeader(wmHelper) // Open allApps via keyboard shortcut keyEventHelper.press(KEYCODE_META_RIGHT) tapl.allApps .getAppIcon(calculatorApp.appName) .launch(calculatorApp.packageName) } @After fun teardown() { testApp.exit(wmHelper) calculatorApp.exit(wmHelper) } }
tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/DesktopModeAppHelper.kt +16 −0 Original line number Original line Diff line number Diff line Loading @@ -597,6 +597,21 @@ open class DesktopModeAppHelper(private val innerHelper: StandardAppHelper) : wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() } } fun exitDesktopModeToSplitScreenWithAppHeader(wmHelper:WindowManagerStateHelper) { val openMenuButton = getDesktopAppViewByRes(OPEN_MENU_BUTTON) openMenuButton?.click() wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() val pill = getDesktopAppViewByRes(PILL_CONTAINER) val splitScreenModeButton = pill ?.children ?.find { it.resourceName.endsWith(SPLIT_SCREEN_BUTTON) } splitScreenModeButton?.click() wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() } fun restartFromAppHandleMenu(wmHelper: WindowManagerStateHelper) { fun restartFromAppHandleMenu(wmHelper: WindowManagerStateHelper) { val openMenuButton = getDesktopAppViewByRes(OPEN_MENU_BUTTON) val openMenuButton = getDesktopAppViewByRes(OPEN_MENU_BUTTON) openMenuButton?.click() openMenuButton?.click() Loading Loading @@ -744,6 +759,7 @@ open class DesktopModeAppHelper(private val innerHelper: StandardAppHelper) : const val RESTART_BUTTON: String = "handle_menu_restart_button" const val RESTART_BUTTON: String = "handle_menu_restart_button" const val RESTART_DIALOG_RESTART_BUTTON: String = "letterbox_restart_dialog_restart_button" const val RESTART_DIALOG_RESTART_BUTTON: String = "letterbox_restart_dialog_restart_button" const val FULL_SCREEN_BUTTON: String = "fullscreen_button" const val FULL_SCREEN_BUTTON: String = "fullscreen_button" const val SPLIT_SCREEN_BUTTON: String = "split_screen_button" val caption: BySelector val caption: BySelector get() = By.res(SYSTEMUI_PACKAGE, CAPTION) get() = By.res(SYSTEMUI_PACKAGE, CAPTION) Loading