Loading libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> <!-- Allow the test to connect to perfetto trace processor --> <uses-permission android:name="android.permission.INTERNET"/> <!-- Use trusted virtual displays to emulate an external display --> <uses-permission android:name="android.permission.ADD_TRUSTED_DISPLAY"/> <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> <application android:requestLegacyExternalStorage="true" Loading libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/DesktopModeFlickerScenarios.kt +24 −0 Original line number Diff line number Diff line Loading @@ -546,5 +546,29 @@ class DesktopModeFlickerScenarios { AppWindowBecomesPinned(DESKTOP_MODE_APP), ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }) ) val OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED = FlickerConfigEntry( scenarioId = ScenarioId("OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED"), extractor = ShellTransitionScenarioExtractor( transitionMatcher = object : ITransitionMatcher { override fun findAll( transitions: Collection<Transition> ): Collection<Transition> { return listOf(transitions .filter { it.type == TransitionType.OPEN } .maxByOrNull { it.id }!!) } } ), assertions = listOf( AppWindowBecomesVisible(DESKTOP_MODE_APP), AppWindowOnTopAtEnd(DESKTOP_MODE_APP), AppWindowBecomesVisible(DESKTOP_WALLPAPER), ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }), ) } } libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/OpenAppWithExternalDisplayConnected.kt 0 → 100644 +49 −0 Original line number 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 import android.tools.flicker.FlickerConfig import android.tools.flicker.annotation.ExpectedScenarios import android.tools.flicker.annotation.FlickerConfigProvider import android.tools.flicker.config.FlickerConfig import android.tools.flicker.config.FlickerServiceConfig import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED import com.android.wm.shell.scenarios.OpenAppWithExternalDisplayConnected import org.junit.Test import org.junit.runner.RunWith /** * Open an app on the default display when an external display is connected. * * Assert that the app launches in desktop mode. */ @RunWith(FlickerServiceJUnit4ClassRunner::class) class OpenAppWithExternalDisplayConnected : OpenAppWithExternalDisplayConnected() { @ExpectedScenarios(["OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED"]) @Test override fun openAppWithExternalDisplayConnected() = super.openAppWithExternalDisplayConnected() companion object { @JvmStatic @FlickerConfigProvider fun flickerConfigProvider(): FlickerConfig = FlickerConfig() .use(FlickerServiceConfig.DEFAULT) .use(OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED) } } Loading
libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> <!-- Allow the test to connect to perfetto trace processor --> <uses-permission android:name="android.permission.INTERNET"/> <!-- Use trusted virtual displays to emulate an external display --> <uses-permission android:name="android.permission.ADD_TRUSTED_DISPLAY"/> <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> <application android:requestLegacyExternalStorage="true" Loading
libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/DesktopModeFlickerScenarios.kt +24 −0 Original line number Diff line number Diff line Loading @@ -546,5 +546,29 @@ class DesktopModeFlickerScenarios { AppWindowBecomesPinned(DESKTOP_MODE_APP), ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }) ) val OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED = FlickerConfigEntry( scenarioId = ScenarioId("OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED"), extractor = ShellTransitionScenarioExtractor( transitionMatcher = object : ITransitionMatcher { override fun findAll( transitions: Collection<Transition> ): Collection<Transition> { return listOf(transitions .filter { it.type == TransitionType.OPEN } .maxByOrNull { it.id }!!) } } ), assertions = listOf( AppWindowBecomesVisible(DESKTOP_MODE_APP), AppWindowOnTopAtEnd(DESKTOP_MODE_APP), AppWindowBecomesVisible(DESKTOP_WALLPAPER), ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }), ) } }
libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/OpenAppWithExternalDisplayConnected.kt 0 → 100644 +49 −0 Original line number 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 import android.tools.flicker.FlickerConfig import android.tools.flicker.annotation.ExpectedScenarios import android.tools.flicker.annotation.FlickerConfigProvider import android.tools.flicker.config.FlickerConfig import android.tools.flicker.config.FlickerServiceConfig import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED import com.android.wm.shell.scenarios.OpenAppWithExternalDisplayConnected import org.junit.Test import org.junit.runner.RunWith /** * Open an app on the default display when an external display is connected. * * Assert that the app launches in desktop mode. */ @RunWith(FlickerServiceJUnit4ClassRunner::class) class OpenAppWithExternalDisplayConnected : OpenAppWithExternalDisplayConnected() { @ExpectedScenarios(["OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED"]) @Test override fun openAppWithExternalDisplayConnected() = super.openAppWithExternalDisplayConnected() companion object { @JvmStatic @FlickerConfigProvider fun flickerConfigProvider(): FlickerConfig = FlickerConfig() .use(FlickerServiceConfig.DEFAULT) .use(OPEN_APP_WHEN_EXTERNAL_DISPLAY_CONNECTED) } }