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:
@@ -104,6 +104,7 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
|
||||
WifiManager.EXTRA_NETWORK_INFO);
|
||||
changeNextButtonState(info.isConnected());
|
||||
if (mAutoFinishOnConnection && info.isConnected()) {
|
||||
Log.d(TAG, "mReceiver.onReceive context=" + context + " intent=" + intent);
|
||||
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
|
||||
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
|
||||
if (hasNextButton()) {
|
||||
getNextButton().setVisibility(View.GONE);
|
||||
@@ -212,6 +218,7 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
|
||||
activity.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (connectivity != null
|
||||
&& connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
|
||||
Log.d(TAG, "onActivityCreated Auto-finishing");
|
||||
finishOrNext(Activity.RESULT_OK);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user