summaryrefslogtreecommitdiff
path: root/java/com
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-08-09 12:02:35 -0700
committerEric Erfanian <erfanian@google.com>2017-08-09 17:34:36 -0700
commitddf3b1f450279cba46d690ebd78617cc6c62d308 (patch)
treed035a8f2cd9fe941070c2692d0a2b130db4e6002 /java/com
parent0b2626e433091f8ca75ab7018289ea8ec0ec8bbe (diff)
Clean up geo location data usage from libphonenumber.
This change will centralize getting geo location data for a phone number thus enable us to disable it completely by compiling it out. Bug: 64394643 Test: none PiperOrigin-RevId: 164754103 Change-Id: Ie4b526a05f8b4445ee0507683cd238659273c953
Diffstat (limited to 'java/com')
-rw-r--r--java/com/android/contacts/common/list/PhoneNumberListAdapter.java4
-rw-r--r--java/com/android/dialer/location/GeoUtil.java18
2 files changed, 2 insertions, 20 deletions
diff --git a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
index dee51091f..71d9dad5f 100644
--- a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
+++ b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
@@ -49,7 +49,7 @@ import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.enrichedcall.EnrichedCallManager;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.lightbringer.LightbringerComponent;
-import com.android.dialer.location.GeoUtil;
+import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.util.CallUtil;
import java.util.ArrayList;
import java.util.Arrays;
@@ -381,7 +381,7 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
text = phoneLabel;
} else {
final String phoneNumber = cursor.getString(PhoneQuery.PHONE_NUMBER);
- text = GeoUtil.getGeocodedLocationFor(mContext, phoneNumber);
+ text = PhoneNumberHelper.getGeoDescription(mContext, phoneNumber);
}
}
view.setPhoneNumber(text);
diff --git a/java/com/android/dialer/location/GeoUtil.java b/java/com/android/dialer/location/GeoUtil.java
index 1be40544d..b39256d32 100644
--- a/java/com/android/dialer/location/GeoUtil.java
+++ b/java/com/android/dialer/location/GeoUtil.java
@@ -17,11 +17,6 @@
package com.android.dialer.location;
import android.content.Context;
-import com.google.i18n.phonenumbers.NumberParseException;
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.Phonenumber;
-import com.google.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;
-import java.util.Locale;
/** Static methods related to Geo. */
public class GeoUtil {
@@ -31,17 +26,4 @@ public class GeoUtil {
// The {@link CountryDetector} should never return null so this is safe to return as-is.
return CountryDetector.getInstance(context).getCurrentCountryIso();
}
-
- public static String getGeocodedLocationFor(Context context, String phoneNumber) {
- final PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder.getInstance();
- final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
- try {
- final Phonenumber.PhoneNumber structuredPhoneNumber =
- phoneNumberUtil.parse(phoneNumber, getCurrentCountryIso(context));
- final Locale locale = context.getResources().getConfiguration().locale;
- return geocoder.getDescriptionForNumber(structuredPhoneNumber, locale);
- } catch (NumberParseException e) {
- return null;
- }
- }
}