summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/location/contexthub/ContextHubShellCommand.java8
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();
}