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

Commit 55e53393 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 24D1-dev

parents 76bee04c 04c4948b
Loading
Loading
Loading
Loading
+81 −83
Original line number Diff line number Diff line
@@ -3313,7 +3313,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) {
@@ -3321,13 +3327,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:
@@ -3360,8 +3359,8 @@ public class OomAdjuster {
                                mService.scheduleAsFifoPriority(renderThreadTid,
                                        /* suppressLogs */true);
                                if (DEBUG_OOM_ADJ) {
                                        Slog.d("UI_FIFO", "Set RenderThread (TID " +
                                                renderThreadTid + ") to FIFO");
                                    Slog.d("UI_FIFO", "Set RenderThread (TID "
                                            + renderThreadTid + ") to FIFO");
                                }
                            } else {
                                if (DEBUG_OOM_ADJ) {
@@ -3415,7 +3414,6 @@ public class OomAdjuster {
                }
            }
        }
        }
        if (state.hasRepForegroundActivities() != state.hasForegroundActivities()) {
            state.setRepForegroundActivities(state.hasForegroundActivities());
            changes |= ActivityManagerService.ProcessChangeItem.CHANGE_ACTIVITIES;