Fix account list for group editing (for master)
- Don't use contact writable account list to populate the
account picker when creating new groups, instead check for
isGroupMembershipEditable() on the account type
- Repeat the same for determining whether the "new group"
button should appear in the PeopleActivity or not
Bug: 5360120
Change-Id: Ifd2fd1cf4ea7bf02d4dcba3e9c023bd7041fab83
Original-Id: Ia1ec62eff3fe4fd5b495548218c58f238ff49788
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 4de62b6..9a3f2ef 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -16,6 +16,7 @@
package com.android.contacts;
+import com.android.contacts.model.AccountType;
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.model.AccountWithDataSet;
import com.android.contacts.test.NeededForTesting;
@@ -172,11 +173,15 @@
return detector.detectCountry().getCountryIso();
}
- public static boolean areAccountsAvailable(Context context) {
+ public static boolean areContactWritableAccountsAvailable(Context context) {
final List<AccountWithDataSet> accounts =
AccountTypeManager.getInstance(context).getAccounts(true /* writeable */);
return !accounts.isEmpty();
}
-
+ public static boolean areGroupWritableAccountsAvailable(Context context) {
+ final List<AccountWithDataSet> accounts =
+ AccountTypeManager.getInstance(context).getGroupWritableAccounts();
+ return !accounts.isEmpty();
+ }
}