Set default account when there's only one writable account.
Hiding the dialog to check with the user about default account
when adding a new contact for one writable account.
BUG 25467864
Change-Id: If97408c4205a31a17c2a5ca5a148592e678097ca
diff --git a/src/com/android/contacts/editor/ContactEditorUtils.java b/src/com/android/contacts/editor/ContactEditorUtils.java
index 93fa8a3..728211f 100644
--- a/src/com/android/contacts/editor/ContactEditorUtils.java
+++ b/src/com/android/contacts/editor/ContactEditorUtils.java
@@ -148,6 +148,11 @@
* Also note that the returned account may have been removed already.
*/
public AccountWithDataSet getDefaultAccount() {
+ final List<AccountWithDataSet> currentWritableAccounts = getWritableAccounts();
+ if (currentWritableAccounts.size() == 1) {
+ return currentWritableAccounts.get(0);
+ }
+
final String saved = mPrefs.getString(mDefaultAccountKey, null);
if (TextUtils.isEmpty(saved)) {
return null;