Merge "Fix potential race condition due to missing lock" am: 8787386e84 am: af33aac24e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1864979

Change-Id: I81530ff1530b8ef5a2a11c47c7a5ab963a865397
This commit is contained in:
Jing Ji
2021-10-21 00:36:41 +00:00
committed by Automerger Merge Worker

View File

@@ -4906,7 +4906,9 @@ public final class ActiveServices {
sr.setProcess(null, null, 0, null);
sr.isolatedProc = null;
sr.executeNesting = 0;
sr.forceClearTracker();
synchronized (mAm.mProcessStats.mLock) {
sr.forceClearTracker();
}
if (mDestroyingServices.remove(sr)) {
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "killServices remove destroying " + sr);
}
@@ -5056,7 +5058,9 @@ public final class ActiveServices {
i--;
ServiceRecord sr = mDestroyingServices.get(i);
if (sr.app == app) {
sr.forceClearTracker();
synchronized (mAm.mProcessStats.mLock) {
sr.forceClearTracker();
}
mDestroyingServices.remove(i);
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "killServices remove destroying " + sr);
}