summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hall Liu <hallliu@google.com> 2020-01-21 15:34:02 -0800
committer Hall Liu <hallliu@google.com> 2020-01-21 15:34:02 -0800
commitb49a3affb1ca8207071031a48c88b23e02df5513 (patch)
tree532f513c306582b1a281f69dde1e53c767fe1d98
parentfeaed68912533540e67b9c6c5877f2c611a94db4 (diff)
Clean up usage of CountryDetector in PhoneNumberUtils
PhoneNumberUtils calls CountryDetector methods to ascertain whether a number is an emergency number in the current country, but recent emergency number detection changes have made the country an unused parameter. Remove calls to CountryDetector to satisfy mainline requirements wrt hidden APIs. Fixes: 148087591 Test: atest PhoneNumberUtilsTest Change-Id: Ib6ef6348cb1c50e89e24f4f67de6ce76d87550cd
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java15
1 files changed, 2 insertions, 13 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 2f9e6ac0f9ff..0074772a221d 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -28,7 +28,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
-import android.location.CountryDetector;
import android.net.Uri;
import android.os.PersistableBundle;
import android.provider.Contacts;
@@ -2032,6 +2031,7 @@ public class PhoneNumberUtils {
private static boolean isEmergencyNumberInternal(int subId, String number,
String defaultCountryIso,
boolean useExactMatch) {
+ // TODO: clean up all the callers that pass in a defaultCountryIso, since it's ignored now.
try {
if (useExactMatch) {
return TelephonyManager.getDefault().isEmergencyNumber(number);
@@ -2193,18 +2193,7 @@ public class PhoneNumberUtils {
private static boolean isLocalEmergencyNumberInternal(int subId, String number,
Context context,
boolean useExactMatch) {
- String countryIso;
- CountryDetector detector = (CountryDetector) context.getSystemService(
- Context.COUNTRY_DETECTOR);
- if (detector != null && detector.detectCountry() != null) {
- countryIso = detector.detectCountry().getCountryIso();
- } else {
- Locale locale = context.getResources().getConfiguration().locale;
- countryIso = locale.getCountry();
- Rlog.w(LOG_TAG, "No CountryDetector; falling back to countryIso based on locale: "
- + countryIso);
- }
- return isEmergencyNumberInternal(subId, number, countryIso, useExactMatch);
+ return isEmergencyNumberInternal(subId, number, null /* unused */, useExactMatch);
}
/**