diff options
author | linyuh <linyuh@google.com> | 2018-04-19 16:23:10 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-19 16:48:50 -0700 |
commit | ac069a79d2f0701d1ce0371a11e3d2ed63afc4de (patch) | |
tree | afe3be6804dbcc5150bced9fb93cec7f2661342d /java/com/android/incallui/PhoneLookupHistoryRecorder.java | |
parent | 4473e4b5e53ded7dffe86bdb344ff113ee72f9be (diff) |
Support extracting info from a Call in PhoneLookup
Bug: 70988915
Test: CompositePhoneLookupTest, PhoneLookupTest
PiperOrigin-RevId: 193592973
Change-Id: I27b6a63049117ce6d31e50aea9c56c14f01d0e1d
Diffstat (limited to 'java/com/android/incallui/PhoneLookupHistoryRecorder.java')
-rw-r--r-- | java/com/android/incallui/PhoneLookupHistoryRecorder.java | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/java/com/android/incallui/PhoneLookupHistoryRecorder.java b/java/com/android/incallui/PhoneLookupHistoryRecorder.java index 4f4137049..4c5cf8aa6 100644 --- a/java/com/android/incallui/PhoneLookupHistoryRecorder.java +++ b/java/com/android/incallui/PhoneLookupHistoryRecorder.java @@ -19,23 +19,18 @@ import android.content.ContentValues; import android.content.Context; import android.support.annotation.Nullable; import android.telecom.Call; -import com.android.dialer.DialerPhoneNumber; import com.android.dialer.calllog.config.CallLogConfigComponent; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; -import com.android.dialer.location.GeoUtil; import com.android.dialer.phonelookup.PhoneLookupComponent; import com.android.dialer.phonelookup.PhoneLookupInfo; import com.android.dialer.phonelookup.database.contract.PhoneLookupHistoryContract.PhoneLookupHistory; -import com.android.dialer.phonenumberproto.DialerPhoneNumberUtil; import com.android.dialer.telecom.TelecomCallUtil; import com.google.common.base.Optional; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; /** * Fetches the current {@link PhoneLookupInfo} for the provided call and writes it to the @@ -52,25 +47,8 @@ final class PhoneLookupHistoryRecorder { return; } - ListeningExecutorService backgroundExecutor = - DialerExecutorComponent.get(appContext).backgroundExecutor(); - - ListenableFuture<DialerPhoneNumber> numberFuture = - backgroundExecutor.submit( - () -> { - DialerPhoneNumberUtil dialerPhoneNumberUtil = new DialerPhoneNumberUtil(); - return dialerPhoneNumberUtil.parse( - TelecomCallUtil.getNumber(call), GeoUtil.getCurrentCountryIso(appContext)); - }); - ListenableFuture<PhoneLookupInfo> infoFuture = - Futures.transformAsync( - numberFuture, - dialerPhoneNumber -> - PhoneLookupComponent.get(appContext) - .compositePhoneLookup() - .lookup(dialerPhoneNumber), - MoreExecutors.directExecutor()); + PhoneLookupComponent.get(appContext).compositePhoneLookup().lookup(call); Futures.addCallback( infoFuture, @@ -103,6 +81,6 @@ final class PhoneLookupHistoryRecorder { "PhoneLookupHistoryRecorder.onFailure", "could not write PhoneLookupHistory", t); } }, - backgroundExecutor); + DialerExecutorComponent.get(appContext).backgroundExecutor()); } } |