From 2f37c0d5cf151a882aa25521afb149c745a163f6 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 22 Aug 2022 17:18:09 +0800 Subject: [PATCH] Avoid misleading log while warm launch When launch a new activity on an existing process, the original code will let the activity with lastLaunchTime=0 go through setProc -> addActivityIfNeeded -> setLastActivityLaunchTime. And because the existing process has mLastActivityLaunchTime>0, the method will print a confusing log. So just move the assignment of lastLaunchTime before setProcess. And remove the later setLastActivityLaunchTime because setProcess has already called it. Bug: 243164648 Test: Launch an activity and calls finish(), and then launch it again. There should not have a warning log: "Tried to set launchTime (0) < mLastActivityLaunchTime". Change-Id: Id767a0589cbb7d9730a3deceb12789341391cdff --- .../java/com/android/server/wm/ActivityTaskSupervisor.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index 5a1afc49c62b1..20032d668344e 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -789,7 +789,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { // schedule launch ticks to collect information about slow apps. r.startLaunchTickingLocked(); - + r.lastLaunchTime = SystemClock.uptimeMillis(); r.setProcess(proc); // Ensure activity is allowed to be resumed after process has set. @@ -835,8 +835,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { final IActivityClientController activityClientController = proc.hasEverLaunchedActivity() ? null : mService.mActivityClientController; r.launchCount++; - r.lastLaunchTime = SystemClock.uptimeMillis(); - proc.setLastActivityLaunchTime(r.lastLaunchTime); if (DEBUG_ALL) Slog.v(TAG, "Launching: " + r);