summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-06-30 17:47:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-30 17:47:17 +0000
commit40dff5b47f52ffb648f51c395ae67193e3121a2c (patch)
treee0389e7be7b7f6660fb0d098f750a641b4d00f7e
parent392527c4cc04be275a1d055a76ee83806beb2cb9 (diff)
parent1249bdbe90102172f6e678993516203bb3a493bf (diff)
downloadframeworks_base-40dff5b47f52ffb648f51c395ae67193e3121a2c.zip
frameworks_base-40dff5b47f52ffb648f51c395ae67193e3121a2c.tar.gz
frameworks_base-40dff5b47f52ffb648f51c395ae67193e3121a2c.tar.bz2
Merge "Fix TelecomManager.isVoicemailNumber" into mnc-dev
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 3fcd7d9..d18b86a 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -2080,14 +2080,35 @@ public class PhoneNumberUtils
* @hide
*/
public static boolean isVoiceMailNumber(int subId, String number) {
- String vmNumber;
+ return isVoiceMailNumber(null, subId, number);
+ }
+ /**
+ * isVoiceMailNumber: checks a given number against the voicemail
+ * number provided by the RIL and SIM card. The caller must have
+ * the READ_PHONE_STATE credential.
+ *
+ * @param context a non-null {@link Context}.
+ * @param subId the subscription id of the SIM.
+ * @param number the number to look up.
+ * @return true if the number is in the list of voicemail. False
+ * otherwise, including if the caller does not have the permission
+ * to read the VM number.
+ * @hide
+ */
+ public static boolean isVoiceMailNumber(Context context, int subId, String number) {
+ String vmNumber;
try {
- vmNumber = TelephonyManager.getDefault().getVoiceMailNumber(subId);
+ final TelephonyManager tm;
+ if (context == null) {
+ tm = TelephonyManager.getDefault();
+ } else {
+ tm = TelephonyManager.from(context);
+ }
+ vmNumber = tm.getVoiceMailNumber(subId);
} catch (SecurityException ex) {
return false;
}
-
// Strip the separators from the number before comparing it
// to the list.
number = extractNetworkPortionAlt(number);