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

Commit b6746eb9 authored by roldenburg's avatar roldenburg Committed by Copybara-Service
Browse files

Add impressions for Duo related events (install, activate and invite)

Bug: 70034799
Test: GoogleCallLogAdapterTest
PiperOrigin-RevId: 179085188
Change-Id: I7546cf7e35bbdd3788b03d19627d9a04f612335f
parent 7c98fd60
Loading
Loading
Loading
Loading
+77 −42
Original line number Diff line number Diff line
@@ -922,7 +922,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
      Logger.get(mContext).logImpression(DialerImpression.Type.VOICEMAIL_PLAY_AUDIO_DIRECTLY);
      mVoicemailPrimaryActionButtonClicked = true;
      mExpandCollapseListener.onClick(primaryActionView);
    } else if (view.getId() == R.id.call_with_note_action) {
      return;
    }

    if (view.getId() == R.id.call_with_note_action) {
      CallSubjectDialog.start(
          (Activity) mContext,
          info.photoId,
@@ -935,7 +938,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
          numberType, /* phone number type (e.g. mobile) in second line of contact view */
          getContactType(),
          accountHandle);
    } else if (view.getId() == R.id.block_report_action) {
      return;
    }

    if (view.getId() == R.id.block_report_action) {
      Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_REPORT_SPAM);
      maybeShowBlockNumberMigrationDialog(
          new BlockedNumbersMigrator.Listener() {
@@ -945,7 +951,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
                  displayNumber, number, countryIso, callType, info.sourceType);
            }
          });
    } else if (view.getId() == R.id.block_action) {
      return;
    }

    if (view.getId() == R.id.block_action) {
      Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_NUMBER);
      maybeShowBlockNumberMigrationDialog(
          new BlockedNumbersMigrator.Listener() {
@@ -955,25 +964,39 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
                  displayNumber, number, countryIso, callType, info.sourceType);
            }
          });
    } else if (view.getId() == R.id.unblock_action) {
      return;
    }

    if (view.getId() == R.id.unblock_action) {
      Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_UNBLOCK_NUMBER);
      mBlockReportListener.onUnblock(
          displayNumber, number, countryIso, callType, info.sourceType, isSpam, blockId);
    } else if (view.getId() == R.id.report_not_spam_action) {
      return;
    }

    if (view.getId() == R.id.report_not_spam_action) {
      Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_REPORT_AS_NOT_SPAM);
      mBlockReportListener.onReportNotSpam(
          displayNumber, number, countryIso, callType, info.sourceType);
    } else if (view.getId() == R.id.call_compose_action) {
      return;
    }

    if (view.getId() == R.id.call_compose_action) {
      LogUtil.i("CallLogListItemViewHolder.onClick", "share and call pressed");
      Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_SHARE_AND_CALL);
      Activity activity = (Activity) mContext;
      activity.startActivityForResult(
          CallComposerActivity.newIntent(activity, buildContact()),
          ActivityRequestCodes.DIALTACTS_CALL_COMPOSER);
    } else if (view.getId() == R.id.share_voicemail) {
      return;
    }

    if (view.getId() == R.id.share_voicemail) {
      Logger.get(mContext).logImpression(DialerImpression.Type.VVM_SHARE_PRESSED);
      mVoicemailPlaybackPresenter.shareVoicemail();
    } else {
      return;
    }

    logCallLogAction(view.getId());

    final IntentProvider intentProvider = (IntentProvider) view.getTag();
@@ -991,13 +1014,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
    // intents need to be started using startActivityForResult instead of the usual startActivity
    String packageName = intent.getPackage();
    if (DuoConstants.PACKAGE_NAME.equals(packageName)) {
        Logger.get(mContext)
            .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG);
        if (isNonContactEntry(info)) {
          Logger.get(mContext)
              .logImpression(
                  DialerImpression.Type.LIGHTBRINGER_NON_CONTACT_VIDEO_REQUESTED_FROM_CALL_LOG);
        }
      startDuoActivity(intent);
    } else if (CallDetailsActivity.isLaunchIntent(intent)) {
      PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL);
@@ -1007,11 +1023,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
      if (Intent.ACTION_CALL.equals(intent.getAction())
          && intent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, -1)
              == VideoProfile.STATE_BIDIRECTIONAL) {
          Logger.get(mContext)
              .logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG);
        Logger.get(mContext).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG);
      }
        DialerUtils.startActivityWithErrorToast(mContext, intent);
      if (intent.getDataString().contains(DuoConstants.PACKAGE_NAME)) {
        Logger.get(mContext).logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_INSTALL);
      }

      DialerUtils.startActivityWithErrorToast(mContext, intent);
    }
  }

@@ -1023,6 +1041,23 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
  }

  private void startDuoActivity(Intent intent) {
    if (DuoConstants.DUO_ACTIVATE_ACTION.equals(intent.getAction())) {
      Logger.get(mContext).logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_ACTIVATE);
    } else if (DuoConstants.DUO_INVITE_ACTION.equals(intent.getAction())) {
      Logger.get(mContext).logImpression(DialerImpression.Type.DUO_CALL_LOG_INVITE);
    } else if (DuoConstants.DUO_CALL_ACTION.equals(intent.getAction())) {
      Logger.get(mContext)
          .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG);
      if (isNonContactEntry(info)) {
        Logger.get(mContext)
            .logImpression(
                DialerImpression.Type.LIGHTBRINGER_NON_CONTACT_VIDEO_REQUESTED_FROM_CALL_LOG);
      }
    } else {
      throw Assert.createIllegalStateFailException(
          "Duo intent with invalid action" + intent.getAction());
    }

    try {
      Activity activity = (Activity) mContext;
      activity.startActivityForResult(intent, ActivityRequestCodes.DIALTACTS_DUO);
+3 −4
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ public abstract class IntentProvider {
                .scheme("https")
                .authority("play.google.com")
                .appendEncodedPath("store/apps/details")
                .appendQueryParameter("id", "com.google.android.apps.tachyon")
                .appendQueryParameter("id", DuoConstants.PACKAGE_NAME)
                .appendQueryParameter(
                    "referrer",
                    "utm_source=dialer&utm_medium=text&utm_campaign=product") // This string is from
@@ -128,8 +128,7 @@ public abstract class IntentProvider {
    return new IntentProvider() {
      @Override
      public Intent getIntent(Context context) {
        return new Intent("com.google.android.apps.tachyon.action.REGISTER")
            .setPackage(DuoConstants.PACKAGE_NAME);
        return new Intent(DuoConstants.DUO_ACTIVATE_ACTION).setPackage(DuoConstants.PACKAGE_NAME);
      }
    };
  }
@@ -139,7 +138,7 @@ public abstract class IntentProvider {
      @Override
      public Intent getIntent(Context context) {
        Intent intent =
            new Intent("com.google.android.apps.tachyon.action.INVITE")
            new Intent(DuoConstants.DUO_INVITE_ACTION)
                .setPackage(DuoConstants.PACKAGE_NAME)
                .setData(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null /* fragment */));
        return intent;
+7 −0
Original line number Diff line number Diff line
@@ -34,5 +34,12 @@ public final class DuoConstants {
  public static final PhoneAccountHandle PHONE_ACCOUNT_HANDLE =
      new PhoneAccountHandle(PHONE_ACCOUNT_COMPONENT_NAME, PHONE_ACCOUNT_ID);

  public static final String DUO_ACTIVATE_ACTION =
      "com.google.android.apps.tachyon.action.REGISTER";

  public static final String DUO_INVITE_ACTION = "com.google.android.apps.tachyon.action.INVITE";

  public static final String DUO_CALL_ACTION = "com.google.android.apps.tachyon.action.CALL";

  private DuoConstants() {}
}
+5 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ message DialerImpression {
  // Event enums to be used for Impression Logging in Dialer.
  // It's perfectly acceptable for this enum to be large
  // Values should be from 1000 to 100000.
  // Next Tag: 1308
  // Next Tag: 1311
  enum Type {
    UNKNOWN_AOSP_EVENT_TYPE = 1000;

@@ -621,5 +621,9 @@ message DialerImpression {
    DUAL_SIM_SELECTION_PREFERRED_SET = 1305;
    DUAL_SIM_SELECTION_PREFERRED_USED = 1306;
    DUAL_SIM_SELECTION_GLOBAL_USED = 1307;

    DUO_CALL_LOG_SET_UP_INSTALL = 1308;
    DUO_CALL_LOG_SET_UP_ACTIVATE = 1309;
    DUO_CALL_LOG_INVITE = 1310;
  }
}