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

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

Merge "Proper fix for the LRU IndexOutOfBoundsException"

parents 69cf7e8e d3556f1b
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue;
import android.os.Process;
import android.os.RemoteException;
import android.os.StrictMode;
@@ -101,11 +100,8 @@ import com.android.server.wm.WindowManagerService;

import dalvik.system.VMRuntime;

import libcore.io.IoUtils;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.nio.ByteBuffer;
@@ -2087,10 +2083,10 @@ public final class ProcessList {
                    }
                }
            }
            if (lrui <= mLruProcessActivityStart) {
            if (lrui < mLruProcessActivityStart) {
                mLruProcessActivityStart--;
            }
            if (lrui <= mLruProcessServiceStart) {
            if (lrui < mLruProcessServiceStart) {
                mLruProcessServiceStart--;
            }
            mLruProcesses.remove(lrui);
@@ -2622,7 +2618,7 @@ public final class ProcessList {
                        if (!moved) {
                            // Goes to the end of the group.
                            mLruProcesses.remove(i);
                            mLruProcesses.add(endIndex - 1, subProc);
                            mLruProcesses.add(endIndex, subProc);
                            if (DEBUG_LRU) Slog.d(TAG_LRU,
                                    "Moving " + subProc
                                            + " from position " + i + " to end of group @ "
@@ -2867,15 +2863,6 @@ public final class ProcessList {
                    pos--;
                }
                mLruProcesses.add(pos, app);
                if (pos == mLruProcessActivityStart) {
                    mLruProcessActivityStart++;
                }
                if (pos == mLruProcessServiceStart) {
                    // Unless {@code #hasService} is implemented, currently the starting position
                    // for activity and service are the same, so the incoming position may equal to
                    // the starting position of service.
                    mLruProcessServiceStart++;
                }
                // If this process is part of a group, need to pull up any other processes
                // in that group to be with it.
                int endIndex = pos - 1;