From e5e4a8df8c500f109ad468c647408454a987eeda Mon Sep 17 00:00:00 2001 From: Nate Myren Date: Wed, 1 Dec 2021 15:15:47 -0800 Subject: [PATCH] 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 --- services/core/java/com/android/server/appop/AppOpsService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index 64b9bd98a2fc1..6d29c379d1b15 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -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;