From 0bc32dcce64b20459ff6f8eff960b217810d59d8 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 23 Jul 2020 20:00:37 -0700 Subject: [PATCH] Recycling already running activities This saves time on non-restarting activities that already exist. Change-Id: I1506e70342608d2a8d7154d25d36e28aa8cb7554 --- .../quickstep/StartLauncherViaGestureTests.java | 4 +++- .../android/quickstep/TaplTestsQuickstep.java | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java index 0c5b9ada5d..664958a18e 100644 --- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java +++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java @@ -48,7 +48,9 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest { // b/143488140 mLauncher.pressHome(); // Start an activity where the gestures start. - startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + if (mLauncher.getRecentTasks().isEmpty()) { + startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + } } private void runTest(String... eventSequence) { diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index bf093fdabf..ed25cc71ca 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -69,14 +69,16 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { } private void startTestApps() throws Exception { - startAppFast(getAppPackageName()); - startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); - startTestActivity(2); + if (mLauncher.getRecentTasks().size() < 3) { + startAppFast(getAppPackageName()); + startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + startTestActivity(2); - executeOnLauncher(launcher -> assertTrue( - "Launcher activity is the top activity; expecting another activity to be the top " - + "one", - isInBackground(launcher))); + executeOnLauncher(launcher -> assertTrue( + "Launcher activity is the top activity; expecting another activity to be the " + + "top one", + isInBackground(launcher))); + } } @Test