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

Commit fcd8e2d9 authored by Rambo Wang's avatar Rambo Wang Committed by Android (Google) Code Review
Browse files

Merge "Check system and phone UID in multiple-user-aware way" into main

parents 663644e6 ce6478a8
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -4498,10 +4498,17 @@ public class SubscriptionManagerService extends ISub.Stub {
     */
    @NonNull
    private String getCallingPackage() {
        if (Flags.supportPhoneUidCheckForMultiuser()) {
            if (UserHandle.isSameApp(Binder.getCallingUid(), Process.PHONE_UID)) {
                // Too many packages running with phone uid. Just return one here.
                return "com.android.phone";
            }
        } else {
            if (Binder.getCallingUid() == Process.PHONE_UID) {
                // Too many packages running with phone uid. Just return one here.
                return "com.android.phone";
            }
        }
        return Arrays.toString(mContext.getPackageManager().getPackagesForUid(
                Binder.getCallingUid()));
    }