Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb6c38ce authored by Xin Li's avatar Xin Li
Browse files

Merge UP1A.231005.007

Bug: 291102124
Merged-In: If36958e9ed2e9423b9c67ac635c9a7f65469e917
Change-Id: I07ab3884c2b8d9c4dab376ee31b7630d1a0633ea
parents cfd436f2 7e5eab56
Loading
Loading
Loading
Loading
+22 −14
Original line number Diff line number Diff line
@@ -586,30 +586,38 @@ 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) {
        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 (accountList.size() == 1) {
                mAccount = accountList.get(0);
            } else {
        } else if (mAccount == null) {
            startActivityForResult(new Intent(this, SelectAccountActivity.class),
                SELECT_ACCOUNT);
            return;
        }
        }

        if (isCallerSelf(this)) {
            startImport(sourceUri, sourceDisplayName);