Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2556236f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix issue #65359137: Apps with target API 26 can bypass background..." into oc-mr1-dev

parents 8c3ce8d6 a857e65c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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() {