diff options
author | 2021-06-14 21:02:13 +0000 | |
---|---|---|
committer | 2021-06-14 21:02:13 +0000 | |
commit | f6f5306420a41f501e90c6fa50c0f81a2f3e5de8 (patch) | |
tree | 1aeca0dafb5f166e32b7377c28c03f014e5a9792 | |
parent | d7c200c29a9589d5d3ec0352d186312cd46031a7 (diff) | |
parent | 3ed6e5dbcd1398f2712cfbd4d90102c562da14f0 (diff) |
Merge "Move permission enforcement to onCommand" into sc-dev am: fe219c9698 am: 3ed6e5dbcd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14958560
Change-Id: I57de9ba753356b0d1d64b7b87673abfced30f685
-rw-r--r-- | services/core/java/com/android/server/location/contexthub/ContextHubShellCommand.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubShellCommand.java b/services/core/java/com/android/server/location/contexthub/ContextHubShellCommand.java index 5ec85e661b98..6931baa948a1 100644 --- a/services/core/java/com/android/server/location/contexthub/ContextHubShellCommand.java +++ b/services/core/java/com/android/server/location/contexthub/ContextHubShellCommand.java @@ -32,16 +32,18 @@ public class ContextHubShellCommand extends ShellCommand { // Internal service impl -- must perform security checks before touching. private final ContextHubService mInternal; + private final Context mContext; public ContextHubShellCommand(Context context, ContextHubService service) { mInternal = service; - - context.enforceCallingOrSelfPermission( - android.Manifest.permission.ACCESS_CONTEXT_HUB, "ContextHubShellCommand"); + mContext = context; } @Override public int onCommand(String cmd) { + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.ACCESS_CONTEXT_HUB, "ContextHubShellCommand"); + if ("deny".equals(cmd)) { return runDisableAuth(); } |