From e481d169e5cc51d9fdfe3a3eef2c8c27255f6a29 Mon Sep 17 00:00:00 2001 From: Jing Ji Date: Thu, 25 Feb 2021 17:16:00 -0800 Subject: [PATCH] Put stopping service's host process on top of cached process list stopService should be regarded as a service activity, thus after the service gets stopped, its host process should stay on top of all cached processes if it slips into cached state. Bug: 162811773 Test: atest CtsAppTestCases:ActivityManagerTest Change-Id: I4f42344c373e431b7b4418304f29e79c3dec1a0e --- services/core/java/com/android/server/am/ActiveServices.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 2efc83c4af060..a80cf7d7825a0 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -3868,6 +3868,8 @@ public final class ActiveServices { r.name.getClassName()); stopServiceAndUpdateAllowlistManagerLocked(r); if (r.app.getThread() != null) { + // Bump the process to the top of LRU list + mAm.updateLruProcessLocked(r.app, false, null); updateServiceForegroundLocked(r.app.mServices, false); try { bumpServiceExecutingLocked(r, false, "destroy");