Loading core/java/android/app/AppOpsManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.app.usage.UsageStatsManager; import android.compat.Compatibility; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledAfter; import android.compat.annotation.UnsupportedAppUsage; Loading Loading @@ -385,6 +386,13 @@ public class AppOpsManager { */ public static final int WATCH_FOREGROUND_CHANGES = 1 << 0; /** * Flag for {@link #startWatchingMode} that causes the callback to happen on the switch-op * instead the op the callback was registered. (This simulates pre-R behavior). * * @hide */ public static final int CALL_BACK_ON_SWITCHED_OP = 1 << 1; /** * Flag to determine whether we should log noteOp/startOp calls to make sure they Loading Loading @@ -6712,6 +6720,13 @@ public class AppOpsManager { }; mModeWatchers.put(callback, cb); } // See CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE if (!Compatibility.isChangeEnabled( CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE)) { flags |= CALL_BACK_ON_SWITCHED_OP; } try { mService.startWatchingModeWithFlags(op, packageName, flags, cb); } catch (RemoteException e) { Loading services/core/java/com/android/server/appop/AppOpsService.java +2 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.server.appop; import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_CAMERA; import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_LOCATION; import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_MICROPHONE; import static android.app.AppOpsManager.CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE; import static android.app.AppOpsManager.CALL_BACK_ON_SWITCHED_OP; import static android.app.AppOpsManager.FILTER_BY_FEATURE_ID; import static android.app.AppOpsManager.FILTER_BY_OP_NAMES; import static android.app.AppOpsManager.FILTER_BY_PACKAGE_NAME; Loading Loading @@ -87,7 +87,6 @@ import android.app.AppOpsManagerInternal.CheckOpsDelegate; import android.app.AsyncNotedAppOp; import android.app.RuntimeAppOpAccessMessage; import android.app.SyncNotedAppOp; import android.compat.Compatibility; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; Loading Loading @@ -2679,10 +2678,8 @@ public class AppOpsService extends IAppOpsService.Stub { synchronized (this) { int switchOp = (op != AppOpsManager.OP_NONE) ? AppOpsManager.opToSwitch(op) : op; // See CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE int notifiedOps; if (Compatibility.isChangeEnabled( CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE)) { if ((flags & CALL_BACK_ON_SWITCHED_OP) == 0) { if (op == OP_NONE) { notifiedOps = ALL_OPS; } else { Loading Loading
core/java/android/app/AppOpsManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.app.usage.UsageStatsManager; import android.compat.Compatibility; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledAfter; import android.compat.annotation.UnsupportedAppUsage; Loading Loading @@ -385,6 +386,13 @@ public class AppOpsManager { */ public static final int WATCH_FOREGROUND_CHANGES = 1 << 0; /** * Flag for {@link #startWatchingMode} that causes the callback to happen on the switch-op * instead the op the callback was registered. (This simulates pre-R behavior). * * @hide */ public static final int CALL_BACK_ON_SWITCHED_OP = 1 << 1; /** * Flag to determine whether we should log noteOp/startOp calls to make sure they Loading Loading @@ -6712,6 +6720,13 @@ public class AppOpsManager { }; mModeWatchers.put(callback, cb); } // See CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE if (!Compatibility.isChangeEnabled( CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE)) { flags |= CALL_BACK_ON_SWITCHED_OP; } try { mService.startWatchingModeWithFlags(op, packageName, flags, cb); } catch (RemoteException e) { Loading
services/core/java/com/android/server/appop/AppOpsService.java +2 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.server.appop; import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_CAMERA; import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_LOCATION; import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_MICROPHONE; import static android.app.AppOpsManager.CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE; import static android.app.AppOpsManager.CALL_BACK_ON_SWITCHED_OP; import static android.app.AppOpsManager.FILTER_BY_FEATURE_ID; import static android.app.AppOpsManager.FILTER_BY_OP_NAMES; import static android.app.AppOpsManager.FILTER_BY_PACKAGE_NAME; Loading Loading @@ -87,7 +87,6 @@ import android.app.AppOpsManagerInternal.CheckOpsDelegate; import android.app.AsyncNotedAppOp; import android.app.RuntimeAppOpAccessMessage; import android.app.SyncNotedAppOp; import android.compat.Compatibility; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; Loading Loading @@ -2679,10 +2678,8 @@ public class AppOpsService extends IAppOpsService.Stub { synchronized (this) { int switchOp = (op != AppOpsManager.OP_NONE) ? AppOpsManager.opToSwitch(op) : op; // See CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE int notifiedOps; if (Compatibility.isChangeEnabled( CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE)) { if ((flags & CALL_BACK_ON_SWITCHED_OP) == 0) { if (op == OP_NONE) { notifiedOps = ALL_OPS; } else { Loading