Recycling already running activities

This saves time on non-restarting activities that already exist.

Change-Id: I1506e70342608d2a8d7154d25d36e28aa8cb7554
This commit is contained in:
vadimt
2020-07-23 20:00:37 -07:00
parent 5ab7171b9a
commit 0bc32dcce6
2 changed files with 12 additions and 8 deletions
@@ -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) {
@@ -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