From f28f4ef80548ef76a0565bcd9f329a5b21c3eef0 Mon Sep 17 00:00:00 2001 From: Rohit Yengisetty Date: Tue, 28 Jul 2015 10:19:24 -0700 Subject: SelectAccountActivity : Support local phone account Selecting the local phone account wasn't doing anything. An issue was reported wherein importing vcf file to local phone account doesn't work. ImportVCardActivity doesn't get the local phone account even though the user selected it in account-selection dialog. [CYNGNOS-399] Change-Id: Ie7534e1046c29b96807735c1caa307acca3de66b --- .../contacts/common/util/AccountSelectionUtil.java | 2 +- .../contacts/common/vcard/SelectAccountActivity.java | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/com/android/contacts/common/util/AccountSelectionUtil.java b/src/com/android/contacts/common/util/AccountSelectionUtil.java index 380e6243..055be2a9 100644 --- a/src/com/android/contacts/common/util/AccountSelectionUtil.java +++ b/src/com/android/contacts/common/util/AccountSelectionUtil.java @@ -131,7 +131,7 @@ public class AccountSelectionUtil { DialogInterface.OnClickListener onClickListener, DialogInterface.OnCancelListener onCancelListener, boolean includeSIM) { final AccountTypeManager accountTypes = AccountTypeManager.getInstance(context); - List writableAccountList = accountTypes.getAccounts(true); + List writableAccountList; if (includeSIM) { writableAccountList = accountTypes.getAccounts(true); } else { diff --git a/src/com/android/contacts/common/vcard/SelectAccountActivity.java b/src/com/android/contacts/common/vcard/SelectAccountActivity.java index eef6b467..04956708 100644 --- a/src/com/android/contacts/common/vcard/SelectAccountActivity.java +++ b/src/com/android/contacts/common/vcard/SelectAccountActivity.java @@ -69,11 +69,6 @@ public class SelectAccountActivity extends Activity { Log.i(LOG_TAG, "The number of available accounts: " + accountList.size()); - // Add the local storage account to allow user to store its contacts in the phone - AccountWithDataSet localAccount = new AccountWithDataSet( - PhoneAccountType.ACCOUNT_NAME, PhoneAccountType.ACCOUNT_TYPE, null); - accountList.add(0, localAccount); - // Multiple accounts. Let users to select one. mAccountSelectionListener = new AccountSelectionUtil.AccountSelectedListener( @@ -81,15 +76,12 @@ public class SelectAccountActivity extends Activity { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); - // Position 0 contains the phone-local account - if (which > 0) { - final AccountWithDataSet account = mAccountList.get(which); - final Intent intent = new Intent(); - intent.putExtra(ACCOUNT_NAME, account.name); - intent.putExtra(ACCOUNT_TYPE, account.type); - intent.putExtra(DATA_SET, account.dataSet); - setResult(RESULT_OK, intent); - } + final AccountWithDataSet account = mAccountList.get(which); + final Intent intent = new Intent(); + intent.putExtra(ACCOUNT_NAME, account.name); + intent.putExtra(ACCOUNT_TYPE, account.type); + intent.putExtra(DATA_SET, account.dataSet); + setResult(RESULT_OK, intent); finish(); } }; -- cgit v1.2.3