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

Commit 8e08da9f authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

Merge "Kill the process with pending task removal on OomAdjuster updates" into main

parents fe56a3fd a32797ce
Loading
Loading
Loading
Loading
+61 −63
Original line number Diff line number Diff line
@@ -3277,7 +3277,13 @@ public class OomAdjuster {
        }

        final int curSchedGroup = state.getCurrentSchedulingGroup();
        if (state.getSetSchedGroup() != curSchedGroup) {
        if (app.getWaitingToKill() != null && app.mReceivers.numberOfCurReceivers() == 0
                && ActivityManager.isProcStateBackground(state.getCurProcState())
                && !state.hasStartedServices()) {
            app.killLocked(app.getWaitingToKill(), ApplicationExitInfo.REASON_USER_REQUESTED,
                    ApplicationExitInfo.SUBREASON_REMOVE_TASK, true);
            success = false;
        } else if (state.getSetSchedGroup() != curSchedGroup) {
            int oldSchedGroup = state.getSetSchedGroup();
            state.setSetSchedGroup(curSchedGroup);
            if (DEBUG_SWITCH || DEBUG_OOM_ADJ || mService.mCurOomAdjUid == app.uid) {
@@ -3285,13 +3291,6 @@ public class OomAdjuster {
                        + " to " + curSchedGroup + ": " + state.getAdjType();
                reportOomAdjMessageLocked(TAG_OOM_ADJ, msg);
            }
            if (app.getWaitingToKill() != null && app.mReceivers.numberOfCurReceivers() == 0
                    && ActivityManager.isProcStateBackground(state.getSetProcState())
                    && !state.hasStartedServices()) {
                app.killLocked(app.getWaitingToKill(), ApplicationExitInfo.REASON_USER_REQUESTED,
                        ApplicationExitInfo.SUBREASON_REMOVE_TASK, true);
                success = false;
            } else {
            int processGroup;
            switch (curSchedGroup) {
                case SCHED_GROUP_BACKGROUND:
@@ -3355,7 +3354,6 @@ public class OomAdjuster {
                }
            }
        }
        }
        if (state.hasRepForegroundActivities() != state.hasForegroundActivities()) {
            state.setRepForegroundActivities(state.hasForegroundActivities());
            changes |= ActivityManagerService.ProcessChangeItem.CHANGE_ACTIVITIES;