<item>Set usage cycle...</item>
</string-array>
- <!-- Wi-Fi settings. Presented as a list dialog to the user to choose the Wi-Fi frequency band. -->
- <string-array name="wifi_frequency_band_entries">
- <!-- Operation on both 2.4 GHz and 5 GHz [CHAR LIMIT=25]-->
- <item>Automatic</item>
- <!-- Operation on 5 GHz alone [CHAR LIMIT=25]-->
- <item>5 GHz only</item>
- <!-- Operation on 2.4 GHz alone [CHAR LIMIT=25]-->
- <item>2.4 GHz only</item>
- </string-array>
-
- <!-- Match with wifi_frequency_band_entries and the values of the settings in WifiManager. -->
- <!-- Do not translate. -->
- <string-array name="wifi_frequency_band_values">
- <!-- Do not translate. -->
- <item>0</item>
- <!-- Do not translate. -->
- <item>1</item>
- <!-- Do not translate. -->
- <item>2</item>
- </string-array>
-
-
<!-- Display options for UsageStats class -->
<string-array name="usage_stats_display_order_types">
<item>Usage time</item>
<string name="wifi_advanced_titlebar">Advanced Wi\u2011Fi</string>
<!-- Wi-Fi settings screen, configure, settings section. This is a header shown above configure wifi settings. [CHAR LIMIT=30] -->
<string name="wifi_configure_titlebar">Configure Wi\u2011Fi</string>
- <!-- 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>
- <!-- Wi-Fi settings screen, setting summary for setting the wifi frequency band [CHAR LIMIT=50]-->
- <string name="wifi_setting_frequency_band_summary">Specify the frequency range of operation</string>
- <!-- Wi-Fi settings screen, error message when the frequency band could not be set [CHAR LIMIT=50]. -->
- <string name="wifi_setting_frequency_band_error">There was a problem setting the frequency band.</string>
<!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's MAC address. -->
<string name="wifi_advanced_mac_address_title">MAC address</string>
<!-- Title of the screen to adjust IP settings -->
android:summary="@string/wifi_automatically_connect_summary"
android:dialogTitle="@string/wifi_select_assistant_dialog_title" />
- <ListPreference
- android:key="frequency_band"
- android:title="@string/wifi_setting_frequency_band_title"
- android:summary="@string/wifi_setting_frequency_band_summary"
- android:entries="@array/wifi_frequency_band_entries"
- android:entryValues="@array/wifi_frequency_band_values" />
-
<Preference
android:key="mac_address"
android:title="@string/wifi_advanced_mac_address_title"
private static final String KEY_MAC_ADDRESS = "mac_address";
private static final String KEY_SAVED_NETWORKS = "saved_networks";
private static final String KEY_CURRENT_IP_ADDRESS = "current_ip_address";
- private static final String KEY_FREQUENCY_BAND = "frequency_band";
private static final String KEY_NOTIFY_OPEN_NETWORKS = "notify_open_networks";
private static final String KEY_SLEEP_POLICY = "sleep_policy";
private static final String KEY_WIFI_ASSISTANT = "wifi_assistant";
getPreferenceScreen().removePreference(mWifiAssistantPreference);
}
- ListPreference frequencyPref = (ListPreference) findPreference(KEY_FREQUENCY_BAND);
-
- if (mWifiManager.isDualBandSupported()) {
- frequencyPref.setOnPreferenceChangeListener(this);
- int value = mWifiManager.getFrequencyBand();
- if (value != -1) {
- frequencyPref.setValue(String.valueOf(value));
- updateFrequencyBandSummary(frequencyPref, value);
- } else {
- Log.e(TAG, "Failed to fetch frequency band");
- }
- } else {
- if (frequencyPref != null) {
- // null if it has already been removed before resume
- getPreferenceScreen().removePreference(frequencyPref);
- }
- }
-
ListPreference sleepPolicyPref = (ListPreference) findPreference(KEY_SLEEP_POLICY);
if (sleepPolicyPref != null) {
if (Utils.isWifiOnly(context)) {
final Context context = getActivity();
String key = preference.getKey();
- if (KEY_FREQUENCY_BAND.equals(key)) {
- try {
- int value = Integer.parseInt((String) newValue);
- mWifiManager.setFrequencyBand(value, true);
- updateFrequencyBandSummary(preference, value);
- } catch (NumberFormatException e) {
- Toast.makeText(context, R.string.wifi_setting_frequency_band_error,
- Toast.LENGTH_SHORT).show();
- return false;
- }
- } else if (KEY_WIFI_ASSISTANT.equals(key)) {
+ if (KEY_WIFI_ASSISTANT.equals(key)) {
NetworkScorerAppManager.NetworkScorerAppData wifiAssistant =
NetworkScorerAppManager.getScorer(context, (String) newValue);
if (wifiAssistant == null) {