summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
diff options
context:
space:
mode:
authorAndroid Dialer <noreply@google.com>2018-06-27 13:22:38 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-06-27 13:22:38 -0700
commita582e75614b8bcfc6849f83641575a4540afab45 (patch)
tree3a32e17e1d9c79e8306119d817fd7964fbef82d1 /java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
parentfb5fa0a8f1a138c8957ccfd848e22168349e9574 (diff)
parent95194792e7f479979bef3290165952480a97af58 (diff)
Merge changes I0f1ed20a,Ia68d3b13,I72047d59,Ieff3c7fb,I53c3896a, ... am: 1b4ec7b954 am: cd5228be7f
am: 95194792e7 Change-Id: I98da32480b2c1fba7f6c133515e79da794753fe5
Diffstat (limited to 'java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java')
-rw-r--r--java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
index 9e227553b..4d268f35b 100644
--- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
+++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
@@ -263,14 +263,13 @@ public abstract class SpeedDialUiItem {
return defaultChannel();
}
- // Default channel is a video channel, so find it's corresponding voice channel
- Channel prevChannel = channels().get(0);
- for (int i = 1; i < channels().size(); i++) {
- Channel currentChannel = channels().get(i);
- if (currentChannel.equals(defaultChannel())) {
- return prevChannel;
+ // Default channel is a video channel, so find it's corresponding voice channel by number since
+ // unreachable channels may not be in the list
+ for (Channel currentChannel : channels()) {
+ if (currentChannel.number().equals(defaultChannel().number())
+ && currentChannel.technology() == Channel.VOICE) {
+ return currentChannel;
}
- prevChannel = currentChannel;
}
return null;
}
@@ -306,7 +305,8 @@ public abstract class SpeedDialUiItem {
public abstract String photoUri();
/**
- * Since a contact can have multiple phone numbers and each number can have multiple technologies,
+ * Returns a list of channels available. A Duo channel is included iff it is reachable. Since a
+ * contact can have multiple phone numbers and each number can have multiple technologies,
* enumerate each one here so that the user can choose the correct one. Each channel here
* represents a row in the {@link com.android.dialer.speeddial.DisambigDialog}.
*
@@ -330,7 +330,11 @@ public abstract class SpeedDialUiItem {
public abstract ImmutableList<Channel> channels();
/**
- * Will be null when the user hasn't chosen a default yet.
+ * Will be null when the user hasn't chosen a default yet. Note that a default channel may not be
+ * in the list returned by {@link #channels()}. This is because that list does not contain an
+ * unreachable Duo channel. When the default channel is a Duo channel and it becomes unreachable,
+ * it will remain as the default channel but disappear in the list returned by {@link
+ * #channels()}.
*
* @see com.android.dialer.speeddial.database.SpeedDialEntry#defaultChannel()
*/