diff options
| -rw-r--r-- | services/core/java/com/android/server/TelephonyRegistry.java | 3 | ||||
| -rw-r--r-- | telephony/common/android/telephony/LocationAccessPolicy.java | 18 |
2 files changed, 15 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index bc83a0edd918..bacfd8f9960e 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -921,8 +921,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { //helper function to determine if limit on num listeners applies to callingUid private boolean doesLimitApplyForListeners(int callingUid, int exemptUid) { - return (callingUid != Process.SYSTEM_UID - && callingUid != Process.PHONE_UID + return (!TelephonyPermissions.isSystemOrPhone(callingUid) && callingUid != exemptUid); } diff --git a/telephony/common/android/telephony/LocationAccessPolicy.java b/telephony/common/android/telephony/LocationAccessPolicy.java index d4b6c91eb7a0..feea55bff125 100644 --- a/telephony/common/android/telephony/LocationAccessPolicy.java +++ b/telephony/common/android/telephony/LocationAccessPolicy.java @@ -32,6 +32,8 @@ import android.os.UserHandle; 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; /** @@ -310,10 +312,18 @@ 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 (query.callingUid == Process.PHONE_UID || query.callingUid == Process.SYSTEM_UID - || query.callingUid == Process.NETWORK_STACK_UID - || query.callingUid == Process.ROOT_UID) { - return LocationPermissionResult.ALLOWED; + 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 |