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

Commit e758a0f7 authored by uabdullah's avatar uabdullah Committed by android-build-merger
Browse files

Merge "Add phone account id and component name to NUI VM Pre-call."

am: 3c7c6699

Change-Id: Ifa19d0523abdac1a807304fed0b91f9b48a4f38b
parents f09ab9e3 3c7c6699
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener;
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.precall.PreCall;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.voicemail.listui.NewVoicemailViewHolder.NewVoicemailViewHolderListener;
import com.android.dialer.voicemail.model.VoicemailEntry;
import java.util.Locale;
@@ -68,6 +69,8 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout {
  private TextView voicemailLoadingStatusView;
  private Uri voicemailUri;
  private String numberVoicemailFrom;
  private String phoneAccountId;
  private String phoneAccountComponentName;
  private FragmentManager fragmentManager;
  private NewVoicemailViewHolder newVoicemailViewHolder;
  private NewVoicemailMediaPlayer mediaPlayer;
@@ -122,6 +125,8 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout {
    voicemailUri = null;
    voicemailLoadingStatusView.setVisibility(GONE);
    numberVoicemailFrom = null;
    phoneAccountId = null;
    phoneAccountComponentName = null;
  }

  /**
@@ -152,6 +157,8 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout {
    Uri uri = Uri.parse(voicemailEntryFromAdapter.voicemailUri());

    numberVoicemailFrom = voicemailEntryFromAdapter.number().getNormalizedNumber();
    phoneAccountId = voicemailEntryFromAdapter.phoneAccountId();
    phoneAccountComponentName = voicemailEntryFromAdapter.phoneAccountComponentName();

    Assert.isNotNull(viewHolder);
    Assert.isNotNull(uri);
@@ -510,7 +517,6 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout {
        }
      };

  // TODO(uabdullah): Add phone account handle (a bug)
  private final View.OnClickListener phoneButtonListener =
      new View.OnClickListener() {
        @Override
@@ -525,7 +531,11 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout {
              !TextUtils.isEmpty(numberVoicemailFrom),
              "number cannot be empty:" + numberVoicemailFrom);
          PreCall.start(
              getContext(), new CallIntentBuilder(numberVoicemailFrom, Type.VOICEMAIL_LOG));
              getContext(),
              new CallIntentBuilder(numberVoicemailFrom, Type.VOICEMAIL_LOG)
                  .setPhoneAccountHandle(
                      TelecomUtil.composePhoneAccountHandle(
                          phoneAccountComponentName, phoneAccountId)));
        }
      };

+7 −1
Original line number Diff line number Diff line
@@ -45,7 +45,9 @@ final class VoicemailCursorLoader extends CursorLoader {
        AnnotatedCallLog.VOICEMAIL_URI,
        AnnotatedCallLog.IS_READ,
        AnnotatedCallLog.NUMBER_ATTRIBUTES,
        AnnotatedCallLog.TRANSCRIPTION_STATE
        AnnotatedCallLog.TRANSCRIPTION_STATE,
        AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME,
        AnnotatedCallLog.PHONE_ACCOUNT_ID,
      };

  // Indexes for VOICEMAIL_COLUMNS
@@ -61,6 +63,8 @@ final class VoicemailCursorLoader extends CursorLoader {
  private static final int IS_READ = 9;
  private static final int NUMBER_ATTRIBUTES = 10;
  private static final int TRANSCRIPTION_STATE = 11;
  private static final int PHONE_ACCOUNT_COMPONENT_NAME = 12;
  private static final int PHONE_ACCOUNT_ID = 13;

  // TODO(zachh): Optimize indexes
  VoicemailCursorLoader(Context context) {
@@ -108,6 +112,8 @@ final class VoicemailCursorLoader extends CursorLoader {
        .setIsRead(cursor.getInt(IS_READ))
        .setNumberAttributes(numberAttributes)
        .setTranscriptionState(cursor.getInt(TRANSCRIPTION_STATE))
        .setPhoneAccountComponentName(cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME))
        .setPhoneAccountId(cursor.getString(PHONE_ACCOUNT_ID))
        .build();
  }

+11 −0
Original line number Diff line number Diff line
@@ -68,6 +68,12 @@ public abstract class VoicemailEntry {

  public abstract int transcriptionState();

  @Nullable
  public abstract String phoneAccountComponentName();

  @Nullable
  public abstract String phoneAccountId();

  /** Builder for {@link VoicemailEntry}. */
  @AutoValue.Builder
  public abstract static class Builder {
@@ -96,6 +102,11 @@ public abstract class VoicemailEntry {

    public abstract Builder setTranscriptionState(int transcriptionState);

    public abstract Builder setPhoneAccountComponentName(
        @Nullable String phoneAccountComponentName);

    public abstract Builder setPhoneAccountId(@Nullable String phoneAccountId);

    public abstract VoicemailEntry build();
  }
}