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

Commit f83f743e authored by Jing Ji's avatar Jing Ji
Browse files

Check the process state for the killProcessesForRemovedTask

Upon removing tasks from the recent UI, we should check if the process
state of the target process is foreground or not, and don't kill it
if it's still in the foreground - the killing will be deferred as long
as it's falling into the background state (not perceptible anymore).

Bug: 227303045
Test: Manual
Change-Id: If2b55e5159ee3642c96f0337e82c09faaf22de10
parent 6af7e357
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16654,7 +16654,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    final WindowProcessController wpc =
                            (WindowProcessController) procsToKill.get(i);
                    final ProcessRecord pr = (ProcessRecord) wpc.mOwner;
                    if (pr.mState.getSetSchedGroup() == ProcessList.SCHED_GROUP_BACKGROUND
                    if (ActivityManager.isProcStateBackground(pr.mState.getSetProcState())
                            && pr.mReceivers.numberOfCurReceivers() == 0) {
                        pr.killLocked("remove task", ApplicationExitInfo.REASON_USER_REQUESTED,
                                ApplicationExitInfo.SUBREASON_REMOVE_TASK, true);
+1 −1
Original line number Diff line number Diff line
@@ -2604,7 +2604,7 @@ public class OomAdjuster {
                reportOomAdjMessageLocked(TAG_OOM_ADJ, msg);
            }
            if (app.getWaitingToKill() != null && app.mReceivers.numberOfCurReceivers() == 0
                    && state.getSetSchedGroup() == ProcessList.SCHED_GROUP_BACKGROUND) {
                    && ActivityManager.isProcStateBackground(state.getSetProcState())) {
                app.killLocked(app.getWaitingToKill(), ApplicationExitInfo.REASON_USER_REQUESTED,
                        ApplicationExitInfo.SUBREASON_REMOVE_TASK, true);
                success = false;