diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-08-12 12:17:58 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-08-12 12:17:58 +0000 |
commit | 930e46bbf002059debe9ab61598fc9c237ca1569 (patch) | |
tree | 7542e3fcbb7a5ae3d0d0a6dc1c222684f211cbae | |
parent | 1a047394c11be04d56017eed138fcb786a5b2c98 (diff) | |
parent | b4deb77f7fd20f3f3d35b9833facc7b5771b732d (diff) | |
download | Contacts-930e46bbf002059debe9ab61598fc9c237ca1569.tar.gz |
Snap for 10650545 from b4deb77f7fd20f3f3d35b9833facc7b5771b732d to mainline-media-swcodec-release
Change-Id: I47a1ccc031595abe8f67729f1dc602da37346194
-rw-r--r-- | src/com/android/contacts/vcard/ImportVCardActivity.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java index 6ddb8fa1b..3eb7bdbe3 100644 --- a/src/com/android/contacts/vcard/ImportVCardActivity.java +++ b/src/com/android/contacts/vcard/ImportVCardActivity.java @@ -586,31 +586,39 @@ public class ImportVCardActivity extends Activity implements ImportVCardDialogFr String accountName = null; String accountType = null; String dataSet = null; + boolean isNullAccount = false; final Intent intent = getIntent(); - if (intent != null) { + if (intent != null + && intent.hasExtra(SelectAccountActivity.ACCOUNT_NAME) + && intent.hasExtra(SelectAccountActivity.ACCOUNT_TYPE) + && intent.hasExtra(SelectAccountActivity.DATA_SET)) { accountName = intent.getStringExtra(SelectAccountActivity.ACCOUNT_NAME); accountType = intent.getStringExtra(SelectAccountActivity.ACCOUNT_TYPE); dataSet = intent.getStringExtra(SelectAccountActivity.DATA_SET); + isNullAccount = TextUtils.isEmpty(accountName) && TextUtils.isEmpty(accountType) + && TextUtils.isEmpty(dataSet); } else { Log.e(LOG_TAG, "intent does not exist"); } - if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) { - mAccount = new AccountWithDataSet(accountName, accountType, dataSet); - } else { - final AccountTypeManager accountTypes = AccountTypeManager.getInstance(this); - final List<AccountWithDataSet> accountList = accountTypes.blockForWritableAccounts(); - if (accountList.size() == 0) { - mAccount = null; - } else if (accountList.size() == 1) { - mAccount = accountList.get(0); - } else { - startActivityForResult(new Intent(this, SelectAccountActivity.class), - SELECT_ACCOUNT); - return; + final AccountTypeManager accountTypes = AccountTypeManager.getInstance(this); + final List<AccountWithDataSet> accountList = accountTypes.blockForWritableAccounts(); + if ((!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) || isNullAccount) { + AccountWithDataSet selected = new AccountWithDataSet(accountName, accountType, + dataSet); + if (accountList.contains(selected)) { + mAccount = selected; } } + if (accountList.isEmpty()) { + mAccount = null; + } else if (mAccount == null) { + startActivityForResult(new Intent(this, SelectAccountActivity.class), + SELECT_ACCOUNT); + return; + } + if (isCallerSelf(this)) { startImport(sourceUri, sourceDisplayName); } else { |