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

Commit da0f751e authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Merge "Update caller check to support multiple users in bluetooth utils" into...

Merge "Update caller check to support multiple users in bluetooth utils" into rvc-dev am: b4dfcfc1 am: 8c2ca27e am: e6e7602d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/11763155

Change-Id: I5745b0e5a15fa3869de82538802a40803161bc77
parents 8063ab62 e6e7602d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -334,8 +334,9 @@ public final class Utils {
    public static boolean checkCaller() {
        int callingUser = UserHandle.getCallingUserId();
        int callingUid = Binder.getCallingUid();
        return (sForegroundUserId == callingUser) || (sSystemUiUid == callingUid)
                || (Process.SYSTEM_UID == callingUid);
        return (sForegroundUserId == callingUser)
                || (UserHandle.getAppId(sSystemUiUid) == UserHandle.getAppId(callingUid))
                || (UserHandle.getAppId(Process.SYSTEM_UID) == UserHandle.getAppId(callingUid));
    }

    public static boolean checkCallerAllowManagedProfiles(Context mContext) {
@@ -354,7 +355,8 @@ public final class Utils {

            // Always allow SystemUI/System access.
            return (sForegroundUserId == callingUser) || (sForegroundUserId == parentUser)
                    || (sSystemUiUid == callingUid) || (Process.SYSTEM_UID == callingUid);
                    || (UserHandle.getAppId(sSystemUiUid) == UserHandle.getAppId(callingUid))
                    || (UserHandle.getAppId(Process.SYSTEM_UID) == UserHandle.getAppId(callingUid));
        } catch (Exception ex) {
            Log.e(TAG, "checkCallerAllowManagedProfiles: Exception ex=" + ex);
            return false;