Don't advance when recreating from bundle

The fragment is recreated from a bundle when returning from finished
activities, like the OTA and walled garden checks. Telling
WizardManager to advance to the next screen causes a duplicate
activity because WizardManager has already responded to the other
finished activity.

Bug: 15393012
Change-Id: I9817e106a0b243b3943bff6edafc228e9e002232
This commit is contained in:
Russell Brenner
2014-06-04 14:31:42 -07:00
parent 820848a038
commit c56c8c99e9

View File

@@ -104,6 +104,7 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
WifiManager.EXTRA_NETWORK_INFO); WifiManager.EXTRA_NETWORK_INFO);
changeNextButtonState(info.isConnected()); changeNextButtonState(info.isConnected());
if (mAutoFinishOnConnection && info.isConnected()) { if (mAutoFinishOnConnection && info.isConnected()) {
Log.d(TAG, "mReceiver.onReceive context=" + context + " intent=" + intent);
finishOrNext(Activity.RESULT_OK); finishOrNext(Activity.RESULT_OK);
} }
} }
@@ -202,7 +203,12 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
// first if we're supposed to finish once we have a connection // first if we're supposed to finish once we have a connection
mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false); mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false);
if (mAutoFinishOnConnection) { /*
* When entering with a savedInstanceState, we may be returning from a later activity in the
* setup flow. It's not clear yet if there are other possible circumstances. It's not
* appropriate to refire our activity results, so we skip that here.
*/
if (mAutoFinishOnConnection && null == savedInstanceState) {
// Hide the next button // Hide the next button
if (hasNextButton()) { if (hasNextButton()) {
getNextButton().setVisibility(View.GONE); getNextButton().setVisibility(View.GONE);
@@ -212,6 +218,7 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
activity.getSystemService(Context.CONNECTIVITY_SERVICE); activity.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null if (connectivity != null
&& connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) { && connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
Log.d(TAG, "onActivityCreated Auto-finishing");
finishOrNext(Activity.RESULT_OK); finishOrNext(Activity.RESULT_OK);
return; return;
} }