Merge "Modify the deprecation of PhoneNumberUtil isEmergencyNumber"

This commit is contained in:
Shuo Qian
2019-04-03 22:18:31 +00:00
committed by Gerrit Code Review

View File

@@ -2016,7 +2016,16 @@ public class PhoneNumberUtils {
private static boolean isEmergencyNumberInternal(int subId, String number,
String defaultCountryIso,
boolean useExactMatch) {
return TelephonyManager.getDefault().isEmergencyNumber(number);
try {
if (useExactMatch) {
return TelephonyManager.getDefault().isEmergencyNumber(number);
} else {
return TelephonyManager.getDefault().isPotentialEmergencyNumber(number);
}
} catch (RuntimeException ex) {
Rlog.e(LOG_TAG, "isEmergencyNumberInternal: RuntimeException: " + ex);
}
return false;
}
/**