diff --git a/core/api/current.txt b/core/api/current.txt index 48d44f91dc200..cebdc249afa8d 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -40641,7 +40641,7 @@ package android.telecom { method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List getCallCapablePhoneAccounts(); method public String getDefaultDialerPackage(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(String); - method @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}, conditional=true) public String getLine1Number(android.telecom.PhoneAccountHandle); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}, conditional=true) public String getLine1Number(android.telecom.PhoneAccountHandle); method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List getSelfManagedPhoneAccounts(); method public android.telecom.PhoneAccountHandle getSimCallManager(); @@ -42709,7 +42709,7 @@ package android.telephony { method @Nullable public String getMccString(); method @Deprecated public int getMnc(); method @Nullable public String getMncString(); - method public String getNumber(); + method @Deprecated public String getNumber(); method public int getPortIndex(); method public int getSimSlotIndex(); method public int getSubscriptionId(); @@ -42964,7 +42964,7 @@ package android.telephony { method public String getIccAuthentication(int, int, String); method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei(); method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei(int); - method @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}) public String getLine1Number(); + method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}) public String getLine1Number(); method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public String getManualNetworkSelectionPlmn(); method @Nullable public String getManufacturerCode(); method @Nullable public String getManufacturerCode(int); @@ -43049,7 +43049,7 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabledForReason(int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List); - method public boolean setLine1NumberForDisplay(String, String); + method @Deprecated public boolean setLine1NumberForDisplay(String, String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNetworkSelectionModeAutomatic(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(String, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, boolean, int); diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index abbce1cd869df..98f619f497d4e 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -1687,7 +1687,11 @@ public class TelecomManager { * * @param accountHandle The handle for the account retrieve a number for. * @return A string representation of the line 1 phone number. + * @deprecated use {@link SubscriptionManager#getPhoneNumber(int)} instead, which takes a + * Telephony Subscription ID that can be retrieved with the {@code accountHandle} + * from {@link TelephonyManager#getSubscriptionId(PhoneAccountHandle)}. */ + @Deprecated @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges or default SMS app @RequiresPermission(anyOf = { android.Manifest.permission.READ_PHONE_STATE, diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index d6d6775cb40ff..d11ad914061da 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -498,7 +498,10 @@ public class SubscriptionInfo implements Parcelable { * * @return the number of this subscription, or an empty string if one of these requirements is * not met + * @deprecated use {@link SubscriptionManager#getPhoneNumber(int)} instead, which takes a + * {@link #getSubscriptionId() subscription ID}. */ + @Deprecated public String getNumber() { return mNumber; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 04e7b7c8711c5..88b21e0428b00 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4791,7 +4791,10 @@ public class TelephonyManager { * for any API level. * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * for apps targeting SDK API level 29 and below. + * + * @deprecated use {@link SubscriptionManager#getPhoneNumber(int)} instead. */ + @Deprecated @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges or default SMS app @RequiresPermission(anyOf = { android.Manifest.permission.READ_PHONE_STATE, @@ -4864,7 +4867,9 @@ public class TelephonyManager { * @param alphaTag alpha-tagging of the dailing nubmer * @param number The dialing number * @return true if the operation was executed correctly. + * @deprecated use {@link SubscriptionManager#setCarrierPhoneNumber(int, String)} instead. */ + @Deprecated public boolean setLine1NumberForDisplay(String alphaTag, String number) { return setLine1NumberForDisplay(getSubId(), alphaTag, number); } @@ -4885,6 +4890,10 @@ public class TelephonyManager { */ public boolean setLine1NumberForDisplay(int subId, String alphaTag, String number) { try { + // This API is deprecated; call the new API to allow smooth migartion. + // The new API doesn't accept null so convert null to empty string. + mSubscriptionManager.setCarrierPhoneNumber(subId, (number == null ? "" : number)); + ITelephony telephony = getITelephony(); if (telephony != null) return telephony.setLine1NumberForDisplayForSubscriber(subId, alphaTag, number);