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

Commit 80ab7ea6 authored by Marcus Hagerott's avatar Marcus Hagerott
Browse files

Prevent editor from closing after account is added

When the ContactEditorAccountsChangedActivity is shown (when creating
a new contact with no default account set) and a new account is added
the editor would close once an account was chosen because a new activity
instance was being created.

Test: manually verify that editor remains open after adding account
while choose account dialog is displayed

Bug 33627801

Change-Id: Icdfbceb0fc2e10619afde4fa772a2efaa21a0c5e
parent 5c65bfd3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -366,7 +366,8 @@ public class AttachPhotoActivity extends ContactsActivity {

        final List<AccountWithDataSet> accounts = AccountInfo.extractAccounts(accountInfos);
        if (editorUtils.shouldShowAccountChangedNotification(accounts)) {
            Intent intent = new Intent(this, ContactEditorAccountsChangedActivity.class);
            Intent intent = new Intent(this, ContactEditorAccountsChangedActivity.class)
                    .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivityForResult(intent, REQUEST_PICK_DEFAULT_ACCOUNT_FOR_NEW_CONTACT);
        } else {
            // Otherwise, there should be a default account. Then either create a null contact
+0 −4
Original line number Diff line number Diff line
@@ -18,10 +18,8 @@ package com.android.contacts.activities;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.LoaderManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.os.Bundle;
import android.provider.ContactsContract.Intents;
import android.view.View;
@@ -36,13 +34,11 @@ import com.android.contacts.R;
import com.android.contacts.editor.ContactEditorUtils;
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.model.account.AccountInfo;
import com.android.contacts.model.account.AccountType;
import com.android.contacts.model.account.AccountWithDataSet;
import com.android.contacts.model.account.AccountsLoader;
import com.android.contacts.util.AccountsListAdapter;
import com.android.contacts.util.AccountsListAdapter.AccountListFilter;
import com.android.contacts.util.ImplicitIntentsUtil;
import com.google.common.util.concurrent.Futures;

import java.util.List;

+1 −1
Original line number Diff line number Diff line
@@ -1016,7 +1016,7 @@ public class ContactEditorFragment extends Fragment implements
        if (mEditorUtils.shouldShowAccountChangedNotification(accounts)) {
            Intent intent = new Intent(mContext, ContactEditorAccountsChangedActivity.class);
            // Prevent a second instance from being started on rotates
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            mStatus = Status.SUB_ACTIVITY;
            startActivityForResult(intent, REQUEST_CODE_ACCOUNTS_CHANGED);
        } else {