From c69f5be0ed3529564e5db6874de52775c2c99007 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Mon, 2 Aug 2010 11:05:28 -0700 Subject: Add PhoneSubInfo.getCompleteVoiceMailNumber. PhoneSubInfo.getVoiceMailNumber now returns only the network portion of the voicemail number. Use the new method PhoneSubInfo.getCompleteVoiceMailNumber to get the netowrk portion and the post dial portion. Bug: 2881483 Change-Id: I7637d4fa0ffa046b4eebc4d599719bb668c940b5 --- .../java/android/telephony/PhoneNumberUtils.java | 4 ++-- .../java/android/telephony/TelephonyManager.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 32e7176..55d25a5 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -135,9 +135,9 @@ public class PhoneNumberUtils } // TODO: We don't check for SecurityException here (requires - // READ_PHONE_STATE permission). + // CALL_PRIVILEGED permission). if (scheme.equals("voicemail")) { - return TelephonyManager.getDefault().getVoiceMailNumber(); + return TelephonyManager.getDefault().getCompleteVoiceMailNumber(); } if (context == null) { diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index f018d10..4ee9560 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -659,6 +659,25 @@ public class TelephonyManager { } /** + * Returns the complete voice mail number. Return null if it is unavailable. + *

+ * Requires Permission: + * {@link android.Manifest.permission#CALL_PRIVILEGED CALL_PRIVILEGED} + * + * @hide + */ + public String getCompleteVoiceMailNumber() { + try { + return getSubscriberInfo().getCompleteVoiceMailNumber(); + } catch (RemoteException ex) { + return null; + } catch (NullPointerException ex) { + // This could happen before phone restarts due to crashing + return null; + } + } + + /** * Returns the voice mail count. Return 0 if unavailable. *

* Requires Permission: -- cgit v1.1