Merge changes I933020d3,I27b6a630

* changes:
  Use PreCall.start instead of context.startActivity when starting calls from call log.
  Support extracting info from a Call in PhoneLookup
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
index 796ffe5..44a08c7 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
@@ -15,8 +15,7 @@
  */
 package com.android.dialer.calllog.ui;
 
-import android.content.Context;
-import android.content.Intent;
+import android.app.Activity;
 import android.content.res.ColorStateList;
 import android.database.Cursor;
 import android.provider.CallLog.Calls;
@@ -34,13 +33,14 @@
 import com.android.dialer.calllog.ui.NewCallLogAdapter.PopCounts;
 import com.android.dialer.calllog.ui.menu.NewCallLogMenu;
 import com.android.dialer.calllogutils.CallLogEntryText;
-import com.android.dialer.calllogutils.CallLogIntents;
+import com.android.dialer.calllogutils.CallLogRowActions;
 import com.android.dialer.calllogutils.NumberAttributesConverter;
 import com.android.dialer.calllogutils.PhoneAccountUtils;
 import com.android.dialer.common.concurrent.DialerExecutorComponent;
 import com.android.dialer.compat.AppCompatConstants;
 import com.android.dialer.compat.telephony.TelephonyManagerCompat;
 import com.android.dialer.oem.MotorolaUtils;
+import com.android.dialer.phonenumberutil.PhoneNumberHelper;
 import com.android.dialer.telecom.TelecomUtil;
 import com.android.dialer.time.Clock;
 import com.android.dialer.widget.ContactPhotoView;
@@ -52,7 +52,7 @@
 /** {@link RecyclerView.ViewHolder} for the new call log. */
 final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
 
-  private final Context context;
+  private final Activity activity;
   private final ContactPhotoView contactPhotoView;
   private final TextView primaryTextView;
   private final TextView callCountTextView;
@@ -74,7 +74,7 @@
   NewCallLogViewHolder(
       View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor, PopCounts popCounts) {
     super(view);
-    this.context = view.getContext();
+    this.activity = (Activity) view.getContext();
     contactPhotoView = view.findViewById(R.id.contact_photo_view);
     primaryTextView = view.findViewById(R.id.primary_text);
     callCountTextView = view.findViewById(R.id.call_count);
@@ -89,7 +89,7 @@
     this.clock = clock;
     this.realtimeRowProcessor = realtimeRowProcessor;
     this.popCounts = popCounts;
-    uiExecutorService = DialerExecutorComponent.get(context).uiExecutor();
+    uiExecutorService = DialerExecutorComponent.get(activity).uiExecutor();
   }
 
   /** @param cursor a cursor from {@link CoalescedAnnotatedCallLogCursorLoader}. */
@@ -112,8 +112,8 @@
 
   private void displayRow(CoalescedRow row) {
     // TODO(zachh): Handle RTL properly.
-    primaryTextView.setText(CallLogEntryText.buildPrimaryText(context, row));
-    secondaryTextView.setText(CallLogEntryText.buildSecondaryTextForEntries(context, clock, row));
+    primaryTextView.setText(CallLogEntryText.buildPrimaryText(activity, row));
+    secondaryTextView.setText(CallLogEntryText.buildSecondaryTextForEntries(activity, clock, row));
 
     if (isUnreadMissedCall(row)) {
       primaryTextView.setTextAppearance(R.style.primary_textview_unread_call);
@@ -168,7 +168,7 @@
   private void setFeatureIcons(CoalescedRow row) {
     ColorStateList colorStateList =
         ColorStateList.valueOf(
-            context.getColor(
+            activity.getColor(
                 isUnreadMissedCall(row)
                     ? R.color.feature_icon_unread_color
                     : R.color.feature_icon_read_color));
@@ -182,7 +182,7 @@
     }
 
     // Handle Wifi Icon
-    if (MotorolaUtils.shouldShowWifiIconInCallLog(context, row.getFeatures())) {
+    if (MotorolaUtils.shouldShowWifiIconInCallLog(activity, row.getFeatures())) {
       wifiIcon.setVisibility(View.VISIBLE);
       wifiIcon.setImageTintList(colorStateList);
     } else {
@@ -229,10 +229,10 @@
 
     if (isUnreadMissedCall(row)) {
       callTypeIcon.setImageTintList(
-          ColorStateList.valueOf(context.getColor(R.color.call_type_icon_unread_color)));
+          ColorStateList.valueOf(activity.getColor(R.color.call_type_icon_unread_color)));
     } else {
       callTypeIcon.setImageTintList(
-          ColorStateList.valueOf(context.getColor(R.color.call_type_icon_read_color)));
+          ColorStateList.valueOf(activity.getColor(R.color.call_type_icon_read_color)));
     }
   }
 
@@ -245,17 +245,19 @@
       return;
     }
 
-    String phoneAccountLabel = PhoneAccountUtils.getAccountLabel(context, phoneAccountHandle);
+    String phoneAccountLabel = PhoneAccountUtils.getAccountLabel(activity, phoneAccountHandle);
     if (TextUtils.isEmpty(phoneAccountLabel)) {
       phoneAccountView.setVisibility(View.GONE);
       return;
     }
 
     @ColorInt
-    int phoneAccountColor = PhoneAccountUtils.getAccountColor(context, phoneAccountHandle);
+    int phoneAccountColor = PhoneAccountUtils.getAccountColor(activity, phoneAccountHandle);
     if (phoneAccountColor == PhoneAccount.NO_HIGHLIGHT_COLOR) {
       phoneAccountColor =
-          context.getResources().getColor(R.color.dialer_secondary_text_color, context.getTheme());
+          activity
+              .getResources()
+              .getColor(R.color.dialer_secondary_text_color, activity.getTheme());
     }
 
     phoneAccountView.setText(phoneAccountLabel);
@@ -264,17 +266,15 @@
   }
 
   private void setOnClickListenerForRow(CoalescedRow row) {
-    itemView.setOnClickListener(
-        (view) -> {
-          Intent callbackIntent = CallLogIntents.getCallBackIntent(context, row);
-          if (callbackIntent != null) {
-            context.startActivity(callbackIntent);
-          }
-        });
+    if (!PhoneNumberHelper.canPlaceCallsTo(
+        row.getNumber().getNormalizedNumber(), row.getNumberPresentation())) {
+      return;
+    }
+    itemView.setOnClickListener(view -> CallLogRowActions.startCallForRow(activity, row));
   }
 
   private void setOnClickListenerForMenuButon(CoalescedRow row) {
-    menuButton.setOnClickListener(NewCallLogMenu.createOnClickListener(context, row));
+    menuButton.setOnClickListener(NewCallLogMenu.createOnClickListener(activity, row));
   }
 
   private class RealtimeRowFutureCallback implements FutureCallback<CoalescedRow> {
diff --git a/java/com/android/dialer/calllogutils/CallLogIntents.java b/java/com/android/dialer/calllogutils/CallLogRowActions.java
similarity index 62%
rename from java/com/android/dialer/calllogutils/CallLogIntents.java
rename to java/com/android/dialer/calllogutils/CallLogRowActions.java
index 18927f7..2090fc3 100644
--- a/java/com/android/dialer/calllogutils/CallLogIntents.java
+++ b/java/com/android/dialer/calllogutils/CallLogRowActions.java
@@ -15,39 +15,29 @@
  */
 package com.android.dialer.calllogutils;
 
-import android.content.Context;
-import android.content.Intent;
+import android.app.Activity;
 import android.provider.CallLog.Calls;
-import android.support.annotation.Nullable;
 import com.android.dialer.callintent.CallInitiationType;
 import com.android.dialer.callintent.CallIntentBuilder;
 import com.android.dialer.calllog.model.CoalescedRow;
-import com.android.dialer.phonenumberutil.PhoneNumberHelper;
 import com.android.dialer.precall.PreCall;
 import com.android.dialer.telecom.TelecomUtil;
 
-/** Provides intents related to call log entries. */
-public final class CallLogIntents {
+/** Actions which can be performed on a call log row. */
+public final class CallLogRowActions {
 
   /**
-   * Returns an intent which can be used to call back for the provided row.
+   * Places a call to the number in the provided {@link CoalescedRow}.
    *
    * <p>If the call was a video call, a video call will be placed, and if the call was an audio
-   * call, an audio call will be placed.
-   *
-   * @return null if the provided {@code row} doesn't have a number
+   * call, an audio call will be placed. The phone account corresponding to the row is used.
    */
-  @Nullable
-  public static Intent getCallBackIntent(Context context, CoalescedRow row) {
-    String normalizedNumber = row.getNumber().getNormalizedNumber();
-    if (!PhoneNumberHelper.canPlaceCallsTo(normalizedNumber, row.getNumberPresentation())) {
-      return null;
-    }
-
+  public static void startCallForRow(Activity activity, CoalescedRow row) {
     // TODO(zachh): More granular logging?
-    return PreCall.getIntent(
-        context,
-        new CallIntentBuilder(normalizedNumber, CallInitiationType.Type.CALL_LOG)
+    PreCall.start(
+        activity,
+        new CallIntentBuilder(
+                row.getNumber().getNormalizedNumber(), CallInitiationType.Type.CALL_LOG)
             .setPhoneAccountHandle(
                 TelecomUtil.composePhoneAccountHandle(
                     row.getPhoneAccountComponentName(), row.getPhoneAccountId()))
diff --git a/java/com/android/dialer/metrics/Metrics.java b/java/com/android/dialer/metrics/Metrics.java
index 5572658..191b84d 100644
--- a/java/com/android/dialer/metrics/Metrics.java
+++ b/java/com/android/dialer/metrics/Metrics.java
@@ -66,7 +66,8 @@
   String GET_MOST_RECENT_INFO_TEMPLATE = "%s.GetMostRecentInfo";
   String ON_SUCCESSFUL_FILL_TEMPLATE = "%s.OnSuccessfulFill";
   String ON_SUCCESSFUL_BULK_UPDATE_TEMPLATE = "%s.OnSuccessfulBulkUpdate";
-  String LOOKUP_TEMPLATE = "%s.Lookup";
+  String LOOKUP_FOR_CALL_TEMPLATE = "%s.LookupForCall";
+  String LOOKUP_FOR_NUMBER_TEMPLATE = "%s.LookupForNumber";
 
   /** Start a timer. */
   void startTimer(String timerEventName);
diff --git a/java/com/android/dialer/phonelookup/PhoneLookup.java b/java/com/android/dialer/phonelookup/PhoneLookup.java
index d11f023..0b9cbf6 100644
--- a/java/com/android/dialer/phonelookup/PhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/PhoneLookup.java
@@ -16,11 +16,20 @@
 
 package com.android.dialer.phonelookup;
 
+import android.content.Context;
 import android.support.annotation.MainThread;
+import android.telecom.Call;
 import com.android.dialer.DialerPhoneNumber;
+import com.android.dialer.common.concurrent.DialerExecutorComponent;
+import com.android.dialer.location.GeoUtil;
+import com.android.dialer.phonenumberproto.DialerPhoneNumberUtil;
+import com.android.dialer.telecom.TelecomCallUtil;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
+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;
 
 /**
  * Provides operations related to retrieving information about phone numbers.
@@ -32,11 +41,44 @@
 public interface PhoneLookup<T> {
 
   /**
+   * Returns a future containing a new info for the number associated with the provided call.
+   *
+   * <p>The returned message should contain populated data for the sub-message corresponding to this
+   * {@link PhoneLookup}. For example, the CP2 implementation returns a {@link
+   * PhoneLookupInfo.Cp2Info} sub-message.
+   *
+   * <p>The default implementation is for all {@link PhoneLookup} implementations that don't need
+   * info in the given call, i.e., it simply extracts the phone number from the call and delegates
+   * to {@link #lookup(DialerPhoneNumber)}.
+   *
+   * <p>However, for {@link PhoneLookup} implementations that need info in the call (such as one for
+   * CNAP), they should override this method.
+   */
+  default ListenableFuture<T> lookup(Context appContext, Call call) {
+    ListeningExecutorService backgroundExecutor =
+        DialerExecutorComponent.get(appContext).backgroundExecutor();
+
+    ListenableFuture<DialerPhoneNumber> numberFuture =
+        backgroundExecutor.submit(
+            () -> {
+              DialerPhoneNumberUtil dialerPhoneNumberUtil = new DialerPhoneNumberUtil();
+              return dialerPhoneNumberUtil.parse(
+                  TelecomCallUtil.getNumber(call), GeoUtil.getCurrentCountryIso(appContext));
+            });
+
+    return Futures.transformAsync(numberFuture, this::lookup, MoreExecutors.directExecutor());
+  }
+
+  /**
    * Returns a future containing a new info for the provided number.
    *
    * <p>The returned message should contain populated data for the sub-message corresponding to this
    * {@link PhoneLookup}. For example, the CP2 implementation returns a {@link
    * PhoneLookupInfo.Cp2Info} sub-message.
+   *
+   * <p>If the lookup can't be done without info in a {@link Call} (e.g., CNAP), this method is
+   * expected to return existing info saved during the most recent lookup for a call to/from the
+   * provided number ({@link #lookup(Context, Call)}).
    */
   ListenableFuture<T> lookup(DialerPhoneNumber dialerPhoneNumber);
 
diff --git a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java
index 7cc7a6d..1ac13df 100644
--- a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java
@@ -16,13 +16,16 @@
 
 package com.android.dialer.phonelookup.composite;
 
+import android.content.Context;
 import android.support.annotation.MainThread;
 import android.support.annotation.VisibleForTesting;
+import android.telecom.Call;
 import com.android.dialer.DialerPhoneNumber;
 import com.android.dialer.calllog.CallLogState;
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.common.concurrent.Annotations.LightweightExecutor;
 import com.android.dialer.common.concurrent.DialerFutures;
+import com.android.dialer.inject.ApplicationContext;
 import com.android.dialer.metrics.FutureTimer;
 import com.android.dialer.metrics.FutureTimer.LogCatMode;
 import com.android.dialer.metrics.Metrics;
@@ -51,6 +54,7 @@
  */
 public final class CompositePhoneLookup {
 
+  private final Context appContext;
   private final ImmutableList<PhoneLookup> phoneLookups;
   private final FutureTimer futureTimer;
   private final CallLogState callLogState;
@@ -59,10 +63,12 @@
   @VisibleForTesting
   @Inject
   public CompositePhoneLookup(
+      @ApplicationContext Context appContext,
       ImmutableList<PhoneLookup> phoneLookups,
       FutureTimer futureTimer,
       CallLogState callLogState,
       @LightweightExecutor ListeningExecutorService lightweightExecutorService) {
+    this.appContext = appContext;
     this.phoneLookups = phoneLookups;
     this.futureTimer = futureTimer;
     this.callLogState = callLogState;
@@ -70,12 +76,37 @@
   }
 
   /**
-   * Delegates to a set of dependent lookups to build a complete {@link PhoneLookupInfo}.
+   * Delegates to a set of dependent lookups to build a complete {@link PhoneLookupInfo} for the
+   * number associated with the provided call.
    *
    * <p>Note: If any of the dependent lookups fails, the returned future will also fail. If any of
    * the dependent lookups does not complete, the returned future will also not complete.
    */
-  @SuppressWarnings({"unchecked", "rawtype"})
+  public ListenableFuture<PhoneLookupInfo> lookup(Call call) {
+    // TODO(zachh): Add short-circuiting logic so that this call is not blocked on low-priority
+    // lookups finishing when a higher-priority one has already finished.
+    List<ListenableFuture<?>> futures = new ArrayList<>();
+    for (PhoneLookup<?> phoneLookup : phoneLookups) {
+      ListenableFuture<?> lookupFuture = phoneLookup.lookup(appContext, call);
+      String eventName =
+          String.format(Metrics.LOOKUP_FOR_CALL_TEMPLATE, phoneLookup.getClass().getSimpleName());
+      futureTimer.applyTiming(lookupFuture, eventName);
+      futures.add(lookupFuture);
+    }
+    ListenableFuture<PhoneLookupInfo> combinedFuture = combineSubMessageFutures(futures);
+    String eventName =
+        String.format(Metrics.LOOKUP_FOR_CALL_TEMPLATE, CompositePhoneLookup.class.getSimpleName());
+    futureTimer.applyTiming(combinedFuture, eventName);
+    return combinedFuture;
+  }
+
+  /**
+   * Delegates to a set of dependent lookups to build a complete {@link PhoneLookupInfo} for the
+   * provided number.
+   *
+   * <p>Note: If any of the dependent lookups fails, the returned future will also fail. If any of
+   * the dependent lookups does not complete, the returned future will also not complete.
+   */
   public ListenableFuture<PhoneLookupInfo> lookup(DialerPhoneNumber dialerPhoneNumber) {
     // TODO(zachh): Add short-circuiting logic so that this call is not blocked on low-priority
     // lookups finishing when a higher-priority one has already finished.
@@ -83,28 +114,35 @@
     for (PhoneLookup<?> phoneLookup : phoneLookups) {
       ListenableFuture<?> lookupFuture = phoneLookup.lookup(dialerPhoneNumber);
       String eventName =
-          String.format(Metrics.LOOKUP_TEMPLATE, phoneLookup.getClass().getSimpleName());
+          String.format(Metrics.LOOKUP_FOR_NUMBER_TEMPLATE, phoneLookup.getClass().getSimpleName());
       futureTimer.applyTiming(lookupFuture, eventName);
       futures.add(lookupFuture);
     }
-    ListenableFuture<PhoneLookupInfo> combinedFuture =
-        Futures.transform(
-            Futures.allAsList(futures),
-            infos -> {
-              Builder mergedInfo = PhoneLookupInfo.newBuilder();
-              for (int i = 0; i < infos.size(); i++) {
-                PhoneLookup phoneLookup = phoneLookups.get(i);
-                phoneLookup.setSubMessage(mergedInfo, infos.get(i));
-              }
-              return mergedInfo.build();
-            },
-            lightweightExecutorService);
+    ListenableFuture<PhoneLookupInfo> combinedFuture = combineSubMessageFutures(futures);
     String eventName =
-        String.format(Metrics.LOOKUP_TEMPLATE, CompositePhoneLookup.class.getSimpleName());
+        String.format(
+            Metrics.LOOKUP_FOR_NUMBER_TEMPLATE, CompositePhoneLookup.class.getSimpleName());
     futureTimer.applyTiming(combinedFuture, eventName);
     return combinedFuture;
   }
 
+  /** Combines a list of sub-message futures into a future for {@link PhoneLookupInfo}. */
+  @SuppressWarnings({"unchecked", "rawtype"})
+  private ListenableFuture<PhoneLookupInfo> combineSubMessageFutures(
+      List<ListenableFuture<?>> subMessageFutures) {
+    return Futures.transform(
+        Futures.allAsList(subMessageFutures),
+        subMessages -> {
+          Builder mergedInfo = PhoneLookupInfo.newBuilder();
+          for (int i = 0; i < subMessages.size(); i++) {
+            PhoneLookup phoneLookup = phoneLookups.get(i);
+            phoneLookup.setSubMessage(mergedInfo, subMessages.get(i));
+          }
+          return mergedInfo.build();
+        },
+        lightweightExecutorService);
+  }
+
   /**
    * Delegates to sub-lookups' {@link PhoneLookup#isDirty(ImmutableSet)} completing when the first
    * sub-lookup which returns true completes.
diff --git a/java/com/android/dialer/precall/impl/PreCallImpl.java b/java/com/android/dialer/precall/impl/PreCallImpl.java
index bd23f9e..2f9b278 100644
--- a/java/com/android/dialer/precall/impl/PreCallImpl.java
+++ b/java/com/android/dialer/precall/impl/PreCallImpl.java
@@ -25,7 +25,6 @@
 import com.android.dialer.logging.Logger;
 import com.android.dialer.precall.PreCall;
 import com.android.dialer.precall.PreCallAction;
-import com.android.dialer.precall.PreCallComponent;
 import com.android.dialer.precall.PreCallCoordinator;
 import com.google.common.collect.ImmutableList;
 import javax.inject.Inject;
@@ -33,17 +32,16 @@
 /** Implementation of {@link PreCall} */
 public class PreCallImpl implements PreCall {
 
+  private final ImmutableList<PreCallAction> actions;
+
   @Inject
-  PreCallImpl() {}
+  PreCallImpl(ImmutableList<PreCallAction> actions) {
+    this.actions = actions;
+  }
 
   @Override
   public ImmutableList<PreCallAction> getActions() {
-    return ImmutableList.of(
-        new PermissionCheckAction(),
-        new MalformedNumberRectifier(
-            ImmutableList.of(new UkRegionPrefixInInternationalFormatHandler())),
-        new CallingAccountSelector(),
-        new AssistedDialAction());
+    return actions;
   }
 
   @NonNull
@@ -52,7 +50,7 @@
     Logger.get(context).logImpression(DialerImpression.Type.PRECALL_INITIATED);
     if (!requiresUi(context, builder)) {
       LogUtil.i("PreCallImpl.buildIntent", "No UI requested, running pre-call directly");
-      for (PreCallAction action : PreCallComponent.get(context).getPreCall().getActions()) {
+      for (PreCallAction action : actions) {
         action.runWithoutUi(context, builder);
       }
       return builder.build();
@@ -64,7 +62,7 @@
   }
 
   private boolean requiresUi(Context context, CallIntentBuilder builder) {
-    for (PreCallAction action : PreCallComponent.get(context).getPreCall().getActions()) {
+    for (PreCallAction action : actions) {
       if (action.requiresUi(context, builder)) {
         LogUtil.i("PreCallImpl.requiresUi", action + " requested UI");
         return true;
diff --git a/java/com/android/dialer/precall/impl/PreCallModule.java b/java/com/android/dialer/precall/impl/PreCallModule.java
index 608cd5a..4643b19 100644
--- a/java/com/android/dialer/precall/impl/PreCallModule.java
+++ b/java/com/android/dialer/precall/impl/PreCallModule.java
@@ -17,15 +17,31 @@
 package com.android.dialer.precall.impl;
 
 import com.android.dialer.precall.PreCall;
+import com.android.dialer.precall.PreCallAction;
+import com.google.common.collect.ImmutableList;
 import dagger.Binds;
 import dagger.Module;
+import dagger.Provides;
 import javax.inject.Singleton;
 
 /** Dagger module for {@link PreCall}. */
 @Module
 public abstract class PreCallModule {
 
+  private PreCallModule() {}
+
   @Binds
   @Singleton
-  public abstract PreCall bindPreCall(PreCallImpl simulator);
+  public abstract PreCall to(PreCallImpl impl);
+
+  @Provides
+  @Singleton
+  public static ImmutableList<PreCallAction> provideActions() {
+    return ImmutableList.of(
+        new PermissionCheckAction(),
+        new MalformedNumberRectifier(
+            ImmutableList.of(new UkRegionPrefixInInternationalFormatHandler())),
+        new CallingAccountSelector(),
+        new AssistedDialAction());
+  }
 }
diff --git a/java/com/android/incallui/PhoneLookupHistoryRecorder.java b/java/com/android/incallui/PhoneLookupHistoryRecorder.java
index 4f41370..4c5cf8a 100644
--- a/java/com/android/incallui/PhoneLookupHistoryRecorder.java
+++ b/java/com/android/incallui/PhoneLookupHistoryRecorder.java
@@ -19,23 +19,18 @@
 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 @@
       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 @@
                 "PhoneLookupHistoryRecorder.onFailure", "could not write PhoneLookupHistory", t);
           }
         },
-        backgroundExecutor);
+        DialerExecutorComponent.get(appContext).backgroundExecutor());
   }
 }