Merge "Link to "scanning settings" when Wi-Fi is off." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0c4747401a
@@ -1642,13 +1642,20 @@
|
||||
<string name="use_open_wifi_automatically_summary">Automatically connect to high\u2011quality public networks</string>
|
||||
<!-- Preference title for option to install certificates -->
|
||||
<string name="wifi_install_credentials">Install certificates</string>
|
||||
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off. The
|
||||
place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring
|
||||
the user to "scanning settings" screen. -->
|
||||
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off and Wi-Fi
|
||||
scanning is on. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They
|
||||
mark a link to bring the user to "scanning settings" screen. -->
|
||||
<string name="wifi_scan_notify_text">To improve location accuracy, system apps and services can
|
||||
still scan for Wi\u2011Fi networks. You can change this in
|
||||
<xliff:g id="link_begin">LINK_BEGIN</xliff:g>scanning
|
||||
settings<xliff:g id="link_end">LINK_END</xliff:g>.</string>
|
||||
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off and Wi-Fi
|
||||
scanning is also off. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated.
|
||||
They mark a link to bring the user to "scanning settings" screen. -->
|
||||
<string name="wifi_scan_notify_text_scanning_off">To improve location accuracy,
|
||||
turn on Wi-Fi scanning in
|
||||
<xliff:g id="link_begin">LINK_BEGIN</xliff:g>scanning
|
||||
settings<xliff:g id="link_end">LINK_END</xliff:g>.</string>
|
||||
<!-- Wifi scan always mode checkbox text -->
|
||||
<string name="wifi_scan_notify_remember_choice">Don\u2019t show again</string>
|
||||
<!-- Setting title for setting the wifi sleep policy. Do we keep Wi-Fi active when the screen turns off? -->
|
||||
|
@@ -843,21 +843,15 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
}
|
||||
|
||||
private void setOffMessage() {
|
||||
final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off);
|
||||
|
||||
final CharSequence title = getText(R.string.wifi_empty_list_wifi_off);
|
||||
// Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead,
|
||||
// read the system settings directly. Because when the device is in Airplane mode, even if
|
||||
// Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
|
||||
final ContentResolver resolver = getActivity().getContentResolver();
|
||||
final boolean wifiScanningMode = Settings.Global.getInt(
|
||||
resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
|
||||
|
||||
if (!wifiScanningMode) {
|
||||
// Show only the brief text if the user is not allowed to configure scanning settings,
|
||||
// or the scanning mode has been turned off.
|
||||
mStatusMessagePreference.setTitle(briefText);
|
||||
} else {
|
||||
LinkifyUtils.OnClickListener clickListener = new LinkifyUtils.OnClickListener() {
|
||||
final boolean wifiScanningMode = Settings.Global.getInt(getActivity().getContentResolver(),
|
||||
Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
|
||||
final CharSequence description = wifiScanningMode ? getText(R.string.wifi_scan_notify_text)
|
||||
: getText(R.string.wifi_scan_notify_text_scanning_off);
|
||||
final LinkifyUtils.OnClickListener clickListener = new LinkifyUtils.OnClickListener() {
|
||||
@Override
|
||||
public void onClick() {
|
||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||
@@ -866,9 +860,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
null, R.string.location_scanning_screen_title, null, null, 0);
|
||||
}
|
||||
};
|
||||
mStatusMessagePreference.setText(
|
||||
briefText, getText(R.string.wifi_scan_notify_text), clickListener);
|
||||
}
|
||||
mStatusMessagePreference.setText(title, description, clickListener);
|
||||
removeConnectedAccessPointPreference();
|
||||
mAccessPointsPreferenceCategory.removeAll();
|
||||
mAccessPointsPreferenceCategory.addPreference(mStatusMessagePreference);
|
||||
|
Reference in New Issue
Block a user