Deprecate get/setLine1Number in favor of get/setPhoneNumber

Bug: 193539271
Test: make
Change-Id: I09bcdca9d44d6b6a6d4ca00b6d0bba4c45a39bac
Merged-In: I09bcdca9d44d6b6a6d4ca00b6d0bba4c45a39bac
(cherry picked from commit 8665b5105e)
This commit is contained in:
Meng Wang
2021-11-18 15:13:43 -08:00
parent 692533e342
commit 3e436616c6
4 changed files with 20 additions and 4 deletions

View File

@@ -40514,7 +40514,7 @@ package android.telecom {
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts();
method public String getDefaultDialerPackage(); method public String getDefaultDialerPackage();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(String); 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 public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
method public android.telecom.PhoneAccountHandle getSimCallManager(); method public android.telecom.PhoneAccountHandle getSimCallManager();
@@ -42579,7 +42579,7 @@ package android.telephony {
method @Nullable public String getMccString(); method @Nullable public String getMccString();
method @Deprecated public int getMnc(); method @Deprecated public int getMnc();
method @Nullable public String getMncString(); method @Nullable public String getMncString();
method public String getNumber(); method @Deprecated public String getNumber();
method public int getPortIndex(); method public int getPortIndex();
method public int getSimSlotIndex(); method public int getSimSlotIndex();
method public int getSubscriptionId(); method public int getSubscriptionId();
@@ -42834,7 +42834,7 @@ package android.telephony {
method public String getIccAuthentication(int, int, String); 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();
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei(int); 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 @NonNull @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public String getManualNetworkSelectionPlmn();
method @Nullable public String getManufacturerCode(); method @Nullable public String getManufacturerCode();
method @Nullable public String getManufacturerCode(int); method @Nullable public String getManufacturerCode(int);
@@ -42922,7 +42922,7 @@ package android.telephony {
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean); 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 void setDataEnabledForReason(int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List<java.lang.String>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List<java.lang.String>);
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 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(String, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, boolean, int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, boolean, int);

View File

@@ -1687,7 +1687,11 @@ public class TelecomManager {
* *
* @param accountHandle The handle for the account retrieve a number for. * @param accountHandle The handle for the account retrieve a number for.
* @return A string representation of the line 1 phone number. * @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 @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges or default SMS app
@RequiresPermission(anyOf = { @RequiresPermission(anyOf = {
android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE,

View File

@@ -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 * @return the number of this subscription, or an empty string if one of these requirements is
* not met * not met
* @deprecated use {@link SubscriptionManager#getPhoneNumber(int)} instead, which takes a
* {@link #getSubscriptionId() subscription ID}.
*/ */
@Deprecated
public String getNumber() { public String getNumber() {
return mNumber; return mNumber;
} }

View File

@@ -4801,7 +4801,10 @@ public class TelephonyManager {
* for any API level. * for any API level.
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
* for apps targeting SDK API level 29 and below. * 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 @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges or default SMS app
@RequiresPermission(anyOf = { @RequiresPermission(anyOf = {
android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE,
@@ -4874,7 +4877,9 @@ public class TelephonyManager {
* @param alphaTag alpha-tagging of the dailing nubmer * @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number * @param number The dialing number
* @return true if the operation was executed correctly. * @return true if the operation was executed correctly.
* @deprecated use {@link SubscriptionManager#setCarrierPhoneNumber(int, String)} instead.
*/ */
@Deprecated
public boolean setLine1NumberForDisplay(String alphaTag, String number) { public boolean setLine1NumberForDisplay(String alphaTag, String number) {
return setLine1NumberForDisplay(getSubId(), alphaTag, number); return setLine1NumberForDisplay(getSubId(), alphaTag, number);
} }
@@ -4895,6 +4900,10 @@ public class TelephonyManager {
*/ */
public boolean setLine1NumberForDisplay(int subId, String alphaTag, String number) { public boolean setLine1NumberForDisplay(int subId, String alphaTag, String number) {
try { 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(); ITelephony telephony = getITelephony();
if (telephony != null) if (telephony != null)
return telephony.setLine1NumberForDisplayForSubscriber(subId, alphaTag, number); return telephony.setLine1NumberForDisplayForSubscriber(subId, alphaTag, number);