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

Commit be256770 authored by riddle_hsu's avatar riddle_hsu Committed by Steve Kondik
Browse files

[ActivityManager] Fix index out of bounds when updating next pss time.

Symptom:
System server crash.

Root Cause:
The value curProcState for array index is -1 if the process has not attached yet.

Solution:
Skip compute for process which is not attached or have invalid curProcState.

Change-Id: I71aaf45bb78d73097ebe9dfebf76b72f2d243232
parent 15f34ed9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -15216,6 +15216,9 @@ public final class ActivityManagerService extends ActivityManagerNative
        mPendingPssProcesses.clear();
        for (int i=mLruProcesses.size()-1; i>=0; i--) {
            ProcessRecord app = mLruProcesses.get(i);
            if (app.thread == null || app.curProcState < 0) {
                continue;
            }
            if (memLowered || now > (app.lastStateTime+ProcessList.PSS_ALL_INTERVAL)) {
                app.pssProcState = app.setProcState;
                app.nextPssTime = ProcessList.computeNextPssTime(app.curProcState, true,