Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bc40430 authored by Nate Myren's avatar Nate Myren Committed by Automerger Merge Worker
Browse files

Merge "Ensure paused ops are finished correctly" into sc-dev am: 477fdc1a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14523044

Change-Id: I1f39283df48c0d71736219d7a33425ee58290858
parents 394d54fb 477fdc1a
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -1085,7 +1085,7 @@ public class AppOpsService extends IAppOpsService.Stub {
            }
            }


            // no need to record a paused event finishing.
            // no need to record a paused event finishing.
            InProgressStartOpEvent event = mInProgressEvents.valueAt(indexOfToken);
            InProgressStartOpEvent event = mPausedInProgressEvents.valueAt(indexOfToken);
            event.numUnfinishedStarts--;
            event.numUnfinishedStarts--;
            if (event.numUnfinishedStarts == 0) {
            if (event.numUnfinishedStarts == 0) {
                mPausedInProgressEvents.removeAt(indexOfToken);
                mPausedInProgressEvents.removeAt(indexOfToken);
@@ -1282,6 +1282,10 @@ public class AppOpsService extends IAppOpsService.Stub {
            return mInProgressEvents != null;
            return mInProgressEvents != null;
        }
        }


        public boolean isPaused() {
            return mPausedInProgressEvents != null;
        }

        boolean hasAnyTime() {
        boolean hasAnyTime() {
            return (mAccessEvents != null && mAccessEvents.size() > 0)
            return (mAccessEvents != null && mAccessEvents.size() > 0)
                    || (mRejectEvents != null && mRejectEvents.size() > 0);
                    || (mRejectEvents != null && mRejectEvents.size() > 0);
@@ -3953,7 +3957,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                return;
                return;
            }
            }


            if (attributedOp.isRunning()) {
            if (attributedOp.isRunning() || attributedOp.isPaused()) {
                attributedOp.finished(clientId);
                attributedOp.finished(clientId);
            } else {
            } else {
                Slog.e(TAG, "Operation not started: uid=" + uid + " pkg=" + packageName + "("
                Slog.e(TAG, "Operation not started: uid=" + uid + " pkg=" + packageName + "("