Merge "Fix issue #65359137: Apps with target API 26 can bypass background..." into oc-mr1-dev
am: 2556236f8e
Change-Id: Ib3498106274ce5a0b832d4fd7f56396979f24a75
This commit is contained in:
@@ -22875,6 +22875,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
requestPssAllProcsLocked(now, false, mProcessStats.isMemFactorLowered());
|
||||
}
|
||||
|
||||
ArrayList<UidRecord> becameIdle = null;
|
||||
|
||||
// Update from any uid changes.
|
||||
if (mLocalPowerManager != null) {
|
||||
mLocalPowerManager.startUidChanges();
|
||||
@@ -22907,6 +22909,10 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
if (uidRec.idle && !uidRec.setIdle) {
|
||||
uidChange = UidRecord.CHANGE_IDLE;
|
||||
if (becameIdle == null) {
|
||||
becameIdle = new ArrayList<>();
|
||||
}
|
||||
becameIdle.add(uidRec);
|
||||
}
|
||||
} else {
|
||||
if (uidRec.idle) {
|
||||
@@ -22938,6 +22944,14 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mLocalPowerManager.finishUidChanges();
|
||||
}
|
||||
|
||||
if (becameIdle != null) {
|
||||
// If we have any new uids that became idle this time, we need to make sure
|
||||
// they aren't left with running services.
|
||||
for (int i = becameIdle.size() - 1; i >= 0; i--) {
|
||||
mServices.stopInBackgroundLocked(becameIdle.get(i).uid);
|
||||
}
|
||||
}
|
||||
|
||||
if (mProcessStats.shouldWriteNowLocked(now)) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override public void run() {
|
||||
|
||||
Reference in New Issue
Block a user