diff options
author | Eric Erfanian <erfanian@google.com> | 2017-08-31 06:57:16 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-31 16:13:53 +0000 |
commit | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/dialer/location | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) |
Update Dialer source to latest internal Google revision.
Previously, Android's Dialer app was developed in an internal Google
source control system and only exported to public during AOSP drops.
The Dialer team is now switching to a public development model similar
to the telephony team.
This CL represents all internal Google changes that were committed to
Dialer between the public O release and today's tip of tree on internal
master. This CL squashes those changes into a single commit.
In subsequent changes, changes will be exported on a per-commit basis.
Test: make, flash install, run
Merged-In: I45270eaa8ce732d71a1bd84b08c7fa0e99af3160
Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8
PiperOrigin-RevId: 167068436
Diffstat (limited to 'java/com/android/dialer/location')
-rw-r--r-- | java/com/android/dialer/location/CountryDetector.java | 12 | ||||
-rw-r--r-- | java/com/android/dialer/location/GeoUtil.java | 18 |
2 files changed, 7 insertions, 23 deletions
diff --git a/java/com/android/dialer/location/CountryDetector.java b/java/com/android/dialer/location/CountryDetector.java index a90febf2b..110cf4502 100644 --- a/java/com/android/dialer/location/CountryDetector.java +++ b/java/com/android/dialer/location/CountryDetector.java @@ -33,8 +33,8 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; -import com.android.dialer.common.concurrent.DialerExecutors; import com.android.dialer.common.concurrent.DialerExecutor.Worker; +import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.util.PermissionsUtil; import java.util.List; import java.util.Locale; @@ -72,7 +72,7 @@ public class CountryDetector { // exceedingly rare event that the device does not have a default locale set for some reason. private static final String DEFAULT_COUNTRY_ISO = "US"; - @VisibleForTesting static CountryDetector sInstance; + @VisibleForTesting public static CountryDetector sInstance; private final TelephonyManager telephonyManager; private final LocaleProvider localeProvider; @@ -80,7 +80,7 @@ public class CountryDetector { private final Context appContext; @VisibleForTesting - CountryDetector( + public CountryDetector( Context appContext, TelephonyManager telephonyManager, LocationManager locationManager, @@ -192,7 +192,7 @@ public class CountryDetector { } /** Interface for accessing the current locale. */ - interface LocaleProvider { + public interface LocaleProvider { Locale getLocale(); } @@ -216,7 +216,9 @@ public class CountryDetector { private static void processLocationUpdate( Context appContext, Geocoder geocoder, Location location) { - DialerExecutors.createNonUiTaskBuilder(new GeocodeCountryWorker(geocoder)) + DialerExecutorComponent.get(appContext) + .dialerExecutorFactory() + .createNonUiTaskBuilder(new GeocodeCountryWorker(geocoder)) .onSuccess( country -> { if (country == null) { 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; - } - } } |