Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe219c96 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move permission enforcement to onCommand" into sc-dev

parents e5bce979 7986c736
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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();
        }