diff options
5 files changed, 20 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromAnotherApp.kt b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromAnotherApp.kt index 2ccffa85b5c1..a3d60207a8bd 100644 --- a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromAnotherApp.kt +++ b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromAnotherApp.kt @@ -66,5 +66,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) + Utils.resetFreezeRecentTaskList() } } diff --git a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromHome.kt b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromHome.kt index 8673c464ad19..9c7de05563e1 100644 --- a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromHome.kt +++ b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromHome.kt @@ -65,5 +65,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) + Utils.resetFreezeRecentTaskList() } } diff --git a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromRecent.kt b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromRecent.kt index 22adf6c9ee2f..9eb29723cc7d 100644 --- a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromRecent.kt +++ b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBackToSplitFromRecent.kt @@ -68,5 +68,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) + Utils.resetFreezeRecentTaskList() } } diff --git a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBetweenSplitPairs.kt b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBetweenSplitPairs.kt index 4ded148f6113..d833d91c0b4b 100644 --- a/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBetweenSplitPairs.kt +++ b/libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/SwitchBetweenSplitPairs.kt @@ -68,5 +68,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { secondaryApp.exit(wmHelper) thirdApp.exit(wmHelper) fourthApp.exit(wmHelper) + Utils.resetFreezeRecentTaskList() } } diff --git a/libs/WindowManager/Shell/tests/e2e/utils/src/com/android/wm/shell/Utils.kt b/libs/WindowManager/Shell/tests/e2e/utils/src/com/android/wm/shell/Utils.kt index c0fafef96775..4a9e73b4af58 100644 --- a/libs/WindowManager/Shell/tests/e2e/utils/src/com/android/wm/shell/Utils.kt +++ b/libs/WindowManager/Shell/tests/e2e/utils/src/com/android/wm/shell/Utils.kt @@ -28,7 +28,10 @@ import android.tools.flicker.rules.ArtifactSaverRule import android.tools.flicker.rules.ChangeDisplayOrientationRule import android.tools.flicker.rules.LaunchAppRule import android.tools.flicker.rules.RemoveAllTasksButHomeRule +import android.util.Log import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.UiDevice +import java.io.IOException import org.junit.rules.RuleChain object Utils { @@ -52,4 +55,17 @@ object Utils { .around(PressHomeRule()) .around(EnsureDeviceSettingsRule()) } + + /** + * Resets the frozen recent tasks list (ie. commits the quickswitch to the current task and + * reorders the current task to the end of the recents list). + */ + fun resetFreezeRecentTaskList() { + try { + UiDevice.getInstance(instrumentation) + .executeShellCommand("wm reset-freeze-recent-tasks") + } catch (e: IOException) { + Log.e("TestUtils", "Failed to reset frozen recent tasks list", e) + } + } } |