Merge "Check if app's ntwk state will be changed before updating procstate." am: 36b9bc8e4b am: a27cba0c10 am: afbfc9f7ec

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

Change-Id: I8f9d72abb45b1ca508b36adec00ff4e87193e6d4
This commit is contained in:
Sudheer Shanka
2022-03-18 02:08:24 +00:00
committed by Automerger Merge Worker

View File

@@ -407,7 +407,6 @@ public class OomAdjuster {
uids.clear();
uids.put(uidRec.getUid(), uidRec);
updateUidsLSP(uids, SystemClock.elapsedRealtime());
mProcessList.incrementProcStateSeqAndNotifyAppsLOSP(uids);
}
}
@@ -1144,8 +1143,6 @@ public class OomAdjuster {
}
}
mProcessList.incrementProcStateSeqAndNotifyAppsLOSP(activeUids);
return mService.mAppProfiler.updateLowMemStateLSP(numCached, numEmpty, numTrimming);
}
@@ -1180,6 +1177,11 @@ public class OomAdjuster {
@GuardedBy({"mService", "mProcLock"})
private void updateUidsLSP(ActiveUids activeUids, final long nowElapsed) {
// This compares previously set procstate to the current procstate in regards to whether
// or not the app's network access will be blocked. So, this needs to be called before
// we update the UidRecord's procstate by calling {@link UidRecord#setSetProcState}.
mProcessList.incrementProcStateSeqAndNotifyAppsLOSP(activeUids);
ArrayList<UidRecord> becameIdle = mTmpBecameIdle;
becameIdle.clear();