From 2becf93d275a1e678abedd16b88225d6cecf49e2 Mon Sep 17 00:00:00 2001 From: Fred Quintana Date: Tue, 15 Nov 2011 17:33:08 -0800 Subject: When in the Choose Account flow if the accounts list display was initially skipped if the user cancels out of adding an account the flow itself should be canceled rather than showing the accounts list display. Bug: 5599693 Change-Id: I5075e86656e237dddcb5e1d76e432e1cf525ab79 --- .../android/accounts/ChooseTypeAndAccountActivity.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/java/android/accounts/ChooseTypeAndAccountActivity.java b/core/java/android/accounts/ChooseTypeAndAccountActivity.java index c3c9d16..136c68c 100644 --- a/core/java/android/accounts/ChooseTypeAndAccountActivity.java +++ b/core/java/android/accounts/ChooseTypeAndAccountActivity.java @@ -216,7 +216,7 @@ public class ChooseTypeAndAccountActivity extends Activity if (mPendingRequest == REQUEST_NULL) { // If there are no allowable accounts go directly to add account - if (mAccountInfos.isEmpty()) { + if (shouldSkipToChooseAccountTypeFlow()) { startChooseAccountTypeActivity(); return; } @@ -265,6 +265,12 @@ public class ChooseTypeAndAccountActivity extends Activity mPendingRequest = REQUEST_NULL; if (resultCode == RESULT_CANCELED) { + // if cancelling out of addAccount and the original state caused us to skip this, + // finish this activity + if (shouldSkipToChooseAccountTypeFlow()) { + setResult(Activity.RESULT_CANCELED); + finish(); + } return; } @@ -318,6 +324,14 @@ public class ChooseTypeAndAccountActivity extends Activity finish(); } + /** + * convenience method to check if we should skip the accounts list display and immediately + * jump to the flow that asks the user to select from the account type list + */ + private boolean shouldSkipToChooseAccountTypeFlow() { + return mAccountInfos.isEmpty(); + } + protected void runAddAccountForAuthenticator(String type) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "runAddAccountForAuthenticator: " + type); -- cgit v1.1