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

Commit 4db3a196 authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

Merge "Cleaned up the flag support_phone_uid_check_for_multiuser" into main

parents 5e11b629 6f3b30eb
Loading
Loading
Loading
Loading
+4 −13
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.util.Log;
import android.widget.Toast;

import com.android.internal.telephony.TelephonyPermissions;
import com.android.internal.telephony.flags.Flags;
import com.android.internal.telephony.util.TelephonyUtils;

/**
@@ -312,19 +311,11 @@ public final class LocationAccessPolicy {
        // This avoid breaking legacy code that rely on public-facing APIs to access cell location,
        // and it doesn't create an info leak risk because the cell location is stored in the phone
        // process anyway, and the system server already has location access.
        if (Flags.supportPhoneUidCheckForMultiuser()) {
        if (TelephonyPermissions.isSystemOrPhone(query.callingUid)
                || UserHandle.isSameApp(query.callingUid, Process.NETWORK_STACK_UID)
                || UserHandle.isSameApp(query.callingUid, Process.ROOT_UID)) {
            return LocationPermissionResult.ALLOWED;
        }
        } else {
            if (query.callingUid == Process.PHONE_UID || query.callingUid == Process.SYSTEM_UID
                    || query.callingUid == Process.NETWORK_STACK_UID
                    || query.callingUid == Process.ROOT_UID) {
                return LocationPermissionResult.ALLOWED;
            }
        }

        // Check the system-wide requirements. If the location main switch is off and the caller is
        // not in the allowlist of apps that always have loation access or the app's profile
+4 −13
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.telephony.TelephonyManager;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.flags.Flags;

import java.util.HashMap;
import java.util.HashSet;
@@ -934,12 +933,8 @@ public final class TelephonyPermissions {
     * as system user or not.
     */
    public static boolean isSystemOrPhone(int uid) {
        if (Flags.supportPhoneUidCheckForMultiuser()) {
        return UserHandle.isSameApp(uid, Process.SYSTEM_UID) || UserHandle.isSameApp(uid,
                Process.PHONE_UID);
        } else {
            return uid == Process.SYSTEM_UID || uid == Process.PHONE_UID;
        }
    }

    /**
@@ -947,11 +942,7 @@ public final class TelephonyPermissions {
     * as system user or not.
     */
    public static boolean isRootOrShell(int uid) {
        if (Flags.supportPhoneUidCheckForMultiuser()) {
        return UserHandle.isSameApp(uid, Process.ROOT_UID) || UserHandle.isSameApp(uid,
                Process.SHELL_UID);
        } else {
            return uid == Process.ROOT_UID || uid == Process.SHELL_UID;
        }
    }
}