Don't add the initial account setup flow fragment to the back stack
b/12669681
Change-Id: I39c969d0667c4a394b46adacf58ce02f99c8a52b
diff --git a/src/com/android/email/activity/setup/AccountSetupFinal.java b/src/com/android/email/activity/setup/AccountSetupFinal.java
index 765fbaf..48ea51e 100644
--- a/src/com/android/email/activity/setup/AccountSetupFinal.java
+++ b/src/com/android/email/activity/setup/AccountSetupFinal.java
@@ -85,7 +85,7 @@
// If we're not restoring from a previous state, we want to configure the initial screen
mState = STATE_OPTIONS;
updateHeadline();
- updateContentFragment();
+ updateContentFragment(false /* addToBackstack */);
}
UiUtilities.getView(this, R.id.previous).setOnClickListener(this);
@@ -125,7 +125,7 @@
* Swap in the new fragment according to mState. This pushes the current fragment onto the back
* stack, so only call it once per transition.
*/
- private void updateContentFragment() {
+ private void updateContentFragment(boolean addToBackstack) {
final Fragment f;
switch (mState) {
case STATE_OPTIONS:
@@ -139,7 +139,9 @@
}
final FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.setup_fragment_container, f, CONTENT_FRAGMENT_TAG);
- ft.addToBackStack(null);
+ if (addToBackstack) {
+ ft.addToBackStack(null);
+ }
ft.commit();
}
@@ -163,7 +165,7 @@
case STATE_OPTIONS:
mState = STATE_NAMES;
updateHeadline();
- updateContentFragment();
+ updateContentFragment(true /* addToBackstack */);
if (mSetupData.getFlowMode() == SetupDataFragment.FLOW_MODE_FORCE_CREATE) {
getFragmentManager().executePendingTransactions();
initiateAccountFinalize();