Merge "Allow 1st party app to set Line 1 number for display purpose."

This commit is contained in:
Derek Tan
2014-07-12 21:35:47 +00:00
committed by Android (Google) Code Review
2 changed files with 90 additions and 0 deletions

View File

@@ -1695,6 +1695,15 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getLine1Number(long subId) {
String number = null;
try {
number = getITelephony().getLine1NumberForDisplay(subId);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
if (number != null) {
return number;
}
try {
return getSubscriberInfo().getLine1NumberUsingSubId(subId);
} catch (RemoteException ex) {
@@ -1705,6 +1714,47 @@ public class TelephonyManager {
}
}
/**
* Set the phone number string and its alphatag for line 1 for display
* purpose only, for example, displayed in Phone Status. It won't change
* the actual MSISDN/MDN. This setting won't be persisted during power cycle
* and it should be set again after reboot.
* <p>
* Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number
*
* @hide
*/
public void setLine1NumberForDisplay(String alphaTag, String number) {
setLine1NumberForDisplay(getDefaultSubscription(), alphaTag, number);
}
/**
* Set the phone number string and its alphatag for line 1 for display
* purpose only, for example, displayed in Phone Status. It won't change
* the actual MSISDN/MDN. This setting won't be persisted during power cycle
* and it should be set again after reboot.
* <p>
* Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* @param subId the subscriber that the alphatag and dialing number belongs to.
* @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number
*
* @hide
*/
public void setLine1NumberForDisplay(long subId, String alphaTag, String number) {
try {
getITelephony().setLine1NumberForDisplay(subId, alphaTag, number);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
}
/**
* Returns the alphabetic identifier associated with the line 1 number.
* Return null if it is unavailable.
@@ -1730,6 +1780,15 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getLine1AlphaTag(long subId) {
String alphaTag = null;
try {
alphaTag = getITelephony().getLine1AlphaTagForDisplay(subId);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
if (alphaTag != null) {
return alphaTag;
}
try {
return getSubscriberInfo().getLine1AlphaTagUsingSubId(subId);
} catch (RemoteException ex) {

View File

@@ -675,5 +675,36 @@ interface ITelephony {
* @return true if the simplified UI is enabled.
*/
boolean getSimplifiedNetworkSettingsEnabled(long subId);
/**
* Set the phone number string and its alphatag for line 1 for display
* purpose only, for example, displayed in Phone Status. It won't change
* the actual MSISDN/MDN. This setting won't be persisted during power cycle
* and it should be set again after reboot.
*
* @param subId the subscriber that the alphatag and dialing number belongs to.
* @param alphaTag alpha-tagging of the dailing nubmer
* @param number The dialing number
*/
void setLine1NumberForDisplay(long subId, String alphaTag, String number);
/**
* Returns the displayed dialing number string if it was set previously via
* {@link #setLine1NumberForDisplay}. Otherwise returns null.
*
* @param subId whose dialing number for line 1 is returned.
* @return the displayed dialing number if set, or null if not set.
*/
String getLine1NumberForDisplay(long subId);
/**
* Returns the displayed alphatag of the dialing number if it was set
* previously via {@link #setLine1NumberForDisplay}. Otherwise returns null.
*
* @param subId whose alphatag associated with line 1 is returned.
* @return the displayed alphatag of the dialing number if set, or null if
* not set.
*/
String getLine1AlphaTagForDisplay(long subId);
}