summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-02-03 03:31:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-02-03 03:31:39 +0000
commit3c7c669918e58f301f27b4d9cbb7d80a7b4ebabc (patch)
tree1c1b97b310660dfa2da74d8825d60ff9ca7cc341
parentd9c82eee6b454f8b7ddb2b2eac8c28a1c218684d (diff)
parent307dcdb474799e015e90b6afd87ea7d798cb9ed8 (diff)
Merge "Add phone account id and component name to NUI VM Pre-call."
-rw-r--r--java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java14
-rw-r--r--java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java8
-rw-r--r--java/com/android/dialer/voicemail/model/VoicemailEntry.java11
3 files changed, 30 insertions, 3 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java
index df4715974..52f3d0a48 100644
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java
+++ b/java/com/android/dialer/voicemail/listui/NewVoicemailMediaPlayerView.java
@@ -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)));
}
};
diff --git a/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java b/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java
index 11e788840..5f717cf0c 100644
--- a/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java
+++ b/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java
@@ -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();
}
diff --git a/java/com/android/dialer/voicemail/model/VoicemailEntry.java b/java/com/android/dialer/voicemail/model/VoicemailEntry.java
index 5830fb17e..2f554b11f 100644
--- a/java/com/android/dialer/voicemail/model/VoicemailEntry.java
+++ b/java/com/android/dialer/voicemail/model/VoicemailEntry.java
@@ -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();
}
}