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

Commit ed06e1d6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Move permission enforcement to onCommand" into sc-dev am: fe219c96

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14958560

Change-Id: Ie0f7d9ff60ee77803485345da0673d31b2f9a7ca
parents 1efede8a fe219c96
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -32,16 +32,18 @@ public class ContextHubShellCommand extends ShellCommand {


    // Internal service impl -- must perform security checks before touching.
    // Internal service impl -- must perform security checks before touching.
    private final ContextHubService mInternal;
    private final ContextHubService mInternal;
    private final Context mContext;


    public ContextHubShellCommand(Context context, ContextHubService service) {
    public ContextHubShellCommand(Context context, ContextHubService service) {
        mInternal = service;
        mInternal = service;

        mContext = context;
        context.enforceCallingOrSelfPermission(
                android.Manifest.permission.ACCESS_CONTEXT_HUB, "ContextHubShellCommand");
    }
    }


    @Override
    @Override
    public int onCommand(String cmd) {
    public int onCommand(String cmd) {
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.ACCESS_CONTEXT_HUB, "ContextHubShellCommand");

        if ("deny".equals(cmd)) {
        if ("deny".equals(cmd)) {
            return runDisableAuth();
            return runDisableAuth();
        }
        }