diff options
author | wangqi <wangqi@google.com> | 2017-09-21 09:37:40 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-22 15:59:39 +0000 |
commit | 1420a22d5dc0d87f8634980b729a3511e42b6493 (patch) | |
tree | e82dd12010685713517e7b4737b999839880e843 /java/com/android/dialer/phonenumbergeoutil | |
parent | 3f4a31982fc815b1620671f16f7d45a8d2c07988 (diff) |
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
Diffstat (limited to 'java/com/android/dialer/phonenumbergeoutil')
3 files changed, 4 insertions, 5 deletions
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; } } |