summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jing Ji <jji@google.com> 2019-08-20 16:49:08 -0700
committer Jing Ji <jji@google.com> 2019-09-09 10:53:13 -0700
commit6bd77ab542d19efbb1907c08b83d34cbeedc9cfe (patch)
tree64f69edd385523f8a327dd9db5c771f831fe33dd
parent8a91775d3f98ee16dc5876729d0523b058bfe0f2 (diff)
Proper fix for the LRU IndexOutOfBoundsException
Previous fix for b/126427214 would result that the target process being inserted gets falling out of the "Activities" section. A proper fix should be in the remove LRU process part. Also fixed an issue during the update of client activities: when the sub proc should be sitting at the end of the group, ineeded it's getting inserted to a position before end index which could be pointing to a different process group, therefore the end result would be "mixed" group. Bug: 139765319 Test: atest CtsAppTestCases:ServiceTest\#testActivityServiceBindingLru manual: launch many apps and check the activity lru dump. Change-Id: Ic56e38854837a07b8dabd1d19ba35eb1bfe4fd7a Merged-In: Ic56e38854837a07b8dabd1d19ba35eb1bfe4fd7a
-rw-r--r--services/core/java/com/android/server/am/ProcessList.java15
1 files changed, 3 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index b399971d1ad5..838e7d3c0208 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2094,10 +2094,10 @@ public final class ProcessList {
}
}
}
- if (lrui <= mLruProcessActivityStart) {
+ if (lrui < mLruProcessActivityStart) {
mLruProcessActivityStart--;
}
- if (lrui <= mLruProcessServiceStart) {
+ if (lrui < mLruProcessServiceStart) {
mLruProcessServiceStart--;
}
mLruProcesses.remove(lrui);
@@ -2629,7 +2629,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 @ "
@@ -2874,15 +2874,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;