From 5376edd3b18984dfdfca16d7c15bd8913c5ceba5 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 5 Jun 2018 13:21:16 -0700 Subject: [PATCH] Fix issue #109746350: startWatchingMode fails on P Remove permission check, reverting to O behavior. Bug: 109746350 Test: manual Change-Id: I643321d508abc5fac5df83f4df3605ad8252e378 --- services/core/java/com/android/server/AppOpsService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java index aa86ea8b03e2f..786d757557d16 100644 --- a/services/core/java/com/android/server/AppOpsService.java +++ b/services/core/java/com/android/server/AppOpsService.java @@ -1335,10 +1335,10 @@ public class AppOpsService extends IAppOpsService.Stub { int watchedUid = -1; final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); - if (mContext.checkCallingOrSelfPermission(Manifest.permission.WATCH_APPOPS) - != PackageManager.PERMISSION_GRANTED) { - watchedUid = callingUid; - } + // TODO: should have a privileged permission to protect this. + // Also, if the caller has requested WATCH_FOREGROUND_CHANGES, should we require + // the USAGE_STATS permission since this can provide information about when an + // app is in the foreground? Preconditions.checkArgumentInRange(op, AppOpsManager.OP_NONE, AppOpsManager._NUM_OP - 1, "Invalid op code: " + op); if (callback == null) {