Merge "Fix ConcurrentModification in onUidStateChanged" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
46f8c13e5b
@@ -1011,10 +1011,11 @@ public class AppOpsService extends IAppOpsService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int numInProgressEvents = mInProgressEvents.size();
|
int numInProgressEvents = mInProgressEvents.size();
|
||||||
|
List<IBinder> binders = new ArrayList<>(mInProgressEvents.keySet());
|
||||||
for (int i = 0; i < numInProgressEvents; i++) {
|
for (int i = 0; i < numInProgressEvents; i++) {
|
||||||
InProgressStartOpEvent event = mInProgressEvents.valueAt(i);
|
InProgressStartOpEvent event = mInProgressEvents.get(binders.get(i));
|
||||||
|
|
||||||
if (event.getUidState() != newState) {
|
if (event != null && event.getUidState() != newState) {
|
||||||
try {
|
try {
|
||||||
// Remove all but one unfinished start count and then call finished() to
|
// Remove all but one unfinished start count and then call finished() to
|
||||||
// remove start event object
|
// remove start event object
|
||||||
@@ -1025,7 +1026,10 @@ public class AppOpsService extends IAppOpsService.Stub {
|
|||||||
// Call started() to add a new start event object and then add the
|
// Call started() to add a new start event object and then add the
|
||||||
// previously removed unfinished start counts back
|
// previously removed unfinished start counts back
|
||||||
started(event.getClientId(), newState, false);
|
started(event.getClientId(), newState, false);
|
||||||
event.numUnfinishedStarts += numPreviousUnfinishedStarts - 1;
|
InProgressStartOpEvent newEvent = mInProgressEvents.get(binders.get(i));
|
||||||
|
if (newEvent != null) {
|
||||||
|
newEvent.numUnfinishedStarts += numPreviousUnfinishedStarts - 1;
|
||||||
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
if (DEBUG) Slog.e(TAG, "Cannot switch to new uidState " + newState);
|
if (DEBUG) Slog.e(TAG, "Cannot switch to new uidState " + newState);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user