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

Commit b286e715 authored by Shashwat Razdan's avatar Shashwat Razdan Committed by Android (Google) Code Review
Browse files

Merge "Adding a permission based check in SmartspaceManagerService Test: Added...

Merge "Adding a permission based check in SmartspaceManagerService Test: Added the permission to SysUI and checked that it is working Bug: 182330864" into sc-dev
parents 884614ff dc1662c6
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.smartspace;
import static android.Manifest.permission.MANAGE_SMARTSPACE;
import static android.app.ActivityManagerInternal.ALLOW_NON_FULL;
import static android.content.Context.SMARTSPACE_SERVICE;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -161,11 +162,13 @@ public class SmartspaceManagerService extends
                Slog.d(TAG, "runForUserLocked:" + func + " from pid=" + Binder.getCallingPid()
                        + ", uid=" + Binder.getCallingUid());
            }
            if (!(mServiceNameResolver.isTemporary(userId)
            Context ctx = getContext();
            if (!(ctx.checkCallingPermission(MANAGE_SMARTSPACE) == PERMISSION_GRANTED
                    || mServiceNameResolver.isTemporary(userId)
                    || mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid()))) {

                String msg = "Permission Denial: " + func + " from pid=" + Binder.getCallingPid()
                        + ", uid=" + Binder.getCallingUid();
                String msg = "Permission Denial: Cannot call " + func + " from pid="
                        + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid();
                Slog.w(TAG, msg);
                throw new SecurityException(msg);
            }