diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/accounts/ChooseTypeAndAccountActivity.java | 16 |
1 files changed, 15 insertions, 1 deletions
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); |