From ddf3b1f450279cba46d690ebd78617cc6c62d308 Mon Sep 17 00:00:00 2001 From: wangqi Date: Wed, 9 Aug 2017 12:02:35 -0700 Subject: 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 --- .../contacts/common/list/PhoneNumberListAdapter.java | 4 ++-- java/com/android/dialer/location/GeoUtil.java | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'java/com') 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; - } - } } -- cgit v1.2.3