Merge "Fix race condition in UidRecord cleanup" into rvc-d1-dev am: c453c4aff9 am: 927d29635e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12244064 Change-Id: I1fdf7a19bc153193c52f9bee672b6f66f027a7f2
This commit is contained in:
@@ -2940,25 +2940,26 @@ public final class ProcessList {
|
|||||||
if ((expecting == null) || (old == expecting)) {
|
if ((expecting == null) || (old == expecting)) {
|
||||||
mProcessNames.remove(name, uid);
|
mProcessNames.remove(name, uid);
|
||||||
}
|
}
|
||||||
if (old != null && old.uidRecord != null) {
|
final ProcessRecord record = expecting != null ? expecting : old;
|
||||||
old.uidRecord.numProcs--;
|
if (record != null && record.uidRecord != null) {
|
||||||
old.uidRecord.procRecords.remove(old);
|
final UidRecord uidRecord = record.uidRecord;
|
||||||
if (old.uidRecord.numProcs == 0) {
|
uidRecord.numProcs--;
|
||||||
|
uidRecord.procRecords.remove(record);
|
||||||
|
if (uidRecord.numProcs == 0) {
|
||||||
// No more processes using this uid, tell clients it is gone.
|
// No more processes using this uid, tell clients it is gone.
|
||||||
if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS,
|
if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS,
|
||||||
"No more processes in " + old.uidRecord);
|
"No more processes in " + uidRecord);
|
||||||
mService.enqueueUidChangeLocked(old.uidRecord, -1, UidRecord.CHANGE_GONE);
|
mService.enqueueUidChangeLocked(uidRecord, -1, UidRecord.CHANGE_GONE);
|
||||||
EventLogTags.writeAmUidStopped(uid);
|
EventLogTags.writeAmUidStopped(uid);
|
||||||
mActiveUids.remove(uid);
|
mActiveUids.remove(uid);
|
||||||
mService.noteUidProcessState(uid, ActivityManager.PROCESS_STATE_NONEXISTENT,
|
mService.noteUidProcessState(uid, ActivityManager.PROCESS_STATE_NONEXISTENT,
|
||||||
ActivityManager.PROCESS_CAPABILITY_NONE);
|
ActivityManager.PROCESS_CAPABILITY_NONE);
|
||||||
}
|
}
|
||||||
old.uidRecord = null;
|
record.uidRecord = null;
|
||||||
}
|
}
|
||||||
mIsolatedProcesses.remove(uid);
|
mIsolatedProcesses.remove(uid);
|
||||||
mGlobalIsolatedUids.freeIsolatedUidLocked(uid);
|
mGlobalIsolatedUids.freeIsolatedUidLocked(uid);
|
||||||
// Remove the (expected) ProcessRecord from the app zygote
|
// Remove the (expected) ProcessRecord from the app zygote
|
||||||
final ProcessRecord record = expecting != null ? expecting : old;
|
|
||||||
if (record != null && record.appZygote) {
|
if (record != null && record.appZygote) {
|
||||||
removeProcessFromAppZygoteLocked(record);
|
removeProcessFromAppZygoteLocked(record);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user