Get fresh InProgress array in AttributedAppOp when adding/removing

Otherwise, a call to finish() and then start() might reallocate the
array, and cause the reference to point to the old location of the
array.

Fixes: 208662370
Test: atest ForegroundModeAndActiveTest
Change-Id: I7e754c067520765c00cc67cc310926e63bd0462d
Merged-In: I7e754c067520765c00cc67cc310926e63bd0462d
This commit is contained in:
Nate Myren
2021-12-01 15:15:47 -08:00
parent 94ddd3853e
commit f14e212d82

View File

@@ -1314,6 +1314,7 @@ public class AppOpsService extends IAppOpsService.Stub {
event.getAttributionFlags(), event.getAttributionChainId());
}
events = isRunning ? mInProgressEvents : mPausedInProgressEvents;
InProgressStartOpEvent newEvent = events.get(binders.get(i));
if (newEvent != null) {
newEvent.numUnfinishedStarts += numPreviousUnfinishedStarts - 1;