Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7d83218 authored by linyuh's avatar linyuh Committed by Copybara-Service
Browse files

Show Cequint info in the new call log.

Bug: 70989584
Test: PhoneLookupInfoConsolidatorTest
PiperOrigin-RevId: 194494486
Change-Id: I706802c000da953f962786bd07ca5da2fd59dc8a
parent fa3cd3bf
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ package com.android.dialer;
import "java/com/android/dialer/logging/contact_source.proto";

// Information related to the phone number of the call.
// Next ID: 13
// Next ID: 14
message NumberAttributes {
  // The name (which may be a person's name or business name, but not a number)
  // formatted exactly as it should appear to the user. If the user's locale or
@@ -70,4 +70,8 @@ message NumberAttributes {

  // Whether the number can be reached via a carrier video call.
  optional bool can_support_carrier_video_call = 12;

  // Description of the number's geolocation (e.g., "Mountain View, CA").
  // This string is for display purpose only.
  optional string geolocation = 13;
}
 No newline at end of file
+6 −1
Original line number Diff line number Diff line
@@ -214,7 +214,12 @@ public final class CallLogEntryText {
    // (1) there is no number type label, and
    // (2) the number is not spam.
    if (TextUtils.isEmpty(numberTypeLabel) && !row.getNumberAttributes().getIsSpam()) {
      String location = row.getGeocodedLocation();
      // If number attributes contain a location (obtained from a PhoneLookup), use it instead
      // of the one from the annotated call log.
      String location =
          !TextUtils.isEmpty(row.getNumberAttributes().getGeolocation())
              ? row.getNumberAttributes().getGeolocation()
              : row.getGeocodedLocation();
      if (!TextUtils.isEmpty(location)) {
        if (secondaryText.length() > 0) {
          secondaryText.append(", ");
+2 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ public final class NumberAttributesConverter {
        .setCanReportAsInvalidNumber(phoneLookupInfoConsolidator.canReportAsInvalidNumber())
        .setIsCp2InfoIncomplete(phoneLookupInfoConsolidator.isDefaultCp2InfoIncomplete())
        .setContactSource(phoneLookupInfoConsolidator.getContactSource())
        .setCanSupportCarrierVideoCall(phoneLookupInfoConsolidator.canSupportCarrierVideoCall());
        .setCanSupportCarrierVideoCall(phoneLookupInfoConsolidator.canSupportCarrierVideoCall())
        .setGeolocation(phoneLookupInfoConsolidator.getGeolocation());
  }
}
+44 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public final class PhoneLookupInfoConsolidator {
    NameSource.CP2_DEFAULT_DIRECTORY,
    NameSource.CP2_EXTENDED_DIRECTORY,
    NameSource.PEOPLE_API,
    NameSource.CEQUINT,
    NameSource.CNAP
  })
  @interface NameSource {
@@ -53,7 +54,8 @@ public final class PhoneLookupInfoConsolidator {
    int CP2_DEFAULT_DIRECTORY = 1;
    int CP2_EXTENDED_DIRECTORY = 2;
    int PEOPLE_API = 3;
    int CNAP = 4;
    int CEQUINT = 4;
    int CNAP = 5;
  }

  /**
@@ -78,6 +80,7 @@ public final class PhoneLookupInfoConsolidator {
          NameSource.CP2_DEFAULT_DIRECTORY,
          NameSource.CP2_EXTENDED_DIRECTORY,
          NameSource.PEOPLE_API,
          NameSource.CEQUINT,
          NameSource.CNAP);

  private final @NameSource int nameSource;
@@ -106,6 +109,8 @@ public final class PhoneLookupInfoConsolidator {
        return ContactSource.Type.SOURCE_TYPE_EXTENDED;
      case NameSource.PEOPLE_API:
        return getRefinedPeopleApiSource();
      case NameSource.CEQUINT:
        return ContactSource.Type.SOURCE_TYPE_CEQUINT_CALLER_ID;
      case NameSource.CNAP:
        return ContactSource.Type.SOURCE_TYPE_CNAP;
      case NameSource.NONE:
@@ -146,6 +151,8 @@ public final class PhoneLookupInfoConsolidator {
        return Assert.isNotNull(firstExtendedCp2Contact).getName();
      case NameSource.PEOPLE_API:
        return phoneLookupInfo.getPeopleApiInfo().getDisplayName();
      case NameSource.CEQUINT:
        return phoneLookupInfo.getCequintInfo().getName();
      case NameSource.CNAP:
        return phoneLookupInfo.getCnapInfo().getName();
      case NameSource.NONE:
@@ -170,6 +177,7 @@ public final class PhoneLookupInfoConsolidator {
      case NameSource.CP2_EXTENDED_DIRECTORY:
        return Assert.isNotNull(firstExtendedCp2Contact).getPhotoThumbnailUri();
      case NameSource.PEOPLE_API:
      case NameSource.CEQUINT:
      case NameSource.CNAP:
      case NameSource.NONE:
        return "";
@@ -192,6 +200,8 @@ public final class PhoneLookupInfoConsolidator {
        return Assert.isNotNull(firstDefaultCp2Contact).getPhotoUri();
      case NameSource.CP2_EXTENDED_DIRECTORY:
        return Assert.isNotNull(firstExtendedCp2Contact).getPhotoUri();
      case NameSource.CEQUINT:
        return phoneLookupInfo.getCequintInfo().getPhotoUri();
      case NameSource.PEOPLE_API:
      case NameSource.CNAP:
      case NameSource.NONE:
@@ -213,6 +223,7 @@ public final class PhoneLookupInfoConsolidator {
      case NameSource.CP2_EXTENDED_DIRECTORY:
        return Math.max(Assert.isNotNull(firstExtendedCp2Contact).getPhotoId(), 0);
      case NameSource.PEOPLE_API:
      case NameSource.CEQUINT:
      case NameSource.CNAP:
      case NameSource.NONE:
        return 0;
@@ -235,6 +246,7 @@ public final class PhoneLookupInfoConsolidator {
        return Assert.isNotNull(firstExtendedCp2Contact).getLookupUri();
      case NameSource.PEOPLE_API:
        return Assert.isNotNull(phoneLookupInfo.getPeopleApiInfo().getLookupUri());
      case NameSource.CEQUINT:
      case NameSource.CNAP:
      case NameSource.NONE:
        return "";
@@ -259,6 +271,30 @@ public final class PhoneLookupInfoConsolidator {
      case NameSource.CP2_EXTENDED_DIRECTORY:
        return Assert.isNotNull(firstExtendedCp2Contact).getLabel();
      case NameSource.PEOPLE_API:
      case NameSource.CEQUINT:
      case NameSource.CNAP:
      case NameSource.NONE:
        return "";
      default:
        throw Assert.createUnsupportedOperationFailException(
            String.format("Unsupported name source: %s", nameSource));
    }
  }

  /**
   * The {@link PhoneLookupInfo} passed to the constructor is associated with a number. This method
   * returns the number's geolocation (which is for display purpose only).
   *
   * <p>If no geolocation can be obtained from the {@link PhoneLookupInfo}, an empty string will be
   * returned.
   */
  public String getGeolocation() {
    switch (nameSource) {
      case NameSource.CEQUINT:
        return phoneLookupInfo.getCequintInfo().getGeolocation();
      case NameSource.CP2_DEFAULT_DIRECTORY:
      case NameSource.CP2_EXTENDED_DIRECTORY:
      case NameSource.PEOPLE_API:
      case NameSource.CNAP:
      case NameSource.NONE:
        return "";
@@ -320,6 +356,7 @@ public final class PhoneLookupInfoConsolidator {
    switch (nameSource) {
      case NameSource.CP2_DEFAULT_DIRECTORY:
      case NameSource.CP2_EXTENDED_DIRECTORY:
      case NameSource.CEQUINT:
      case NameSource.CNAP:
      case NameSource.NONE:
        return false;
@@ -343,6 +380,7 @@ public final class PhoneLookupInfoConsolidator {
        return Assert.isNotNull(firstDefaultCp2Contact).getCanSupportCarrierVideoCall();
      case NameSource.CP2_EXTENDED_DIRECTORY:
      case NameSource.PEOPLE_API:
      case NameSource.CEQUINT:
      case NameSource.CNAP:
      case NameSource.NONE:
        return false;
@@ -396,6 +434,11 @@ public final class PhoneLookupInfoConsolidator {
            return NameSource.PEOPLE_API;
          }
          break;
        case NameSource.CEQUINT:
          if (!phoneLookupInfo.getCequintInfo().getName().isEmpty()) {
            return NameSource.CEQUINT;
          }
          break;
        case NameSource.CNAP:
          if (!phoneLookupInfo.getCnapInfo().getName().isEmpty()) {
            return NameSource.CNAP;