165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/*
265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Copyright (C) 2014 The Android Open Source Project
365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Licensed under the Apache License, Version 2.0 (the "License");
565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * you may not use this file except in compliance with the License.
665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * You may obtain a copy of the License at
765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *      http://www.apache.org/licenses/LICENSE-2.0
965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
1065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Unless required by applicable law or agreed to in writing, software
1165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * distributed under the License is distributed on an "AS IS" BASIS,
1265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * See the License for the specific language governing permissions and
1465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * limitations under the License.
1565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */
1665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
1765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepackage com.android.tv.settings.connectivity;
1865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
1965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.R;
2065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.connectivity.setup.SelectFromListWizardFragment;
2165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.connectivity.setup.SelectFromListWizardFragment.ListItem;
2265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.form.FormPage;
2365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport com.android.tv.settings.form.FormPageResultListener;
2465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
2565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.app.Fragment;
2665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.content.Context;
2765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.content.Intent;
2865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.net.wifi.WifiConfiguration;
2965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.os.Bundle;
3065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
3165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport java.util.ArrayList;
3265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
3365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/**
3465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Manual-style add wifi network (the kind you'd use for adding a hidden or out-of-range network.)
3565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */
3665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepublic class AddWifiNetworkActivity extends WifiMultiPagedFormActivity
3765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        implements ConnectToWifiFragment.Listener, TimedMessageWizardFragment.Listener {
3865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
3965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private AdvancedWifiOptionsFlow mAdvancedWifiOptionsFlow;
4065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private WifiConfiguration mConfiguration;
4165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private WifiSecurity mWifiSecurity;
4265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private FormPage mSsidPage;
4365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private FormPage mSecurityPage;
4465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private FormPage mPasswordPage;
4565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private FormPage mConnectPage;
4665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private FormPage mSuccessPage;
4765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
4865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
4965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    protected void onCreate(Bundle savedInstanceState) {
5065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mConfiguration = new WifiConfiguration();
5165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        mConfiguration.hiddenSSID = true;
5265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        addPage(WifiFormPageType.ENTER_SSID);
5365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        super.onCreate(savedInstanceState);
5465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
5565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
5665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
5765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public void onConnectToWifiCompleted(int reason) {
5865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        Bundle result = new Bundle();
5965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        result.putString(FormPage.DATA_KEY_SUMMARY_STRING, Integer.toString(reason));
6065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        onBundlePageResult(mConnectPage, result);
6165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
6265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
6365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
6465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public void onTimedMessageCompleted() {
6565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        Bundle result = new Bundle();
6665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        result.putString(FormPage.DATA_KEY_SUMMARY_STRING, "");
6765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        onBundlePageResult(mSuccessPage, result);
6865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
6965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
7065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
7165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    protected boolean onPageComplete(WifiFormPageType formPageType, FormPage formPage) {
7265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
7365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        switch (formPageType) {
7465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case ENTER_SSID:
7565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                mSsidPage = formPage;
7665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                String ssid = formPage.getDataSummary();
7765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                WifiConfigHelper.setConfigSsid(mConfiguration, ssid);
7865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                addPage(WifiFormPageType.CHOOSE_SECURITY);
7965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
8065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CHOOSE_SECURITY:
8165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                mSecurityPage = formPage;
8265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                if (choiceChosen(formPage, R.string.wifi_security_type_none)) {
8365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    mWifiSecurity = WifiSecurity.NONE;
8465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                } else if (choiceChosen(formPage, R.string.wifi_security_type_wep)) {
8565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    mWifiSecurity = WifiSecurity.WEP;
8665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                } else if (choiceChosen(formPage, R.string.wifi_security_type_wpa)) {
8765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    mWifiSecurity = WifiSecurity.PSK;
8865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                } else if (choiceChosen(formPage, R.string.wifi_security_type_eap)) {
8965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    mWifiSecurity = WifiSecurity.EAP;
9065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                }
9165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                WifiConfigHelper.setConfigKeyManagementBySecurity(mConfiguration, mWifiSecurity);
9265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                if (mWifiSecurity == WifiSecurity.NONE) {
9365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    optionsOrConnect();
9465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                } else {
9565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    addPage(WifiFormPageType.ENTER_PASSWORD);
9665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                }
9765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
9865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case ENTER_PASSWORD:
9965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                mPasswordPage = formPage;
10065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                String password = formPage.getDataSummary();
10165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                setWifiConfigurationPassword(mConfiguration, mWifiSecurity, password);
10265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                optionsOrConnect();
10365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
10465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CONNECT:
10565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                WifiConfigHelper.saveConfiguration(this, mConfiguration);
10665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                switch (Integer.valueOf(formPage.getDataSummary())) {
10765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    case ConnectToWifiFragment.RESULT_REJECTED_BY_AP:
10865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(WifiFormPageType.CONNECT_REJECTED_BY_AP);
10965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        break;
11065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    case ConnectToWifiFragment.RESULT_UNKNOWN_ERROR:
11165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(WifiFormPageType.CONNECT_FAILED);
11265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        break;
11365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    case ConnectToWifiFragment.RESULT_TIMEOUT:
11465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(WifiFormPageType.CONNECT_TIMEOUT);
11565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        break;
11665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    case ConnectToWifiFragment.RESULT_BAD_AUTHENTICATION:
11765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(WifiFormPageType.CONNECT_AUTHENTICATION_FAILURE);
11865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        break;
11965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    case ConnectToWifiFragment.RESULT_SUCCESS:
12065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(WifiFormPageType.SUCCESS);
12165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        break;
12265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    default:
12365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        break;
12465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                }
12565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
12665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CONNECT_FAILED:
12765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                // fall through
12865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CONNECT_TIMEOUT:
12965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                mAdvancedWifiOptionsFlow = new AdvancedWifiOptionsFlow(this, this, true, null);
13065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                // fall through
13165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CONNECT_REJECTED_BY_AP:
13265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                if (choiceChosen(formPage, R.string.wifi_action_try_again)) {
13365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    optionsOrConnect();
13465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                }
13565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
13665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CONNECT_AUTHENTICATION_FAILURE:
13765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                if (choiceChosen(formPage, R.string.wifi_action_try_again)) {
13865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    if (mAdvancedWifiOptionsFlow != null) {
13965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(mAdvancedWifiOptionsFlow.getInitialPage());
14065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    } else {
14165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        addPage(WifiFormPageType.ENTER_SSID);
14265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    }
14365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                }
14465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
14565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            default:
14665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                if (mAdvancedWifiOptionsFlow != null) {
14765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    switch (mAdvancedWifiOptionsFlow.handlePageComplete(formPageType, formPage)) {
14865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        case AdvancedWifiOptionsFlow.RESULT_ALL_PAGES_COMPLETE:
14965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                            connect();
15065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                            break;
15165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        case AdvancedWifiOptionsFlow.RESULT_UNKNOWN_PAGE:
15265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        case AdvancedWifiOptionsFlow.RESULT_PAGE_HANDLED:
15365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        default:
15465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                            break;
15565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    }
15665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                }
15765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                break;
15865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
15965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        return true;
16065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
16165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
16265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    @Override
16365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    protected void displayPage(FormPage formPage, FormPageResultListener listener, boolean forward) {
16465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        WifiFormPageType formPageType = getFormPageType(formPage);
16565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
16665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (formPageType == WifiFormPageType.CONNECT) {
16765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            mConnectPage = formPage;
16865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            Fragment fragment = ConnectToWifiFragment.newInstance(
16965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    getString(formPageType.getTitleResourceId(), mConfiguration.getPrintableSsid()),
17065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    true, mConfiguration);
17165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            displayFragment(fragment, forward);
17265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        } else if (formPageType == WifiFormPageType.SUCCESS) {
17365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            mSuccessPage = formPage;
17465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            Fragment fragment = TimedMessageWizardFragment.newInstance(
17565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    getString(formPageType.getTitleResourceId()));
17665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            displayFragment(fragment, forward);
17765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        } else {
17865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            displayPage(formPageType, mConfiguration.getPrintableSsid(), null, null,
17965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    getLastPage(formPageType), null, formPageType != WifiFormPageType.SUCCESS,
18065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                    formPage, listener, forward, (mAdvancedWifiOptionsFlow != null) ?
18165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                            mAdvancedWifiOptionsFlow.isEmptyTextAllowed(formPageType) : false);
18265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
18365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
18465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
18565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private FormPage getLastPage(WifiFormPageType formPageType) {
18665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        switch (formPageType) {
18765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case CHOOSE_SECURITY:
18865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                return mSecurityPage;
18965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case ENTER_PASSWORD:
19065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                return mPasswordPage;
19165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            case ENTER_SSID:
19265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                return mSsidPage;
19365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            default:
19465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                return (mAdvancedWifiOptionsFlow != null) ? mAdvancedWifiOptionsFlow
19565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        .getPreviousPage(formPageType)
19665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane                        : null;
19765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
19865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
19965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
20065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private void connect() {
20165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (mAdvancedWifiOptionsFlow != null) {
20265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            mAdvancedWifiOptionsFlow.updateConfiguration(mConfiguration);
20365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
20465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        addPage(WifiFormPageType.CONNECT);
20565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
20665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
20765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    private void optionsOrConnect() {
20865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        if (mAdvancedWifiOptionsFlow != null) {
20965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            addPage(mAdvancedWifiOptionsFlow.getInitialPage());
21065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        } else {
21165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane            connect();
21265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane        }
21365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    }
21465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane}
215