summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Huang <ath@google.com>2016-04-14 19:16:24 -0700
committerAndy Huang <ath@google.com>2016-04-14 19:17:27 -0700
commitf2eb07a61d474d3b5da100d928d83f1e7e853771 (patch)
treee8c3510f84da6be77e2413d8e96f958eae935b34
parent07a3758a77c288da69528da9245f5dbe6e81051a (diff)
downloadchips-f2eb07a61d474d3b5da100d928d83f1e7e853771.tar.gz
handle the edge case where more than one directory matches an account
In rare cases, Gmail can have multiple directory providers for a single account. In these cases, the prior code would actually end up *omitting* all but the last provider it encountered in the final results. Fix this by only "promoting" the first such matching directory. The choice to promote the first is arbitrary, but this is strictly better than the existing code because it no longer omits the other matching directories. Bug: 28171393 Change-Id: Ifde3dbc868b0e3d1c6c5520429847cb773a808b2
-rw-r--r--src/com/android/ex/chips/BaseRecipientAdapter.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/ex/chips/BaseRecipientAdapter.java b/src/com/android/ex/chips/BaseRecipientAdapter.java
index 2c394f8..f39b016 100644
--- a/src/com/android/ex/chips/BaseRecipientAdapter.java
+++ b/src/com/android/ex/chips/BaseRecipientAdapter.java
@@ -746,8 +746,9 @@ public class BaseRecipientAdapter extends BaseAdapter implements Filterable, Acc
// If an account has been provided and we found a directory that
// corresponds to that account, place that directory second, directly
// underneath the local contacts.
- if (account != null && account.name.equals(params.accountName) &&
- account.type.equals(params.accountType)) {
+ if (preferredDirectory == null && account != null
+ && account.name.equals(params.accountName)
+ && account.type.equals(params.accountType)) {
preferredDirectory = params;
} else {
paramsList.add(params);