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: Ie0f7d9ff60ee77803485345da0673d31b2f9a7ca
This commit is contained in:
TreeHugger Robot
2021-06-14 20:52:16 +00:00
committed by Automerger Merge Worker

View File

@@ -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();
}