2 * Copyright (C) 2010 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.settings.wifi;
19 import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID;
21 import com.android.settings.ProgressCategoryBase;
22 import com.android.settings.R;
23 import com.android.settings.SettingsPreferenceFragment;
25 import android.app.Activity;
26 import android.content.BroadcastReceiver;
27 import android.content.Context;
28 import android.content.DialogInterface;
29 import android.content.Intent;
30 import android.content.IntentFilter;
31 import android.net.ConnectivityManager;
32 import android.net.NetworkInfo;
33 import android.net.NetworkInfo.DetailedState;
34 import android.net.wifi.ScanResult;
35 import android.net.wifi.SupplicantState;
36 import android.net.wifi.WifiConfiguration;
37 import android.net.wifi.WifiConfiguration.KeyMgmt;
38 import android.net.wifi.WifiInfo;
39 import android.net.wifi.WifiManager;
40 import android.os.Bundle;
41 import android.os.Handler;
42 import android.os.Message;
43 import android.preference.CheckBoxPreference;
44 import android.preference.Preference;
45 import android.preference.PreferenceScreen;
46 import android.provider.Settings.Secure;
47 import android.security.Credentials;
48 import android.security.KeyStore;
49 import android.util.Log;
50 import android.view.ContextMenu;
51 import android.view.ContextMenu.ContextMenuInfo;
52 import android.view.Menu;
53 import android.view.MenuInflater;
54 import android.view.MenuItem;
55 import android.view.View;
56 import android.widget.AdapterView.AdapterContextMenuInfo;
57 import android.widget.Button;
58 import android.widget.Toast;
60 import java.util.Collection;
61 import java.util.List;
62 import java.util.TreeSet;
65 * This currently provides three types of UI.
67 * Two are for phones with relatively small screens: "for SetupWizard" and "for usual Settings".
68 * Users just need to launch WifiSettings Activity as usual. The request will be appropriately
69 * handled by ActivityManager, and they will have appropriate look-and-feel with this fragment.
71 * Third type is for Setup Wizard with X-Large, landscape UI. Users need to launch
72 * {@link WifiSettingsForSetupWizardXL} Activity, which contains this fragment but also has
73 * other decorations specific to that screen.
75 public class WifiSettings extends SettingsPreferenceFragment
76 implements DialogInterface.OnClickListener {
77 private static final int MENU_ID_SCAN = Menu.FIRST;
78 private static final int MENU_ID_ADVANCED = Menu.FIRST + 1;
79 private static final int MENU_ID_CONNECT = Menu.FIRST + 2;
80 private static final int MENU_ID_FORGET = Menu.FIRST + 3;
81 private static final int MENU_ID_MODIFY = Menu.FIRST + 4;
83 // Indicates that this fragment is used as a part of Setup Wizard with XL screen settings.
84 // This fragment should show information which has been shown as Dialog in combined UI
85 // inside this fragment.
86 /* package */ static final String IN_XL_SETUP_WIZARD = "in_setup_wizard";
88 // this boolean extra specifies whether to disable the Next button when not connected
89 // Note: this is only effective in Setup Wizard with XL screen size.
90 private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
92 // In SetupWizard XL, We limit the number of showable access points so that the
93 // ListView won't become larger than the screen.
95 // This constant doesn't affect other contexts other than SetupWizard XL.
96 private static int MAX_MENU_COUNT_IN_XL = 6;
98 private final IntentFilter mFilter;
99 private final BroadcastReceiver mReceiver;
100 private final Scanner mScanner;
102 private WifiManager mWifiManager;
103 private WifiEnabler mWifiEnabler;
104 private CheckBoxPreference mNotifyOpenNetworks;
105 private ProgressCategoryBase mAccessPoints;
106 private Preference mAddNetwork;
107 // An access point being editted is stored here.
108 private AccessPoint mSelectedAccessPoint;
110 private DetailedState mLastState;
111 private WifiInfo mLastInfo;
113 private int mKeyStoreNetworkId = INVALID_NETWORK_ID;
115 // should Next button only be enabled when we have a connection?
116 private boolean mEnableNextOnConnection;
117 private boolean mInXlSetupWizard;
120 // TODO: merge into one
121 private WifiConfigPreference mConfigPreference;
122 private WifiDialog mDialog;
124 // Used only in SetupWizard XL, which remembers the network a user selected and
125 // refrain other available networks when trying to connect it.
126 private AccessPoint mConnectingAccessPoint;
128 private boolean mRefrainListUpdate;
130 public WifiSettings() {
131 mFilter = new IntentFilter();
132 mFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
133 mFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
134 mFilter.addAction(WifiManager.NETWORK_IDS_CHANGED_ACTION);
135 mFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
136 mFilter.addAction(WifiManager.SUPPLICANT_CONFIG_CHANGED_ACTION);
137 mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
138 mFilter.addAction(WifiManager.RSSI_CHANGED_ACTION);
140 mReceiver = new BroadcastReceiver() {
142 public void onReceive(Context context, Intent intent) {
147 mScanner = new Scanner();
151 public void onActivityCreated(Bundle savedInstanceState) {
152 // We don't call super.onActivityCreated() here, since it assumes we already set up
153 // Preference (probably in onCreate()), while WifiSettings exceptionally set it up in
156 mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
158 final Activity activity = getActivity();
159 final Intent intent = activity.getIntent();
161 mInXlSetupWizard = intent.getBooleanExtra(IN_XL_SETUP_WIZARD, false);
163 // if we're supposed to enable/disable the Next button based on our current connection
164 // state, start it off in the right state
165 mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
167 if (mEnableNextOnConnection) {
168 if (mEnableNextOnConnection && hasNextButton()) {
169 final ConnectivityManager connectivity = (ConnectivityManager)
170 getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
171 if (connectivity != null) {
172 NetworkInfo info = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
173 changeNextButtonState(info.isConnected());
178 if (mInXlSetupWizard) {
179 addPreferencesFromResource(R.xml.wifi_access_points_for_wifi_setup_xl);
180 } else if (intent.getBooleanExtra("only_access_points", false)) {
181 addPreferencesFromResource(R.xml.wifi_access_points);
183 addPreferencesFromResource(R.xml.wifi_settings);
184 mWifiEnabler = new WifiEnabler(activity,
185 (CheckBoxPreference) findPreference("enable_wifi"));
186 mNotifyOpenNetworks =
187 (CheckBoxPreference) findPreference("notify_open_networks");
188 mNotifyOpenNetworks.setChecked(Secure.getInt(getContentResolver(),
189 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
192 // After confirming PreferenceScreen is available, we call super.
193 super.onActivityCreated(savedInstanceState);
195 // This may be either ProgressCategory or AccessPointCategoryForXL.
196 final ProgressCategoryBase preference =
197 (ProgressCategoryBase) findPreference("access_points");
198 mAccessPoints = preference;
199 mAccessPoints.setOrderingAsAdded(true);
200 mAddNetwork = findPreference("add_network");
202 registerForContextMenu(getListView());
203 setHasOptionsMenu(true);
207 public void onResume() {
209 if (mWifiEnabler != null) {
210 mWifiEnabler.resume();
212 getActivity().registerReceiver(mReceiver, mFilter);
213 if (mKeyStoreNetworkId != INVALID_NETWORK_ID &&
214 KeyStore.getInstance().test() == KeyStore.NO_ERROR) {
215 mWifiManager.connectNetwork(mKeyStoreNetworkId);
217 mKeyStoreNetworkId = INVALID_NETWORK_ID;
218 if (mInXlSetupWizard) {
219 // We show "Now scanning"
220 final int wifiState = mWifiManager.getWifiState();
222 case WifiManager.WIFI_STATE_ENABLED: {
223 updateAccessPoints();
226 case WifiManager.WIFI_STATE_DISABLED:
227 case WifiManager.WIFI_STATE_DISABLING:
228 case WifiManager.WIFI_STATE_UNKNOWN: {
229 mWifiManager.setWifiEnabled(true);
232 mAccessPoints.removeAll();
233 Preference preference = new Preference(getActivity());
234 preference.setLayoutResource(R.layout.preference_widget_shortcut);
235 preference.setSelectable(false);
236 preference.setTitle("Connecting");
237 preference.setSummary("COONNECTING");
238 mAccessPoints.addPreference(preference);
243 updateAccessPoints();
248 public void onPause() {
250 if (mWifiEnabler != null) {
251 mWifiEnabler.pause();
253 getActivity().unregisterReceiver(mReceiver);
255 if (mDialog != null) {
262 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
263 // We don't want menus in Setup Wizard XL.
264 if (!mInXlSetupWizard) {
265 menu.add(Menu.NONE, MENU_ID_SCAN, 0, R.string.wifi_menu_scan)
266 .setIcon(R.drawable.ic_menu_scan_network);
267 menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
268 .setIcon(android.R.drawable.ic_menu_manage);
270 super.onCreateOptionsMenu(menu, inflater);
274 public boolean onOptionsItemSelected(MenuItem item) {
275 switch (item.getItemId()) {
277 if (mWifiManager.isWifiEnabled()) {
281 case MENU_ID_ADVANCED:
282 startFragment(this, AdvancedSettings.class.getCanonicalName(), -1, null);
285 return super.onOptionsItemSelected(item);
289 public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) {
290 if (info instanceof AdapterContextMenuInfo) {
291 Preference preference = (Preference) getListView().getItemAtPosition(
292 ((AdapterContextMenuInfo) info).position);
294 if (preference instanceof AccessPoint) {
295 mSelectedAccessPoint = (AccessPoint) preference;
296 menu.setHeaderTitle(mSelectedAccessPoint.ssid);
297 if (mSelectedAccessPoint.getLevel() != -1
298 && mSelectedAccessPoint.getState() == null) {
299 menu.add(Menu.NONE, MENU_ID_CONNECT, 0, R.string.wifi_menu_connect);
301 if (mSelectedAccessPoint.networkId != INVALID_NETWORK_ID) {
302 menu.add(Menu.NONE, MENU_ID_FORGET, 0, R.string.wifi_menu_forget);
303 menu.add(Menu.NONE, MENU_ID_MODIFY, 0, R.string.wifi_menu_modify);
310 public boolean onContextItemSelected(MenuItem item) {
311 if (mSelectedAccessPoint == null) {
312 return super.onContextItemSelected(item);
314 switch (item.getItemId()) {
315 case MENU_ID_CONNECT: {
316 if (mSelectedAccessPoint.networkId != INVALID_NETWORK_ID) {
317 if (!requireKeyStore(mSelectedAccessPoint.getConfig())) {
318 mWifiManager.connectNetwork(mSelectedAccessPoint.networkId);
320 } else if (mSelectedAccessPoint.security == AccessPoint.SECURITY_NONE) {
321 // Shortcut for open networks.
322 WifiConfiguration config = new WifiConfiguration();
323 config.SSID = AccessPoint.convertToQuotedString(mSelectedAccessPoint.ssid);
324 config.allowedKeyManagement.set(KeyMgmt.NONE);
325 mWifiManager.connectNetwork(config);
327 showConfigUi(mSelectedAccessPoint, true);
331 case MENU_ID_FORGET: {
332 mWifiManager.forgetNetwork(mSelectedAccessPoint.networkId);
335 case MENU_ID_MODIFY: {
336 showConfigUi(mSelectedAccessPoint, true);
340 return super.onContextItemSelected(item);
344 public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
345 if (preference instanceof AccessPoint) {
346 mSelectedAccessPoint = (AccessPoint) preference;
347 showConfigUi(mSelectedAccessPoint, false);
348 } else if (preference == mAddNetwork) {
349 onAddNetworkPressed();
350 } else if (preference == mNotifyOpenNetworks) {
351 Secure.putInt(getContentResolver(),
352 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
353 mNotifyOpenNetworks.isChecked() ? 1 : 0);
355 return super.onPreferenceTreeClick(screen, preference);
361 * Called when a user clicks "Add network" preference or relevant button.
363 private void showConfigUi(AccessPoint accessPoint, boolean edit) {
364 synchronized (this) {
365 mRefrainListUpdate = false;
367 if (mInXlSetupWizard) {
368 final Activity activity = getActivity();
369 activity.findViewById(R.id.wifi_setup_connect).setVisibility(View.VISIBLE);
370 activity.findViewById(R.id.wifi_setup_cancel).setVisibility(View.VISIBLE);
371 showConfigPreference(accessPoint, edit);
373 showDialog(accessPoint, edit);
377 private void showConfigPreference(AccessPoint accessPoint, boolean edit) {
378 // We don't want to show more than one WifiConfigPreference
379 if (mConfigPreference != null) {
380 mAccessPoints.removePreference(mConfigPreference);
383 mConfigPreference = new WifiConfigPreference(this, this, accessPoint, edit);
384 toggleButtonsVisibility(false);
385 final Activity activity = getActivity();
386 if (activity instanceof WifiSettingsForSetupWizardXL) {
387 ((WifiSettingsForSetupWizardXL)activity).onWifiConfigPreferenceAttached(edit);
389 updateAccessPoints();
393 private void toggleButtonsVisibility(boolean firstLayout) {
394 final Activity activity = getActivity();
396 activity.findViewById(R.id.wifi_setup_add_network).setVisibility(View.VISIBLE);
397 activity.findViewById(R.id.wifi_setup_refresh_list).setVisibility(View.VISIBLE);
398 activity.findViewById(R.id.wifi_setup_skip_or_next).setVisibility(View.VISIBLE);
399 activity.findViewById(R.id.wifi_setup_connect).setVisibility(View.GONE);
400 activity.findViewById(R.id.wifi_setup_forget).setVisibility(View.GONE);
401 activity.findViewById(R.id.wifi_setup_cancel).setVisibility(View.GONE);
403 activity.findViewById(R.id.wifi_setup_add_network).setVisibility(View.GONE);
404 activity.findViewById(R.id.wifi_setup_refresh_list).setVisibility(View.GONE);
405 activity.findViewById(R.id.wifi_setup_skip_or_next).setVisibility(View.GONE);
407 // made visible from controller.
411 private void showDialog(AccessPoint accessPoint, boolean edit) {
412 if (mDialog != null) {
415 mDialog = new WifiDialog(getActivity(), this, accessPoint, edit);
419 private boolean requireKeyStore(WifiConfiguration config) {
420 if (WifiConfigController.requireKeyStore(config) &&
421 KeyStore.getInstance().test() != KeyStore.NO_ERROR) {
422 mKeyStoreNetworkId = config.networkId;
423 Credentials.getInstance().unlock(getActivity());
430 * Shows the latest access points available with supplimental information like
431 * the strength of network and the security for it.
433 private void updateAccessPoints() {
434 synchronized (this) {
435 if (mRefrainListUpdate) {
440 mAccessPoints.removeAll();
441 if (mConnectingAccessPoint != null) {
442 mAccessPoints.addPreference(mConnectingAccessPoint);
443 } else if (mConfigPreference != null) {
444 final AccessPoint parent = mConfigPreference.getAccessPoint();
445 if (parent != null) {
446 parent.setSelectable(false);
447 mAccessPoints.addPreference(parent);
449 mAccessPoints.addPreference(mConfigPreference);
451 // AccessPoints are automatically sorted with TreeSet.
452 final Collection<AccessPoint> accessPoints = constructAccessPoints();
454 if (mInXlSetupWizard) {
455 //limit access points on set up wizard
456 int count = MAX_MENU_COUNT_IN_XL;
457 for (AccessPoint accessPoint : accessPoints) {
458 mAccessPoints.addPreference(accessPoint);
465 for (AccessPoint accessPoint : accessPoints) {
466 mAccessPoints.addPreference(accessPoint);
472 private Collection<AccessPoint> constructAccessPoints() {
473 Collection<AccessPoint> accessPoints =
474 new TreeSet<AccessPoint>(new AccessPoint.Comparater());
476 final List<WifiConfiguration> configs = mWifiManager.getConfiguredNetworks();
477 if (configs != null) {
478 for (WifiConfiguration config : configs) {
479 AccessPoint accessPoint = new AccessPoint(getActivity(), config);
480 accessPoint.update(mLastInfo, mLastState);
481 accessPoints.add(accessPoint);
485 final List<ScanResult> results = mWifiManager.getScanResults();
486 if (results != null) {
487 for (ScanResult result : results) {
488 // Ignore hidden and ad-hoc networks.
489 if (result.SSID == null || result.SSID.length() == 0 ||
490 result.capabilities.contains("[IBSS]")) {
494 boolean found = false;
495 for (AccessPoint accessPoint : accessPoints) {
496 if (accessPoint.update(result)) {
501 accessPoints.add(new AccessPoint(getActivity(), result));
509 private void handleEvent(Intent intent) {
510 String action = intent.getAction();
511 if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) {
512 updateWifiState(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
513 WifiManager.WIFI_STATE_UNKNOWN));
514 } else if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action) ||
515 WifiManager.SUPPLICANT_CONFIG_CHANGED_ACTION.equals(action)) {
516 updateAccessPoints();
517 } else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) {
518 updateConnectionState(WifiInfo.getDetailedStateOf((SupplicantState)
519 intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE)));
520 } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) {
521 NetworkInfo info = (NetworkInfo) intent.getParcelableExtra(
522 WifiManager.EXTRA_NETWORK_INFO);
523 changeNextButtonState(info.isConnected());
524 updateConnectionState(info.getDetailedState());
525 } else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
526 updateConnectionState(null);
530 private void updateConnectionState(DetailedState state) {
531 /* sticky broadcasts can call this when wifi is disabled */
532 if (!mWifiManager.isWifiEnabled()) {
537 if (state == DetailedState.OBTAINING_IPADDR) {
543 mLastInfo = mWifiManager.getConnectionInfo();
548 for (int i = mAccessPoints.getPreferenceCount() - 1; i >= 0; --i) {
549 // Maybe there's a WifiConfigPreference
550 Preference preference = mAccessPoints.getPreference(i);
551 if (preference instanceof AccessPoint) {
552 final AccessPoint accessPoint = (AccessPoint) preference;
553 accessPoint.update(mLastInfo, mLastState);
557 final Activity activity = getActivity();
558 if (activity instanceof WifiSettingsForSetupWizardXL) {
559 if (mLastState == DetailedState.FAILED) {
560 // We clean up the status and let users select another network if they want.
561 refreshAccessPoints();
563 ((WifiSettingsForSetupWizardXL)activity).updateConnectionState(mLastState);
567 private void updateWifiState(int state) {
568 if (state == WifiManager.WIFI_STATE_ENABLED) {
572 mAccessPoints.removeAll();
576 private class Scanner extends Handler {
577 private int mRetry = 0;
580 synchronized (WifiSettings.this) {
581 mRefrainListUpdate = false;
583 if (!hasMessages(0)) {
590 mAccessPoints.setProgress(false);
591 synchronized (WifiSettings.this) {
592 mRefrainListUpdate = true;
598 public void handleMessage(Message message) {
599 if (mWifiManager.startScanActive()) {
601 } else if (++mRetry >= 3) {
603 Toast.makeText(getActivity(), R.string.wifi_fail_to_scan,
604 Toast.LENGTH_LONG).show();
607 mAccessPoints.setProgress(mRetry != 0);
608 // Combo scans can take 5-6s to complete. Increase interval to 10s.
609 sendEmptyMessageDelayed(0, 10000);
613 private void changeNextButtonState(boolean wifiAvailable) {
614 if (mInXlSetupWizard) {
615 final Button button =
616 (Button)getActivity().findViewById(R.id.wifi_setup_skip_or_next);
618 button.setText(R.string.wifi_setup_next);
620 button.setText(R.string.wifi_setup_skip);
622 } else if (mEnableNextOnConnection && hasNextButton()) {
623 // Assumes layout for phones has next button inside it.
624 getNextButton().setEnabled(wifiAvailable);
628 public void onClick(DialogInterface dialogInterface, int button) {
629 if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) {
631 } else if (button == WifiDialog.BUTTON_SUBMIT) {
636 /* package */ void submit() {
637 final WifiConfigUiBase uiBase = (mDialog != null ? mDialog : mConfigPreference);
638 final WifiConfigController configController = uiBase.getController();
640 boolean successful = true;
641 switch(configController.chosenNetworkSetupMethod()) {
642 case WifiConfigController.WPS_PBC:
643 mWifiManager.startWpsPbc(mSelectedAccessPoint.bssid);
645 case WifiConfigController.WPS_PIN:
646 int apPin = configController.getWpsPin();
647 mWifiManager.startWpsPin(mSelectedAccessPoint.bssid, apPin);
649 case WifiConfigController.MANUAL:
650 final WifiConfiguration config = configController.getConfig();
652 if (config == null) {
653 if (mSelectedAccessPoint != null
654 && !requireKeyStore(mSelectedAccessPoint.getConfig())
655 && mSelectedAccessPoint.networkId != INVALID_NETWORK_ID) {
656 mWifiManager.connectNetwork(mSelectedAccessPoint.networkId);
660 } else if (config.networkId != INVALID_NETWORK_ID) {
661 if (mSelectedAccessPoint != null) {
662 mWifiManager.saveNetwork(config);
665 if (uiBase.isEdit() || requireKeyStore(config)) {
666 mWifiManager.saveNetwork(config);
668 mWifiManager.connectNetwork(config);
674 if (mInXlSetupWizard && successful && mConfigPreference != null) {
675 // Now connecting to the AccessPoint.
676 mConnectingAccessPoint = mSelectedAccessPoint;
677 mConnectingAccessPoint.setSelectable(false);
680 detachConfigPreference();
683 /* package */ void forget() {
684 mWifiManager.forgetNetwork(mSelectedAccessPoint.networkId);
686 detachConfigPreference();
688 changeNextButtonState(false);
690 final Activity activity = getActivity();
691 if (activity instanceof WifiSettingsForSetupWizardXL) {
692 ((WifiSettingsForSetupWizardXL)activity).onForget();
696 /* package */ void refreshAccessPoints() {
697 mWifiManager.disconnect();
698 if (mWifiManager.isWifiEnabled()) {
702 mConfigPreference = null;
703 mConnectingAccessPoint = null;
704 mAccessPoints.removeAll();
706 if (mInXlSetupWizard) {
707 ((WifiSettingsForSetupWizardXL)getActivity()).onRefreshAccessPoints();
711 /* package */ void detachConfigPreference() {
712 if (mConfigPreference != null) {
713 if (mWifiManager.isWifiEnabled()) {
716 mAccessPoints.removePreference(mConfigPreference);
717 mConfigPreference = null;
718 updateAccessPoints();
719 toggleButtonsVisibility(true);
723 /* package */ void onAddNetworkPressed() {
724 mSelectedAccessPoint = null;
725 showConfigUi(null, true);
728 /* package */ int getAccessPointsCount() {
729 if (mAccessPoints != null) {
730 return mAccessPoints.getPreferenceCount();