Added Saved networks UI to Wifi
+ Added Saved networks to Overflow menu + Moved WPS Pin Entry from Overflow menu to Advance Setting Activity + "Automatically manage Wi-Fi : Let a Wi-Fi assistant manage your connection" + "Wi-Fi assistant : <selected assistant> [cog secondary hit target] + MAC address & IP address list items have the static italic style - "Avoid poor connections" from Advance Settings - "Wi-Fi optimization" from Advance Settings Bug: 15698824 Change-Id: Ieb25b29874752db07398dcb200ec07862779f507
This commit is contained in:
@@ -205,6 +205,22 @@
|
|||||||
android:resource="@id/wifi_settings" />
|
android:resource="@id/wifi_settings" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="Settings$SavedAccessPointsSettingsActivity"
|
||||||
|
android:taskAffinity="com.android.settings"
|
||||||
|
android:label="@string/wifi_saved_access_points_label"
|
||||||
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
|
android:parentActivityName="Settings$WifiSettingsActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<action android:name="android.settings.WIFI_IF_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.wifi.SavedAccessPointsSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
||||||
|
android:resource="@id/wifi_settings" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".wifi.WifiInfo"
|
<activity android:name=".wifi.WifiInfo"
|
||||||
android:theme="@style/Theme.SubSettingsDialogWhenLarge"
|
android:theme="@style/Theme.SubSettingsDialogWhenLarge"
|
||||||
android:taskAffinity="com.android.settings"
|
android:taskAffinity="com.android.settings"
|
||||||
|
64
res/layout/wifi_advance_layout.xml
Normal file
64
res/layout/wifi_advance_layout.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dip"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingTop="6dip"
|
||||||
|
android:paddingBottom="6dip">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+android:id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="16dip"
|
||||||
|
android:paddingEnd="16dip"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:fadingEdge="horizontal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/summary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@android:id/title"
|
||||||
|
android:layout_alignStart="@android:id/title"
|
||||||
|
android:paddingStart="16dip"
|
||||||
|
android:layout_marginEnd="16dip"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:maxLines="4" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@android:id/widget_frame"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -1539,7 +1539,9 @@
|
|||||||
<string name="wifi_connect_failed_message" product="default">The phone was unable to connect to this Wi\u2011Fi network.</string>
|
<string name="wifi_connect_failed_message" product="default">The phone was unable to connect to this Wi\u2011Fi network.</string>
|
||||||
|
|
||||||
<!-- Wi-Fi Advanced Settings --> <skip />
|
<!-- Wi-Fi Advanced Settings --> <skip />
|
||||||
<!-- Wi-Fi settings screen, advanced, settings section. This is a header shown above advanced wifi settings. -->
|
<!-- Wi-Fi settings screen, Saved networks, settings section. This is a header shown above Saved networks wifi settings. [CHAR LIMIT=30] -->
|
||||||
|
<string name="wifi_saved_access_points_titlebar">Saved networks</string>
|
||||||
|
<!-- Wi-Fi settings screen, advanced, settings section. This is a header shown above advanced wifi settings. [CHAR LIMIT=30] -->
|
||||||
<string name="wifi_advanced_titlebar">Advanced Wi\u2011Fi</string>
|
<string name="wifi_advanced_titlebar">Advanced Wi\u2011Fi</string>
|
||||||
<!-- Wi-Fi settings screen, setting title for setting the band [CHAR LIMIT=50]-->
|
<!-- Wi-Fi settings screen, setting title for setting the band [CHAR LIMIT=50]-->
|
||||||
<string name="wifi_setting_frequency_band_title">Wi\u2011Fi frequency band</string>
|
<string name="wifi_setting_frequency_band_title">Wi\u2011Fi frequency band</string>
|
||||||
@@ -1553,7 +1555,9 @@
|
|||||||
<!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's current IP address. -->
|
<!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's current IP address. -->
|
||||||
<string name="wifi_advanced_ip_address_title">IP address</string>
|
<string name="wifi_advanced_ip_address_title">IP address</string>
|
||||||
|
|
||||||
<!-- Wifi Advanced settings. Used as a label under the shortcut icon that goes to Wifi advanced settings. [CHAR LIMIT=20]-->
|
<!-- Wifi saved access points. Used as a label under the shortcut icon that goes to Wifi saved access points. [CHAR LIMIT=20] -->
|
||||||
|
<string name="wifi_saved_access_points_label">Saved networks</string>
|
||||||
|
<!-- Wifi Advanced settings. Used as a label under the shortcut icon that goes to Wifi advanced settings. [CHAR LIMIT=20] -->
|
||||||
<string name="wifi_advanced_settings_label">IP settings</string>
|
<string name="wifi_advanced_settings_label">IP settings</string>
|
||||||
<!-- Menu item to save the IP settings -->
|
<!-- Menu item to save the IP settings -->
|
||||||
<string name="wifi_ip_settings_menu_save">Save</string>
|
<string name="wifi_ip_settings_menu_save">Save</string>
|
||||||
|
@@ -68,20 +68,25 @@
|
|||||||
android:title="@string/wifi_menu_wps_pbc"
|
android:title="@string/wifi_menu_wps_pbc"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="wps_pin_entry"
|
||||||
|
android:title="@string/wifi_menu_wps_pin"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="suspend_optimizations"
|
android:key="suspend_optimizations"
|
||||||
android:title="@string/wifi_suspend_optimizations"
|
android:title="@string/wifi_suspend_optimizations"
|
||||||
android:summary="@string/wifi_suspend_optimizations_summary"
|
android:summary="@string/wifi_suspend_optimizations_summary"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="mac_address"
|
<Preference
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:key="mac_address"
|
||||||
android:title="@string/wifi_advanced_mac_address_title"
|
android:title="@string/wifi_advanced_mac_address_title"
|
||||||
/>
|
android:layout="@layout/wifi_advance_layout" />
|
||||||
|
|
||||||
<Preference android:key="current_ip_address"
|
<Preference
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:key="current_ip_address"
|
||||||
android:title="@string/wifi_advanced_ip_address_title"
|
android:title="@string/wifi_advanced_ip_address_title"
|
||||||
/>
|
android:layout="@layout/wifi_advance_layout" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
20
res/xml/wifi_display_saved_access_points.xml
Normal file
20
res/xml/wifi_display_saved_access_points.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:title="@string/wifi_display_settings_title">
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright (C) 2012 The Android Open Source Project
|
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -14,8 +14,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
android:title="@string/wifi_saved_access_points_titlebar">
|
||||||
android:title="@string/wifi_display_settings_title" >
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -73,6 +73,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class DeviceAdminSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class DeviceAdminSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class DataUsageSummaryActivity extends SettingsActivity { /* empty */ }
|
public static class DataUsageSummaryActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AdvancedWifiSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AdvancedWifiSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
public static class SavedAccessPointsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class TextToSpeechSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class TextToSpeechSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AndroidBeamSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AndroidBeamSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class WifiDisplaySettingsActivity extends SettingsActivity { /* empty */ }
|
public static class WifiDisplaySettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -107,6 +107,7 @@ import com.android.settings.vpn2.VpnSettings;
|
|||||||
import com.android.settings.wfd.WifiDisplaySettings;
|
import com.android.settings.wfd.WifiDisplaySettings;
|
||||||
import com.android.settings.widget.SwitchBar;
|
import com.android.settings.widget.SwitchBar;
|
||||||
import com.android.settings.wifi.AdvancedWifiSettings;
|
import com.android.settings.wifi.AdvancedWifiSettings;
|
||||||
|
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
|
||||||
import com.android.settings.wifi.WifiSettings;
|
import com.android.settings.wifi.WifiSettings;
|
||||||
import com.android.settings.wifi.p2p.WifiP2pSettings;
|
import com.android.settings.wifi.p2p.WifiP2pSettings;
|
||||||
|
|
||||||
@@ -234,6 +235,7 @@ public class SettingsActivity extends Activity
|
|||||||
WirelessSettings.class.getName(),
|
WirelessSettings.class.getName(),
|
||||||
WifiSettings.class.getName(),
|
WifiSettings.class.getName(),
|
||||||
AdvancedWifiSettings.class.getName(),
|
AdvancedWifiSettings.class.getName(),
|
||||||
|
SavedAccessPointsWifiSettings.class.getName(),
|
||||||
BluetoothSettings.class.getName(),
|
BluetoothSettings.class.getName(),
|
||||||
TetherSettings.class.getName(),
|
TetherSettings.class.getName(),
|
||||||
WifiP2pSettings.class.getName(),
|
WifiP2pSettings.class.getName(),
|
||||||
|
@@ -42,6 +42,7 @@ import com.android.settings.notification.ZenModeSettings;
|
|||||||
import com.android.settings.print.PrintSettingsFragment;
|
import com.android.settings.print.PrintSettingsFragment;
|
||||||
import com.android.settings.users.UserSettings;
|
import com.android.settings.users.UserSettings;
|
||||||
import com.android.settings.wifi.AdvancedWifiSettings;
|
import com.android.settings.wifi.AdvancedWifiSettings;
|
||||||
|
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
|
||||||
import com.android.settings.wifi.WifiSettings;
|
import com.android.settings.wifi.WifiSettings;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -85,6 +86,7 @@ public final class Ranking {
|
|||||||
// Wi-Fi
|
// Wi-Fi
|
||||||
sRankMap.put(WifiSettings.class.getName(), RANK_WIFI);
|
sRankMap.put(WifiSettings.class.getName(), RANK_WIFI);
|
||||||
sRankMap.put(AdvancedWifiSettings.class.getName(), RANK_WIFI);
|
sRankMap.put(AdvancedWifiSettings.class.getName(), RANK_WIFI);
|
||||||
|
sRankMap.put(SavedAccessPointsWifiSettings.class.getName(), RANK_WIFI);
|
||||||
|
|
||||||
// BT
|
// BT
|
||||||
sRankMap.put(BluetoothSettings.class.getName(), RANK_BT);
|
sRankMap.put(BluetoothSettings.class.getName(), RANK_BT);
|
||||||
|
@@ -45,6 +45,7 @@ import com.android.settings.notification.ZenModeSettings;
|
|||||||
import com.android.settings.print.PrintSettingsFragment;
|
import com.android.settings.print.PrintSettingsFragment;
|
||||||
import com.android.settings.users.UserSettings;
|
import com.android.settings.users.UserSettings;
|
||||||
import com.android.settings.wifi.AdvancedWifiSettings;
|
import com.android.settings.wifi.AdvancedWifiSettings;
|
||||||
|
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
|
||||||
import com.android.settings.wifi.WifiSettings;
|
import com.android.settings.wifi.WifiSettings;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -72,6 +73,13 @@ public final class SearchIndexableResources {
|
|||||||
AdvancedWifiSettings.class.getName(),
|
AdvancedWifiSettings.class.getName(),
|
||||||
R.drawable.ic_settings_wireless));
|
R.drawable.ic_settings_wireless));
|
||||||
|
|
||||||
|
sResMap.put(SavedAccessPointsWifiSettings.class.getName(),
|
||||||
|
new SearchIndexableResource(
|
||||||
|
Ranking.getRankForClassName(SavedAccessPointsWifiSettings.class.getName()),
|
||||||
|
R.xml.wifi_display_saved_access_points,
|
||||||
|
SavedAccessPointsWifiSettings.class.getName(),
|
||||||
|
R.drawable.ic_settings_wireless));
|
||||||
|
|
||||||
sResMap.put(BluetoothSettings.class.getName(),
|
sResMap.put(BluetoothSettings.class.getName(),
|
||||||
new SearchIndexableResource(
|
new SearchIndexableResource(
|
||||||
Ranking.getRankForClassName(BluetoothSettings.class.getName()),
|
Ranking.getRankForClassName(BluetoothSettings.class.getName()),
|
||||||
|
@@ -32,6 +32,7 @@ import android.util.Log;
|
|||||||
import android.util.LruCache;
|
import android.util.LruCache;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -59,7 +60,8 @@ class AccessPoint extends Preference {
|
|||||||
*/
|
*/
|
||||||
public static final int HIGHER_FREQ_5GHZ = 5900;
|
public static final int HIGHER_FREQ_5GHZ = 5900;
|
||||||
|
|
||||||
/** Experimental: we should be able to show the user the list of BSSIDs and bands
|
/**
|
||||||
|
* Experimental: we should be able to show the user the list of BSSIDs and bands
|
||||||
* for that SSID.
|
* for that SSID.
|
||||||
* For now this data is used only with Verbose Logging so as to show the band and number
|
* For now this data is used only with Verbose Logging so as to show the band and number
|
||||||
* of BSSIDs on which that network is seen.
|
* of BSSIDs on which that network is seen.
|
||||||
@@ -79,7 +81,9 @@ class AccessPoint extends Preference {
|
|||||||
|
|
||||||
private static int[] wifi_signal_attributes = { R.attr.wifi_signal };
|
private static int[] wifi_signal_attributes = { R.attr.wifi_signal };
|
||||||
|
|
||||||
/** These values are matched in string arrays -- changes must be kept in sync */
|
/**
|
||||||
|
* These values are matched in string arrays -- changes must be kept in sync
|
||||||
|
*/
|
||||||
static final int SECURITY_NONE = 0;
|
static final int SECURITY_NONE = 0;
|
||||||
static final int SECURITY_WEP = 1;
|
static final int SECURITY_WEP = 1;
|
||||||
static final int SECURITY_PSK = 2;
|
static final int SECURITY_PSK = 2;
|
||||||
@@ -97,6 +101,7 @@ class AccessPoint extends Preference {
|
|||||||
int security;
|
int security;
|
||||||
int networkId = -1;
|
int networkId = -1;
|
||||||
boolean wpsAvailable = false;
|
boolean wpsAvailable = false;
|
||||||
|
boolean showSummary = true;
|
||||||
|
|
||||||
PskType pskType = PskType.UNKNOWN;
|
PskType pskType = PskType.UNKNOWN;
|
||||||
|
|
||||||
@@ -246,6 +251,11 @@ class AccessPoint extends Preference {
|
|||||||
protected void onBindView(View view) {
|
protected void onBindView(View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
updateIcon(getLevel(), getContext());
|
updateIcon(getLevel(), getContext());
|
||||||
|
|
||||||
|
final TextView summaryView = (TextView) view.findViewById(
|
||||||
|
com.android.internal.R.id.summary);
|
||||||
|
summaryView.setVisibility(showSummary ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
notifyChanged();
|
notifyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +406,18 @@ class AccessPoint extends Preference {
|
|||||||
return "\"" + string + "\"";
|
return "\"" + string + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** visibility status of the WifiConfiguration
|
/**
|
||||||
|
* Shows or Hides the Summary of an AccessPoint.
|
||||||
|
*
|
||||||
|
* @param showSummary true will show the summary, false will hide the summary
|
||||||
|
*/
|
||||||
|
public void setShowSummary(boolean showSummary){
|
||||||
|
this.showSummary = showSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the visibility status of the WifiConfiguration.
|
||||||
|
*
|
||||||
* @return autojoin debugging information
|
* @return autojoin debugging information
|
||||||
* TODO: use a string formatter
|
* TODO: use a string formatter
|
||||||
* ["rssi 5Ghz", "num results on 5GHz" / "rssi 5Ghz", "num results on 5GHz"]
|
* ["rssi 5Ghz", "num results on 5GHz" / "rssi 5Ghz", "num results on 5GHz"]
|
||||||
@@ -489,7 +510,9 @@ class AccessPoint extends Preference {
|
|||||||
return visibility.toString();
|
return visibility.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the title and summary; may indirectly call notifyChanged() */
|
/**
|
||||||
|
* Updates the title and summary; may indirectly call notifyChanged().
|
||||||
|
*/
|
||||||
private void refresh() {
|
private void refresh() {
|
||||||
setTitle(ssid);
|
setTitle(ssid);
|
||||||
|
|
||||||
|
@@ -54,6 +54,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
|
|||||||
private static final String KEY_INSTALL_CREDENTIALS = "install_credentials";
|
private static final String KEY_INSTALL_CREDENTIALS = "install_credentials";
|
||||||
private static final String KEY_WIFI_DIRECT = "wifi_direct";
|
private static final String KEY_WIFI_DIRECT = "wifi_direct";
|
||||||
private static final String KEY_WPS_PUSH = "wps_push_button";
|
private static final String KEY_WPS_PUSH = "wps_push_button";
|
||||||
|
private static final String KEY_WPS_PIN = "wps_pin_entry";
|
||||||
private static final String KEY_SUSPEND_OPTIMIZATIONS = "suspend_optimizations";
|
private static final String KEY_SUSPEND_OPTIMIZATIONS = "suspend_optimizations";
|
||||||
|
|
||||||
private WifiManager mWifiManager;
|
private WifiManager mWifiManager;
|
||||||
@@ -147,6 +148,16 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// WpsDialog: Create the dialog like WifiSettings does.
|
||||||
|
Preference wpsPinPref = findPreference(KEY_WPS_PIN);
|
||||||
|
wpsPinPref.setOnPreferenceClickListener(new OnPreferenceClickListener(){
|
||||||
|
public boolean onPreferenceClick(Preference arg0) {
|
||||||
|
WpsDialog wpsDialog = new WpsDialog(getActivity(), WpsInfo.DISPLAY);
|
||||||
|
wpsDialog.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
CheckBoxPreference suspendOptimizations =
|
CheckBoxPreference suspendOptimizations =
|
||||||
(CheckBoxPreference) findPreference(KEY_SUSPEND_OPTIMIZATIONS);
|
(CheckBoxPreference) findPreference(KEY_SUSPEND_OPTIMIZATIONS);
|
||||||
suspendOptimizations.setChecked(Global.getInt(getContentResolver(),
|
suspendOptimizations.setChecked(Global.getInt(getContentResolver(),
|
||||||
@@ -275,11 +286,13 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
|
|||||||
String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
|
String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
|
||||||
wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress
|
wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress
|
||||||
: getActivity().getString(R.string.status_unavailable));
|
: getActivity().getString(R.string.status_unavailable));
|
||||||
|
wifiMacAddressPref.setSelectable(false);
|
||||||
|
|
||||||
Preference wifiIpAddressPref = findPreference(KEY_CURRENT_IP_ADDRESS);
|
Preference wifiIpAddressPref = findPreference(KEY_CURRENT_IP_ADDRESS);
|
||||||
String ipAddress = Utils.getWifiIpAddresses(getActivity());
|
String ipAddress = Utils.getWifiIpAddresses(getActivity());
|
||||||
wifiIpAddressPref.setSummary(ipAddress == null ?
|
wifiIpAddressPref.setSummary(ipAddress == null ?
|
||||||
getActivity().getString(R.string.status_unavailable) : ipAddress);
|
getActivity().getString(R.string.status_unavailable) : ipAddress);
|
||||||
|
wifiIpAddressPref.setSelectable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
215
src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
Normal file
215
src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.wifi;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.net.wifi.ScanResult;
|
||||||
|
import android.net.wifi.WifiConfiguration;
|
||||||
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.Preference.OnPreferenceClickListener;
|
||||||
|
import android.preference.PreferenceScreen;
|
||||||
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
import com.android.settings.search.Indexable;
|
||||||
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI to manage saved networks/access points.
|
||||||
|
*/
|
||||||
|
public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
|
||||||
|
implements DialogInterface.OnClickListener, Indexable {
|
||||||
|
private static final String TAG = "SavedAccessPointsWifiSettings";
|
||||||
|
|
||||||
|
private WifiDialog mDialog;
|
||||||
|
private WifiManager mWifiManager;
|
||||||
|
private AccessPoint mDlgAccessPoint;
|
||||||
|
private Bundle mAccessPointSavedState;
|
||||||
|
private AccessPoint mSelectedAccessPoint;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.wifi_display_saved_access_points);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
initPreferences();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPreferences() {
|
||||||
|
PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||||
|
final Context context = getActivity();
|
||||||
|
|
||||||
|
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||||
|
final List<AccessPoint> accessPoints = constructSavedAccessPoints(context, mWifiManager);
|
||||||
|
|
||||||
|
preferenceScreen.removeAll();
|
||||||
|
|
||||||
|
final int accessPointsSize = accessPoints.size();
|
||||||
|
for (int i = 0; i < accessPointsSize; ++i){
|
||||||
|
preferenceScreen.addPreference(accessPoints.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getPreferenceScreen().getPreferenceCount() < 1) {
|
||||||
|
Log.w(TAG, "Saved networks activity loaded, but there are no saved networks!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<AccessPoint> constructSavedAccessPoints(Context context,
|
||||||
|
WifiManager wifiManager){
|
||||||
|
List<AccessPoint> accessPoints = new ArrayList<AccessPoint>();
|
||||||
|
Map<String, List<ScanResult>> resultsMap = new HashMap<String, List<ScanResult>>();
|
||||||
|
|
||||||
|
final List<WifiConfiguration> configs = wifiManager.getConfiguredNetworks();
|
||||||
|
final List<ScanResult> scanResults = wifiManager.getScanResults();
|
||||||
|
|
||||||
|
if (configs != null) {
|
||||||
|
//Construct a Map for quick searching of a wifi network via ssid.
|
||||||
|
final int scanResultsSize = scanResults.size();
|
||||||
|
for (int i = 0; i < scanResultsSize; ++i){
|
||||||
|
final ScanResult result = scanResults.get(i);
|
||||||
|
List<ScanResult> res = resultsMap.get(result.SSID);
|
||||||
|
|
||||||
|
if(res == null){
|
||||||
|
res = new ArrayList<ScanResult>();
|
||||||
|
resultsMap.put(result.SSID, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.add(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
final int configsSize = configs.size();
|
||||||
|
for (int i = 0; i < configsSize; ++i){
|
||||||
|
AccessPoint accessPoint = new AccessPoint(context, configs.get(i));
|
||||||
|
final List<ScanResult> results = resultsMap.get(accessPoint.ssid);
|
||||||
|
|
||||||
|
accessPoint.setShowSummary(false);
|
||||||
|
if(results != null){
|
||||||
|
final int resultsSize = results.size();
|
||||||
|
for (int j = 0; j < resultsSize; ++j){
|
||||||
|
accessPoint.update(results.get(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
accessPoints.add(accessPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return accessPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showDialog(AccessPoint accessPoint, boolean edit) {
|
||||||
|
if (mDialog != null) {
|
||||||
|
removeDialog(WifiSettings.WIFI_DIALOG_ID);
|
||||||
|
mDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the access point and edit mode
|
||||||
|
mDlgAccessPoint = accessPoint;
|
||||||
|
|
||||||
|
showDialog(WifiSettings.WIFI_DIALOG_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(int dialogId) {
|
||||||
|
switch (dialogId) {
|
||||||
|
case WifiSettings.WIFI_DIALOG_ID:
|
||||||
|
mSelectedAccessPoint = mDlgAccessPoint;
|
||||||
|
mDialog = new WifiDialog(getActivity(), this, mDlgAccessPoint, false);
|
||||||
|
return mDialog;
|
||||||
|
|
||||||
|
}
|
||||||
|
return super.onCreateDialog(dialogId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int button) {
|
||||||
|
if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) {
|
||||||
|
mWifiManager.forget(mSelectedAccessPoint.networkId, null);
|
||||||
|
getPreferenceScreen().removePreference(mSelectedAccessPoint);
|
||||||
|
mSelectedAccessPoint = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
||||||
|
if (preference instanceof AccessPoint) {
|
||||||
|
showDialog((AccessPoint) preference, false);
|
||||||
|
return true;
|
||||||
|
} else{
|
||||||
|
return super.onPreferenceTreeClick(screen, preference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For search.
|
||||||
|
*/
|
||||||
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
|
new BaseSearchIndexProvider() {
|
||||||
|
@Override
|
||||||
|
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
|
||||||
|
final List<SearchIndexableRaw> result = new ArrayList<SearchIndexableRaw>();
|
||||||
|
final Resources res = context.getResources();
|
||||||
|
final String title = res.getString(R.string.wifi_saved_access_points_titlebar);
|
||||||
|
|
||||||
|
// Add fragment title
|
||||||
|
SearchIndexableRaw data = new SearchIndexableRaw(context);
|
||||||
|
data.title = title;
|
||||||
|
data.screenTitle = title;
|
||||||
|
data.enabled = enabled;
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
// Add available Wi-Fi access points
|
||||||
|
WifiManager wifiManager =
|
||||||
|
(WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||||
|
final List<AccessPoint> accessPoints =
|
||||||
|
constructSavedAccessPoints(context, wifiManager);
|
||||||
|
|
||||||
|
final int accessPointsSize = accessPoints.size();
|
||||||
|
for (int i = 0; i < accessPointsSize; ++i){
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = accessPoints.get(i).getTitle().toString();
|
||||||
|
data.screenTitle = title;
|
||||||
|
data.enabled = enabled;
|
||||||
|
result.add(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
@@ -39,6 +39,7 @@ public class WifiPickerActivity extends SettingsActivity implements ButtonBarHan
|
|||||||
protected boolean isValidFragment(String fragmentName) {
|
protected boolean isValidFragment(String fragmentName) {
|
||||||
if (WifiSettings.class.getName().equals(fragmentName)
|
if (WifiSettings.class.getName().equals(fragmentName)
|
||||||
|| WifiP2pSettings.class.getName().equals(fragmentName)
|
|| WifiP2pSettings.class.getName().equals(fragmentName)
|
||||||
|
|| SavedAccessPointsWifiSettings.class.getName().equals(fragmentName)
|
||||||
|| AdvancedWifiSettings.class.getName().equals(fragmentName)) return true;
|
|| AdvancedWifiSettings.class.getName().equals(fragmentName)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
private static final String TAG = "WifiSettings";
|
private static final String TAG = "WifiSettings";
|
||||||
/* package */ static final int MENU_ID_WPS_PBC = Menu.FIRST;
|
/* package */ static final int MENU_ID_WPS_PBC = Menu.FIRST;
|
||||||
private static final int MENU_ID_WPS_PIN = Menu.FIRST + 1;
|
private static final int MENU_ID_WPS_PIN = Menu.FIRST + 1;
|
||||||
private static final int MENU_ID_P2P = Menu.FIRST + 2;
|
private static final int MENU_ID_SAVED_NETWORK = Menu.FIRST + 2;
|
||||||
/* package */ static final int MENU_ID_ADD_NETWORK = Menu.FIRST + 3;
|
/* package */ static final int MENU_ID_ADD_NETWORK = Menu.FIRST + 3;
|
||||||
private static final int MENU_ID_ADVANCED = Menu.FIRST + 4;
|
private static final int MENU_ID_ADVANCED = Menu.FIRST + 4;
|
||||||
private static final int MENU_ID_SCAN = Menu.FIRST + 5;
|
private static final int MENU_ID_SCAN = Menu.FIRST + 5;
|
||||||
@@ -93,7 +93,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
private static final int MENU_ID_MODIFY = Menu.FIRST + 8;
|
private static final int MENU_ID_MODIFY = Menu.FIRST + 8;
|
||||||
private static final int MENU_ID_WRITE_NFC = Menu.FIRST + 9;
|
private static final int MENU_ID_WRITE_NFC = Menu.FIRST + 9;
|
||||||
|
|
||||||
private static final int WIFI_DIALOG_ID = 1;
|
public static final int WIFI_DIALOG_ID = 1;
|
||||||
/* package */ static final int WPS_PBC_DIALOG_ID = 2;
|
/* package */ static final int WPS_PBC_DIALOG_ID = 2;
|
||||||
private static final int WPS_PIN_DIALOG_ID = 3;
|
private static final int WPS_PIN_DIALOG_ID = 3;
|
||||||
private static final int WRITE_NFC_DIALOG_ID = 6;
|
private static final int WRITE_NFC_DIALOG_ID = 6;
|
||||||
@@ -105,6 +105,8 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
private static final String SAVE_DIALOG_EDIT_MODE = "edit_mode";
|
private static final String SAVE_DIALOG_EDIT_MODE = "edit_mode";
|
||||||
private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state";
|
private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state";
|
||||||
|
|
||||||
|
private static boolean savedNetworksExist;
|
||||||
|
|
||||||
private final IntentFilter mFilter;
|
private final IntentFilter mFilter;
|
||||||
private final BroadcastReceiver mReceiver;
|
private final BroadcastReceiver mReceiver;
|
||||||
private final Scanner mScanner;
|
private final Scanner mScanner;
|
||||||
@@ -320,15 +322,16 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
.setIcon(ta.getDrawable(0))
|
.setIcon(ta.getDrawable(0))
|
||||||
.setEnabled(wifiIsEnabled)
|
.setEnabled(wifiIsEnabled)
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||||
menu.add(Menu.NONE, MENU_ID_SCAN, 0, R.string.wifi_menu_scan)
|
if (savedNetworksExist){
|
||||||
//.setIcon(R.drawable.ic_menu_scan_network)
|
menu.add(Menu.NONE, MENU_ID_SAVED_NETWORK, 0, R.string.wifi_saved_access_points_label)
|
||||||
.setEnabled(wifiIsEnabled)
|
.setIcon(ta.getDrawable(0))
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
.setEnabled(wifiIsEnabled)
|
||||||
menu.add(Menu.NONE, MENU_ID_WPS_PIN, 0, R.string.wifi_menu_wps_pin)
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||||
.setEnabled(wifiIsEnabled)
|
}
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
menu.add(Menu.NONE, MENU_ID_SCAN, 0, R.string.menu_stats_refresh)
|
||||||
|
.setEnabled(wifiIsEnabled)
|
||||||
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||||
menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
|
menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
|
||||||
//.setIcon(android.R.drawable.ic_menu_manage)
|
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||||
ta.recycle();
|
ta.recycle();
|
||||||
}
|
}
|
||||||
@@ -357,6 +360,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
case MENU_ID_WPS_PBC:
|
case MENU_ID_WPS_PBC:
|
||||||
showDialog(WPS_PBC_DIALOG_ID);
|
showDialog(WPS_PBC_DIALOG_ID);
|
||||||
return true;
|
return true;
|
||||||
|
/*
|
||||||
case MENU_ID_P2P:
|
case MENU_ID_P2P:
|
||||||
if (getActivity() instanceof SettingsActivity) {
|
if (getActivity() instanceof SettingsActivity) {
|
||||||
((SettingsActivity) getActivity()).startPreferencePanel(
|
((SettingsActivity) getActivity()).startPreferencePanel(
|
||||||
@@ -369,6 +373,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
R.string.wifi_p2p_settings_title, -1, null);
|
R.string.wifi_p2p_settings_title, -1, null);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
*/
|
||||||
case MENU_ID_WPS_PIN:
|
case MENU_ID_WPS_PIN:
|
||||||
showDialog(WPS_PIN_DIALOG_ID);
|
showDialog(WPS_PIN_DIALOG_ID);
|
||||||
return true;
|
return true;
|
||||||
@@ -382,16 +387,26 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
onAddNetworkPressed();
|
onAddNetworkPressed();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case MENU_ID_SAVED_NETWORK:
|
||||||
|
if (getActivity() instanceof SettingsActivity) {
|
||||||
|
((SettingsActivity) getActivity()).startPreferencePanel(
|
||||||
|
SavedAccessPointsWifiSettings.class.getCanonicalName(), null,
|
||||||
|
R.string.wifi_saved_access_points_titlebar, null, this, 0);
|
||||||
|
} else {
|
||||||
|
startFragment(this, SavedAccessPointsWifiSettings.class.getCanonicalName(),
|
||||||
|
R.string.wifi_saved_access_points_titlebar,
|
||||||
|
-1 /* Do not request a result */, null);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
case MENU_ID_ADVANCED:
|
case MENU_ID_ADVANCED:
|
||||||
if (getActivity() instanceof SettingsActivity) {
|
if (getActivity() instanceof SettingsActivity) {
|
||||||
((SettingsActivity) getActivity()).startPreferencePanel(
|
((SettingsActivity) getActivity()).startPreferencePanel(
|
||||||
AdvancedWifiSettings.class.getCanonicalName(),
|
AdvancedWifiSettings.class.getCanonicalName(), null,
|
||||||
null,
|
R.string.wifi_advanced_titlebar, null, this, 0);
|
||||||
R.string.wifi_advanced_titlebar, null,
|
|
||||||
this, 0);
|
|
||||||
} else {
|
} else {
|
||||||
startFragment(this, AdvancedWifiSettings.class.getCanonicalName(),
|
startFragment(this, AdvancedWifiSettings.class.getCanonicalName(),
|
||||||
R.string.wifi_advanced_titlebar, -1, null);
|
R.string.wifi_advanced_titlebar, -1 /* Do not request a results */,
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -468,6 +483,10 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
if (mSelectedAccessPoint.security == AccessPoint.SECURITY_NONE &&
|
if (mSelectedAccessPoint.security == AccessPoint.SECURITY_NONE &&
|
||||||
mSelectedAccessPoint.networkId == INVALID_NETWORK_ID) {
|
mSelectedAccessPoint.networkId == INVALID_NETWORK_ID) {
|
||||||
mSelectedAccessPoint.generateOpenNetworkConfig();
|
mSelectedAccessPoint.generateOpenNetworkConfig();
|
||||||
|
if (!savedNetworksExist){
|
||||||
|
savedNetworksExist = true;
|
||||||
|
getActivity().invalidateOptionsMenu();
|
||||||
|
}
|
||||||
mWifiManager.connect(mSelectedAccessPoint.getConfig(), mConnectListener);
|
mWifiManager.connect(mSelectedAccessPoint.getConfig(), mConnectListener);
|
||||||
} else {
|
} else {
|
||||||
showDialog(mSelectedAccessPoint, false);
|
showDialog(mSelectedAccessPoint, false);
|
||||||
@@ -606,6 +625,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
final List<WifiConfiguration> configs = wifiManager.getConfiguredNetworks();
|
final List<WifiConfiguration> configs = wifiManager.getConfiguredNetworks();
|
||||||
if (configs != null) {
|
if (configs != null) {
|
||||||
|
savedNetworksExist = (configs.size() > 0);
|
||||||
for (WifiConfiguration config : configs) {
|
for (WifiConfiguration config : configs) {
|
||||||
AccessPoint accessPoint = new AccessPoint(context, config);
|
AccessPoint accessPoint = new AccessPoint(context, config);
|
||||||
if (lastInfo != null && lastState != null) {
|
if (lastInfo != null && lastState != null) {
|
||||||
|
Reference in New Issue
Block a user