Potential fix for NPE in Running services.
Bug: 5698270 Loop was removing items from the list being iterated. Change-Id: I39e98c554b2fe6024381afbe79b737b812e78f08
This commit is contained in:
@@ -815,7 +815,7 @@ public class RunningState {
|
|||||||
// Build the chains from client processes to the process they are
|
// Build the chains from client processes to the process they are
|
||||||
// dependent on; also remove any old running processes.
|
// dependent on; also remove any old running processes.
|
||||||
int NRP = mRunningProcesses.size();
|
int NRP = mRunningProcesses.size();
|
||||||
for (int i=0; i<NRP; i++) {
|
for (int i = 0; i < NRP;) {
|
||||||
ProcessItem proc = mRunningProcesses.valueAt(i);
|
ProcessItem proc = mRunningProcesses.valueAt(i);
|
||||||
if (proc.mRunningSeq == mSequence) {
|
if (proc.mRunningSeq == mSequence) {
|
||||||
int clientPid = proc.mRunningProcessInfo.importanceReasonPid;
|
int clientPid = proc.mRunningProcessInfo.importanceReasonPid;
|
||||||
@@ -833,9 +833,11 @@ public class RunningState {
|
|||||||
// we will detect the change.
|
// we will detect the change.
|
||||||
proc.mClient = null;
|
proc.mClient = null;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
} else {
|
} else {
|
||||||
changed = true;
|
changed = true;
|
||||||
mRunningProcesses.remove(mRunningProcesses.keyAt(i));
|
mRunningProcesses.remove(mRunningProcesses.keyAt(i));
|
||||||
|
NRP--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user