Loading libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/OpenTrampolineAppInDesktopModeTaskLimitTest.kt 0 → 100644 +29 −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.functional import android.platform.test.annotations.Postsubmit import android.platform.test.rule.ScreenRecordRule import com.android.wm.shell.scenarios.OpenTrampolineAppInDesktopModeTaskLimit import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [OpenTrampolineAppInDesktopModeTaskLimit]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit @ScreenRecordRule.ScreenRecord class OpenTrampolineAppInDesktopModeTaskLimitTest : OpenTrampolineAppInDesktopModeTaskLimit() No newline at end of file libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/OpenTrampolineAppInDesktopModeTaskLimit.kt 0 → 100644 +100 −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.scenarios import android.app.Instrumentation import android.tools.Rotation import android.tools.device.apphelpers.CalculatorAppHelper import android.tools.device.apphelpers.ClockAppHelper import android.tools.device.apphelpers.MessagingAppHelper import android.tools.flicker.rules.ChangeDisplayOrientationRule import android.tools.traces.parsers.WindowManagerStateHelper import android.tools.traces.parsers.toFlickerComponent 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.MailAppHelper import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.window.flags.Flags import org.junit.After import org.junit.Assume import org.junit.Before import org.junit.Ignore import org.junit.Test @Ignore("Test Base Class") abstract class OpenTrampolineAppInDesktopModeTaskLimit(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 mailAppHelper = MailAppHelper(instrumentation) private val mailAppDesktopHelper = DesktopModeAppHelper(mailAppHelper) private val calculatorHelper = CalculatorAppHelper(instrumentation) private val clockAppHelper = ClockAppHelper() private val messagingAppHelper = MessagingAppHelper(instrumentation) private val trampolineAppHelper = SimpleAppHelper( instrumentation, launcherName = ActivityOptions.TrampolineStartActivity.LABEL, component = ActivityOptions.TrampolineStartActivity.COMPONENT.toFlickerComponent() ) @Before fun setup() { Assume.assumeTrue(Flags.enableDesktopWindowingMode() && Flags.enableDesktopTaskLimitSeparateTransition() && tapl.isTablet) tapl.apply { setEnableRotation(true) setExpectedRotation(rotation.value) enableTransientTaskbar(false) } ChangeDisplayOrientationRule.setRotation(rotation) mailAppDesktopHelper.enterDesktopMode(wmHelper, device) calculatorHelper.launchViaIntent(wmHelper) clockAppHelper.launchViaIntent(wmHelper) messagingAppHelper.launchViaIntent(wmHelper) } @Test open fun openTrampolineApp() { trampolineAppHelper.launchViaIntent() wmHelper.StateSyncBuilder() .withAppTransitionIdle() // Exactly one app is minimized .withWindowSurfaceDisappeared(mailAppHelper.componentMatcher) .withLayerVisible(calculatorHelper.componentMatcher) .withLayerVisible(clockAppHelper.componentMatcher) .withLayerVisible(messagingAppHelper.componentMatcher) // We need to verify that the second Activity (opened as trampolined task) is visible .withLayerVisible(ActivityOptions.TrampolineFinishActivity.COMPONENT.toFlickerComponent()) .waitForAndVerify() } @After fun teardown() { trampolineAppHelper.exit(wmHelper) messagingAppHelper.exit() clockAppHelper.exit() calculatorHelper.exit() mailAppHelper.exit() } } No newline at end of file tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +13 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,19 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".TrampolineStartActivity" android:exported="true" android:label=".TrampolineStartActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".TrampolineFinishActivity" android:exported="true" android:label=".TrampolineFinishActivity" /> <service android:name=".AssistantInteractionSessionService" android:exported="true" Loading tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ActivityOptions.java +12 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,18 @@ public class ActivityOptions { } } public static class TrampolineStartActivity { public static final String LABEL = "TrampolineStartActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".TrampolineStartActivity"); } public static class TrampolineFinishActivity { public static final String LABEL = "TrampolineFinishActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".TrampolineFinishActivity"); } public static class NonResizeableActivity { public static final String LABEL = "NonResizeableActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, Loading tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/TrampolineFinishActivity.java 0 → 100644 +36 −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.server.wm.flicker.testapp; import android.app.Activity; import android.os.Bundle; import androidx.annotation.Nullable; /** * Activity that is launched from {@link TrampolineStartActivity}. * * <p>This Activity is displayed after the initial trampoline activity has completed its processing. */ public class TrampolineFinishActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_non_resizeable); } } Loading
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/OpenTrampolineAppInDesktopModeTaskLimitTest.kt 0 → 100644 +29 −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.functional import android.platform.test.annotations.Postsubmit import android.platform.test.rule.ScreenRecordRule import com.android.wm.shell.scenarios.OpenTrampolineAppInDesktopModeTaskLimit import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [OpenTrampolineAppInDesktopModeTaskLimit]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit @ScreenRecordRule.ScreenRecord class OpenTrampolineAppInDesktopModeTaskLimitTest : OpenTrampolineAppInDesktopModeTaskLimit() No newline at end of file
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/OpenTrampolineAppInDesktopModeTaskLimit.kt 0 → 100644 +100 −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.scenarios import android.app.Instrumentation import android.tools.Rotation import android.tools.device.apphelpers.CalculatorAppHelper import android.tools.device.apphelpers.ClockAppHelper import android.tools.device.apphelpers.MessagingAppHelper import android.tools.flicker.rules.ChangeDisplayOrientationRule import android.tools.traces.parsers.WindowManagerStateHelper import android.tools.traces.parsers.toFlickerComponent 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.MailAppHelper import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.server.wm.flicker.testapp.ActivityOptions import com.android.window.flags.Flags import org.junit.After import org.junit.Assume import org.junit.Before import org.junit.Ignore import org.junit.Test @Ignore("Test Base Class") abstract class OpenTrampolineAppInDesktopModeTaskLimit(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 mailAppHelper = MailAppHelper(instrumentation) private val mailAppDesktopHelper = DesktopModeAppHelper(mailAppHelper) private val calculatorHelper = CalculatorAppHelper(instrumentation) private val clockAppHelper = ClockAppHelper() private val messagingAppHelper = MessagingAppHelper(instrumentation) private val trampolineAppHelper = SimpleAppHelper( instrumentation, launcherName = ActivityOptions.TrampolineStartActivity.LABEL, component = ActivityOptions.TrampolineStartActivity.COMPONENT.toFlickerComponent() ) @Before fun setup() { Assume.assumeTrue(Flags.enableDesktopWindowingMode() && Flags.enableDesktopTaskLimitSeparateTransition() && tapl.isTablet) tapl.apply { setEnableRotation(true) setExpectedRotation(rotation.value) enableTransientTaskbar(false) } ChangeDisplayOrientationRule.setRotation(rotation) mailAppDesktopHelper.enterDesktopMode(wmHelper, device) calculatorHelper.launchViaIntent(wmHelper) clockAppHelper.launchViaIntent(wmHelper) messagingAppHelper.launchViaIntent(wmHelper) } @Test open fun openTrampolineApp() { trampolineAppHelper.launchViaIntent() wmHelper.StateSyncBuilder() .withAppTransitionIdle() // Exactly one app is minimized .withWindowSurfaceDisappeared(mailAppHelper.componentMatcher) .withLayerVisible(calculatorHelper.componentMatcher) .withLayerVisible(clockAppHelper.componentMatcher) .withLayerVisible(messagingAppHelper.componentMatcher) // We need to verify that the second Activity (opened as trampolined task) is visible .withLayerVisible(ActivityOptions.TrampolineFinishActivity.COMPONENT.toFlickerComponent()) .waitForAndVerify() } @After fun teardown() { trampolineAppHelper.exit(wmHelper) messagingAppHelper.exit() clockAppHelper.exit() calculatorHelper.exit() mailAppHelper.exit() } } No newline at end of file
tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +13 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,19 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".TrampolineStartActivity" android:exported="true" android:label=".TrampolineStartActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".TrampolineFinishActivity" android:exported="true" android:label=".TrampolineFinishActivity" /> <service android:name=".AssistantInteractionSessionService" android:exported="true" Loading
tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ActivityOptions.java +12 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,18 @@ public class ActivityOptions { } } public static class TrampolineStartActivity { public static final String LABEL = "TrampolineStartActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".TrampolineStartActivity"); } public static class TrampolineFinishActivity { public static final String LABEL = "TrampolineFinishActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".TrampolineFinishActivity"); } public static class NonResizeableActivity { public static final String LABEL = "NonResizeableActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, Loading
tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/TrampolineFinishActivity.java 0 → 100644 +36 −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.server.wm.flicker.testapp; import android.app.Activity; import android.os.Bundle; import androidx.annotation.Nullable; /** * Activity that is launched from {@link TrampolineStartActivity}. * * <p>This Activity is displayed after the initial trampoline activity has completed its processing. */ public class TrampolineFinishActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_non_resizeable); } }