From 89ce716e5d4aecc26a8f96b756643f171d0a518e Mon Sep 17 00:00:00 2001 From: Matt Garnes Date: Mon, 15 Jun 2015 15:15:14 -0700 Subject: Add local phone account as a writable AccountTypes. Previously, the local account can be used to create contacts but not groups. Fix this by ensuring that the local account is added as a contact writable account as well as a group writable account. Change-Id: Ia4e0a8abca42d12a708a9e56a181fd3677e56aba --- src/com/android/contacts/common/model/AccountTypeManager.java | 6 ++++++ src/com/android/contacts/common/util/AccountsListAdapter.java | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/contacts/common/model/AccountTypeManager.java b/src/com/android/contacts/common/model/AccountTypeManager.java index 64af2102..1b1eb038 100644 --- a/src/com/android/contacts/common/model/AccountTypeManager.java +++ b/src/com/android/contacts/common/model/AccountTypeManager.java @@ -465,6 +465,12 @@ class AccountTypeManagerImpl extends AccountTypeManager AccountType localAccountType = new PhoneAccountType(mContext, mContext.getPackageName()); addAccountType(localAccountType, accountTypesByTypeAndDataSet, accountTypesByType); + AccountWithDataSet localAccountWithDataSet = new AccountWithDataSet( + PhoneAccountType.ACCOUNT_NAME, PhoneAccountType.ACCOUNT_TYPE, null); + allAccounts.add(localAccountWithDataSet); + contactWritableAccounts.add(localAccountWithDataSet); + groupWritableAccounts.add(localAccountWithDataSet); + // If any extension packages were specified, process them as well. if (!extensionPackages.isEmpty()) { Log.d(TAG, "Registering " + extensionPackages.size() + " extension packages"); diff --git a/src/com/android/contacts/common/util/AccountsListAdapter.java b/src/com/android/contacts/common/util/AccountsListAdapter.java index e3ff36c9..e4f551b7 100644 --- a/src/com/android/contacts/common/util/AccountsListAdapter.java +++ b/src/com/android/contacts/common/util/AccountsListAdapter.java @@ -68,10 +68,6 @@ public final class AccountsListAdapter extends BaseAdapter { mAccountTypes = AccountTypeManager.getInstance(context); mAccounts = getAccounts(accountListFilter); - // Add the virtual local storage account to allow user to store its contacts in the phone - mAccounts.add(0, new AccountWithDataSet(PhoneAccountType.ACCOUNT_NAME, - PhoneAccountType.ACCOUNT_TYPE, - null)); if (currentAccount != null && !mAccounts.isEmpty() && !mAccounts.get(0).equals(currentAccount) -- cgit v1.2.3