Merge "Fix CountryDetector NPE" into klp-dev
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java
index e3c664b..f6143ed 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfo.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfo.java
@@ -581,6 +581,10 @@
return countryIso;
}
+ protected static String getCurrentCountryIso(Context context) {
+ return getCurrentCountryIso(context, Locale.getDefault());
+ }
+
/**
* @return a string debug representation of this instance.
*/
diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
index dd5f644..c63be91 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
+++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
@@ -20,7 +20,6 @@
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
-import android.location.CountryDetector;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
@@ -271,11 +270,9 @@
// Use the number entered by the user for display.
if (!TextUtils.isEmpty(cw.number)) {
- CountryDetector detector = (CountryDetector) mQueryContext.getSystemService(
- Context.COUNTRY_DETECTOR);
mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number,
mCallerInfo.normalizedNumber,
- detector.detectCountry().getCountryIso());
+ CallerInfo.getCurrentCountryIso(mQueryContext));
}
}