From 1420a22d5dc0d87f8634980b729a3511e42b6493 Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 21 Sep 2017 09:37:40 -0700 Subject: Better handling country iso when getting geo location of phone number. 1. Use existing country iso info instead of guessing current country iso from sim and locale for blocked number. 2. Use country iso of current sim instead of default sim for incall location info. This fixes bug in multi sim device when default sim is out of service and making call with the other sim. Bug: 65399976 Test: manual PiperOrigin-RevId: 169554641 Change-Id: I416d7e2d6bc3c872bfec3eda4005a5a1684f0e40 --- java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtil.java | 3 ++- .../dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java | 4 +--- .../dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'java/com/android/dialer/phonenumbergeoutil') diff --git a/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtil.java b/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtil.java index 2005abc68..7e4559828 100644 --- a/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtil.java +++ b/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtil.java @@ -20,5 +20,6 @@ import android.content.Context; /** Interface for getting geo information for phone number. */ public interface PhoneNumberGeoUtil { - String getGeoDescription(Context context, String number); + /** Returns geo location information for a phone number, e.g. California. */ + String getGeoDescription(Context context, String number, String countryIso); } diff --git a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java index 32f65927d..fb28ed588 100644 --- a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java +++ b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java @@ -21,7 +21,6 @@ import android.text.TextUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.CompatUtils; import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtil; -import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.google.i18n.phonenumbers.NumberParseException; import com.google.i18n.phonenumbers.PhoneNumberUtil; import com.google.i18n.phonenumbers.Phonenumber; @@ -36,7 +35,7 @@ public class PhoneNumberGeoUtilImpl implements PhoneNumberGeoUtil { public PhoneNumberGeoUtilImpl() {} @Override - public String getGeoDescription(Context context, String number) { + public String getGeoDescription(Context context, String number, String countryIso) { LogUtil.v("PhoneNumberGeoUtilImpl.getGeoDescription", "" + LogUtil.sanitizePii(number)); if (TextUtils.isEmpty(number)) { @@ -47,7 +46,6 @@ public class PhoneNumberGeoUtilImpl implements PhoneNumberGeoUtil { PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance(); Locale locale = CompatUtils.getLocale(context); - String countryIso = PhoneNumberHelper.getCurrentCountryIso(context, locale); Phonenumber.PhoneNumber pn = null; try { LogUtil.v( diff --git a/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java b/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java index 4c5b3b0b3..06cd13760 100644 --- a/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java +++ b/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java @@ -26,7 +26,7 @@ public final class PhoneNumberGeoUtilStub implements PhoneNumberGeoUtil { public PhoneNumberGeoUtilStub() {} @Override - public String getGeoDescription(Context context, String number) { + public String getGeoDescription(Context context, String number, String countryIso) { return null; } } -- cgit v1.2.3