Loading telephony/common/android/telephony/LocationAccessPolicy.java +4 −13 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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 Loading telephony/common/com/android/internal/telephony/TelephonyPermissions.java +4 −13 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } } /** Loading @@ -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; } } } Loading
telephony/common/android/telephony/LocationAccessPolicy.java +4 −13 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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 Loading
telephony/common/com/android/internal/telephony/TelephonyPermissions.java +4 −13 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } } /** Loading @@ -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; } } }