From 63752a84bb8423c0fe7012e615e58476d8fd04c8 Mon Sep 17 00:00:00 2001 From: Jing Ji Date: Tue, 7 Jun 2022 18:31:33 -0700 Subject: [PATCH] Mark the persistent flag while creating the ProcessRecord ...if it's a persistent app indeed. As we're not necessarily reusing the ProcessRecord now - including persistent process - this was to handle the case where the old process has been killed but not cleaned up, and the new process creation request comes in - in this case, we'll create a new ProcessRecord. If we do so, we need to set the persistent flag correctly to the new ProcessRecord. Bug: 230296979 Test: Manual Change-Id: I2c8f8d054c64a8dd97ee4913779e927464382525 --- services/core/java/com/android/server/am/ProcessList.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index a2048a347c7c4..3489c3622f492 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -2996,9 +2996,10 @@ public final class ProcessList { hostingRecord.getDefiningUid(), hostingRecord.getDefiningProcessName()); final ProcessStateRecord state = r.mState; - if (!mService.mBooted && !mService.mBooting + if (!isolated && !isSdkSandbox && userId == UserHandle.USER_SYSTEM - && (info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) { + && (info.flags & PERSISTENT_MASK) == PERSISTENT_MASK + && (TextUtils.equals(proc, info.processName))) { // The system process is initialized to SCHED_GROUP_DEFAULT in init.rc. state.setCurrentSchedulingGroup(ProcessList.SCHED_GROUP_DEFAULT); state.setSetSchedGroup(ProcessList.SCHED_GROUP_DEFAULT);