summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2023-09-27 16:05:12 -0700
committerXin Li <delphij@google.com>2023-09-27 16:05:12 -0700
commitbb6c38cee3ec7d0cb12e6e74830877dd5689bf13 (patch)
tree4e828747304537e1998d142ef5896a583a021743 /src
parentcfd436f2bf461bf49df85d10418215dd318312a9 (diff)
parent7e5eab566a14675e3da3f9f760590d7c4434d47a (diff)
downloadContacts-bb6c38cee3ec7d0cb12e6e74830877dd5689bf13.tar.gz
Merge UP1A.231005.007tmp_amf_298295554
Bug: 291102124 Merged-In: If36958e9ed2e9423b9c67ac635c9a7f65469e917 Change-Id: I07ab3884c2b8d9c4dab376ee31b7630d1a0633ea
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/vcard/ImportVCardActivity.java36
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 {