summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nate Myren <ntmyren@google.com> 2021-05-12 15:59:31 -0700
committer Nate Myren <ntmyren@google.com> 2021-05-12 16:26:01 -0700
commit4f15c208b44eca4963c68e589323eefcc338753b (patch)
tree0c9542a35c722120b3350cc11aa183f4e42fafcc
parent06aa2b560194a7a22dc3c86605f0ef2b8abc1ce4 (diff)
Ensure paused ops are finished correctly
Fixes: 187976515 Test: atest SensorPrivacyCameraTest,SensorPrivacyMicrophoneTest Change-Id: I0f9a752d30a3330e58ff85396130d07297350533
-rw-r--r--services/core/java/com/android/server/appop/AppOpsService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index a23b5eb50b15..13dc444dc44b 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -1085,7 +1085,7 @@ public class AppOpsService extends IAppOpsService.Stub {
}
// no need to record a paused event finishing.
- InProgressStartOpEvent event = mInProgressEvents.valueAt(indexOfToken);
+ InProgressStartOpEvent event = mPausedInProgressEvents.valueAt(indexOfToken);
event.numUnfinishedStarts--;
if (event.numUnfinishedStarts == 0) {
mPausedInProgressEvents.removeAt(indexOfToken);
@@ -1282,6 +1282,10 @@ public class AppOpsService extends IAppOpsService.Stub {
return mInProgressEvents != null;
}
+ public boolean isPaused() {
+ return mPausedInProgressEvents != null;
+ }
+
boolean hasAnyTime() {
return (mAccessEvents != null && mAccessEvents.size() > 0)
|| (mRejectEvents != null && mRejectEvents.size() > 0);
@@ -3953,7 +3957,7 @@ public class AppOpsService extends IAppOpsService.Stub {
return;
}
- if (attributedOp.isRunning()) {
+ if (attributedOp.isRunning() || attributedOp.isPaused()) {
attributedOp.finished(clientId);
} else {
Slog.e(TAG, "Operation not started: uid=" + uid + " pkg=" + packageName + "("