Loading telephony/java/android/telephony/TelephonyManager.java +32 −27 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import android.net.NetworkStats; import android.net.Uri; import android.os.AsyncTask; import android.os.BatteryStats; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.PersistableBundle; Loading Loading @@ -1312,9 +1311,10 @@ public class TelephonyManager { * Returns the unique device ID, for example, the IMEI for GSM and the MEID * or ESN for CDMA phones. Return null if device ID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * Loading @@ -1322,7 +1322,7 @@ public class TelephonyManager { * MEID for CDMA. */ @Deprecated @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceId() { try { Loading @@ -1341,9 +1341,10 @@ public class TelephonyManager { * Returns the unique device ID of a subscription, for example, the IMEI for * GSM and the MEID for CDMA phones. Return null if device ID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * Loading @@ -1353,7 +1354,7 @@ public class TelephonyManager { * MEID for CDMA. */ @Deprecated @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceId(int slotIndex) { // FIXME this assumes phoneId == slotIndex Loading @@ -1373,13 +1374,14 @@ public class TelephonyManager { * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not * available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getImei() { return getImei(getSlotIndex()); Loading @@ -1389,15 +1391,16 @@ public class TelephonyManager { * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not * available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * * @param slotIndex of which IMEI is returned */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getImei(int slotIndex) { ITelephony telephony = getITelephony(); Loading Loading @@ -1442,13 +1445,14 @@ public class TelephonyManager { /** * Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getMeid() { return getMeid(getSlotIndex()); Loading @@ -1457,15 +1461,16 @@ public class TelephonyManager { /** * Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * * @param slotIndex of which MEID is returned */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getMeid(int slotIndex) { ITelephony telephony = getITelephony(); Loading Loading @@ -2963,7 +2968,7 @@ public class TelephonyManager { * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSimSerialNumber() { return getSimSerialNumber(getSubId()); Loading Loading @@ -3125,7 +3130,7 @@ public class TelephonyManager { * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSubscriberId() { return getSubscriberId(getSubId()); Loading telephony/java/com/android/internal/telephony/TelephonyPermissions.java +7 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,13 @@ public final class TelephonyPermissions { if (checkReadDeviceIdentifiers(context, pid, uid, callingPackage)) { return true; } // Calling packages with carrier privileges will also have access to device identifiers, but // this may be removed in a future release. if (SubscriptionManager.isValidSubscriptionId(subId) && getCarrierPrivilegeStatus( TELEPHONY_SUPPLIER, subId, uid) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) { return true; } // else the calling package is not authorized to access the device identifiers; call // a central method to report the failure based on the target SDK and if the calling package // has the READ_PHONE_STATE permission or carrier privileges that were previously required Loading Loading
telephony/java/android/telephony/TelephonyManager.java +32 −27 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import android.net.NetworkStats; import android.net.Uri; import android.os.AsyncTask; import android.os.BatteryStats; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.PersistableBundle; Loading Loading @@ -1312,9 +1311,10 @@ public class TelephonyManager { * Returns the unique device ID, for example, the IMEI for GSM and the MEID * or ESN for CDMA phones. Return null if device ID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * Loading @@ -1322,7 +1322,7 @@ public class TelephonyManager { * MEID for CDMA. */ @Deprecated @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceId() { try { Loading @@ -1341,9 +1341,10 @@ public class TelephonyManager { * Returns the unique device ID of a subscription, for example, the IMEI for * GSM and the MEID for CDMA phones. Return null if device ID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * Loading @@ -1353,7 +1354,7 @@ public class TelephonyManager { * MEID for CDMA. */ @Deprecated @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceId(int slotIndex) { // FIXME this assumes phoneId == slotIndex Loading @@ -1373,13 +1374,14 @@ public class TelephonyManager { * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not * available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getImei() { return getImei(getSlotIndex()); Loading @@ -1389,15 +1391,16 @@ public class TelephonyManager { * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not * available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * * @param slotIndex of which IMEI is returned */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getImei(int slotIndex) { ITelephony telephony = getITelephony(); Loading Loading @@ -1442,13 +1445,14 @@ public class TelephonyManager { /** * Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getMeid() { return getMeid(getSlotIndex()); Loading @@ -1457,15 +1461,16 @@ public class TelephonyManager { /** * Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available. * * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, or for the calling package to be the * device or profile owner and have the READ_PHONE_STATE permission. The profile owner is an app * that owns a managed profile on the device; for more details see <a * <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or * profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a * managed profile on the device; for more details see <a * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. * * @param slotIndex of which MEID is returned */ @SuppressAutoDoc // No support for device / profile owner. @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getMeid(int slotIndex) { ITelephony telephony = getITelephony(); Loading Loading @@ -2963,7 +2968,7 @@ public class TelephonyManager { * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSimSerialNumber() { return getSimSerialNumber(getSubId()); Loading Loading @@ -3125,7 +3130,7 @@ public class TelephonyManager { * href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner * access is deprecated and will be removed in a future release. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSubscriberId() { return getSubscriberId(getSubId()); Loading
telephony/java/com/android/internal/telephony/TelephonyPermissions.java +7 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,13 @@ public final class TelephonyPermissions { if (checkReadDeviceIdentifiers(context, pid, uid, callingPackage)) { return true; } // Calling packages with carrier privileges will also have access to device identifiers, but // this may be removed in a future release. if (SubscriptionManager.isValidSubscriptionId(subId) && getCarrierPrivilegeStatus( TELEPHONY_SUPPLIER, subId, uid) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) { return true; } // else the calling package is not authorized to access the device identifiers; call // a central method to report the failure based on the target SDK and if the calling package // has the READ_PHONE_STATE permission or carrier privileges that were previously required Loading