Merge "Fix CountryDetector NPE" into klp-dev

This commit is contained in:
Jay Shrauner
2013-10-21 22:23:54 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 4 deletions

View File

@ -581,6 +581,10 @@ public class CallerInfo {
return countryIso;
}
protected static String getCurrentCountryIso(Context context) {
return getCurrentCountryIso(context, Locale.getDefault());
}
/**
* @return a string debug representation of this instance.
*/

View File

@ -20,7 +20,6 @@ import android.content.AsyncQueryHandler;
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 @@ public class CallerInfoAsyncQuery {
// 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));
}
}