summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/editor/ContactEditorFragment.java
diff options
context:
space:
mode:
authorGary Mai <garymai@google.com>2016-11-02 18:26:07 -0700
committerGary Mai <garymai@google.com>2016-11-03 10:47:43 -0700
commit3107b25dcaea54943c58f984084fa9b348ea1885 (patch)
tree4914b1f72c14bdb7448fd3b6c463233d67ad0a5a /src/com/android/contacts/editor/ContactEditorFragment.java
parent817e9e6fdd5603250ea7aca1c1cbd73859350dcc (diff)
downloadpackages_apps_Contacts-3107b25dcaea54943c58f984084fa9b348ea1885.tar.gz
packages_apps_Contacts-3107b25dcaea54943c58f984084fa9b348ea1885.tar.bz2
packages_apps_Contacts-3107b25dcaea54943c58f984084fa9b348ea1885.zip
Show "add account" dialog when it needs to appear
Don't show the dialog if the only account is not a device account. Set the default to be the only account if it is *not* a device account. Test: Manually checked: * Removing only account and attempting to create a new account shows dialog * Clearing preferences shows dialog * If dialog was canceled, verify dialog doesn't appear anymore. * After adding a google account, (and without manually setting default) verified adding a new contact did not show a dialog and the default was automatically set to the only account on device. * Having two accounts and no default shows the pick default account dialog * Removing multiple accounts still has the same behavior as bullet 1 Bug:32555078 Change-Id: Iec664efca7e886d7376cd2aae7c5b2bdad3a8b84
Diffstat (limited to 'src/com/android/contacts/editor/ContactEditorFragment.java')
-rw-r--r--src/com/android/contacts/editor/ContactEditorFragment.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 65c30e856..42ef513fb 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -987,6 +987,9 @@ public class ContactEditorFragment extends Fragment implements
mStatus = Status.SUB_ACTIVITY;
startActivityForResult(intent, REQUEST_CODE_ACCOUNTS_CHANGED);
} else {
+ // Make sure the default account is automatically set if there is only one non-device
+ // account.
+ mEditorUtils.maybeUpdateDefaultAccount();
// Otherwise, there should be a default account. Then either create a local contact
// (if default account is null) or create a contact with the specified account.
AccountWithDataSet defaultAccount = mEditorUtils.getOnlyOrDefaultAccount();