summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2018-09-06 12:49:24 -0700
committer Vishnu Nair <vishnun@google.com> 2018-09-10 14:38:08 -0700
commit0a389e9ea22aa47121bcbe024525669a61ba2e8f (patch)
treea463457ce36108fc134c1989d7c17c301dc6dedf
parent75fb51b0ecaa941729ce18ba966276c91d33b2b6 (diff)
Reset launch start times when removing a process
When removing an exiting process that is running foreground activities, clear the launch times for the current windowing mode. When an app process is removed, activities from the process may be relaunched. In the case of forceStopPackageLocked the activities are finished before any window is drawn, and the launch time is not cleared. This will be incorrectly used to calculate launch time for the next launched activity launched in the same windowing mode. Bug: 80084651 Test: adb shell am start -W com.amazon.mShop.android.shopping/com.amazon.mShop.home.HomeActivity && sleep 1 && adb shell am force-stop com.amazon.mShop.android.shopping Merged-In: I2c4f0716c922baa1ad209b4ea1fa7ce366e0e108 Change-Id: I2c4f0716c922baa1ad209b4ea1fa7ce366e0e108
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 60499b2eb899..9d0a8653178a 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5886,6 +5886,7 @@ public class ActivityManagerService extends IActivityManager.Stub
private final void handleAppDiedLocked(ProcessRecord app,
boolean restarting, boolean allowRestart) {
int pid = app.pid;
+ final boolean clearLaunchStartTime = !restarting && app.removed && app.foregroundActivities;
boolean kept = cleanUpApplicationRecordLocked(app, restarting, allowRestart, -1,
false /*replacingPid*/);
if (!kept && !restarting) {
@@ -5926,6 +5927,19 @@ public class ActivityManagerService extends IActivityManager.Stub
} finally {
mWindowManager.continueSurfaceLayout();
}
+
+ // TODO (b/67683350)
+ // When an app process is removed, activities from the process may be relaunched. In the
+ // case of forceStopPackageLocked the activities are finished before any window is drawn,
+ // and the launch time is not cleared. This will be incorrectly used to calculate launch
+ // time for the next launched activity launched in the same windowing mode.
+ if (clearLaunchStartTime) {
+ final LaunchTimeTracker.Entry entry = mStackSupervisor
+ .getLaunchTimeTracker().getEntry(mStackSupervisor.getWindowingMode());
+ if (entry != null) {
+ entry.mLaunchStartTime = 0;
+ }
+ }
}
private final int getLRURecordIndexForAppLocked(IApplicationThread thread) {