diff options
author | 2021-06-14 20:52:32 +0000 | |
---|---|---|
committer | 2021-06-14 20:52:32 +0000 | |
commit | 3ed6e5dbcd1398f2712cfbd4d90102c562da14f0 (patch) | |
tree | 04352ced9bd4e6f61ed6d0512c7a9d0054f1b8ad | |
parent | cc99de31d4e4c0ffcbc95fc8229309020c8c57be (diff) | |
parent | fe219c9698050d6c4a967222fbd0ca627d1f6078 (diff) |
Merge "Move permission enforcement to onCommand" into sc-dev am: fe219c9698
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14958560
Change-Id: I095dcd7eeebcb61d6b9c410244dd9f9ce31beb62
-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(); } |