diff options
author | Derek Tan <derektan@google.com> | 2014-07-02 17:26:02 -0700 |
---|---|---|
committer | Derek Tan <derektan@google.com> | 2014-07-12 13:36:28 -0700 |
commit | 818631b679171ffb49eaa641bee06b9c953651da (patch) | |
tree | 214c5a3ddce2d1b15b43e67bdac9c664c571e0a3 /telephony | |
parent | 9726eeb2b01a0e5a3d52139f3bc48d4690af1ea9 (diff) | |
download | frameworks_base-818631b679171ffb49eaa641bee06b9c953651da.zip frameworks_base-818631b679171ffb49eaa641bee06b9c953651da.tar.gz frameworks_base-818631b679171ffb49eaa641bee06b9c953651da.tar.bz2 |
Allow 1st party app to set Line 1 number for display purpose.
After the number is set, TelephonyManager.getLine1Number will actually
return this one instead of the actual MSISDN/MDN.
Bug: 11900806
Change-Id: I4df3fac7b483ddae2bbda14b5a85629486e400cf
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 59 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 31 |
2 files changed, 90 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 4459c36..1c84741 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -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) { @@ -1706,6 +1715,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. * <p> @@ -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) { diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 7f0203a..4592717 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -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); } |