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

Commit a4cba292 authored by Fred Quintana's avatar Fred Quintana Committed by Android Git Automerger
Browse files

am 6d076a42: Merge "fix bug where the instance saving of the...

am 6d076a42: Merge "fix bug where the instance saving of the ChooseTypeAndAccountActivity would only work in the case where onSaveInstanceState was called." into ics-mr0

* commit '6d076a42':
  fix bug where the instance saving of the ChooseTypeAndAccountActivity would only work in the case where onSaveInstanceState was called.
parents e6fbf65d 6d076a42
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ public class ChooseTypeAndAccountActivity extends Activity
    private ArrayList<AccountInfo> mAccountInfos;
    private int mPendingRequest = REQUEST_NULL;
    private Parcelable[] mExistingAccounts = null;
    private Parcelable[] mSavedAccounts = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
@@ -124,12 +123,10 @@ public class ChooseTypeAndAccountActivity extends Activity

        if (savedInstanceState != null) {
            mPendingRequest = savedInstanceState.getInt(KEY_INSTANCE_STATE_PENDING_REQUEST);
            mSavedAccounts =
            mExistingAccounts =
                    savedInstanceState.getParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS);
            mExistingAccounts = null;
        } else {
            mPendingRequest = REQUEST_NULL;
            mSavedAccounts = null;
            mExistingAccounts = null;
        }

@@ -246,8 +243,10 @@ public class ChooseTypeAndAccountActivity extends Activity
    protected void onSaveInstanceState(final Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt(KEY_INSTANCE_STATE_PENDING_REQUEST, mPendingRequest);
        if (mPendingRequest == REQUEST_ADD_ACCOUNT) {
            outState.putParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS, mExistingAccounts);
        }
    }

    // Called when the choose account type activity (for adding an account) returns.
    // If it was a success read the account and set it in the result. In all cases
@@ -264,7 +263,6 @@ public class ChooseTypeAndAccountActivity extends Activity

        // we got our result, so clear the fact that we had a pending request
        mPendingRequest = REQUEST_NULL;
        mExistingAccounts = null;

        if (resultCode == RESULT_CANCELED) {
            return;
@@ -293,7 +291,7 @@ public class ChooseTypeAndAccountActivity extends Activity
                if (accountName == null || accountType == null) {
                    Account[] currentAccounts = AccountManager.get(this).getAccounts();
                    Set<Account> preExistingAccounts = new HashSet<Account>();
                    for (Parcelable accountParcel : mSavedAccounts) {
                    for (Parcelable accountParcel : mExistingAccounts) {
                        preExistingAccounts.add((Account) accountParcel);
                    }
                    for (Account account : currentAccounts) {