Language Update for Wi-Fi/Bluetooth Scanning

Bug: 22046234
Change-Id: Iea8fa2368d1e568a8e1fdd3edefa8f4fc6053e48
This commit is contained in:
Lifu Tang
2015-06-23 17:54:56 -07:00
parent 52e728ab11
commit 55601622d5
3 changed files with 48 additions and 30 deletions

View File

@@ -1219,9 +1219,8 @@
<!-- Message to describe "BLE scan always available feature" when Bluetooth 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. -->
<string name="ble_scan_notify_text">To improve location accuracy, apps and
services will scan for Bluetooth devices, even when Bluetooth is off.
You can change this in
<string name="ble_scan_notify_text">To improve location accuracy, system apps and services can
still detect Bluetooth devices. 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>
@@ -1401,9 +1400,8 @@
<!-- 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. -->
<string name="wifi_scan_notify_text">To improve location accuracy, apps and
services will scan for Wi\u2011Fi networks, even when Wi\u2011Fi is off.
You can change this in
<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>
<!-- Wifi scan always mode checkbox text -->
@@ -2791,9 +2789,9 @@
<!-- [CHAR LIMIT=30] Location mode screen, screen title -->
<string name="location_mode_screen_title">Location mode</string>
<!-- [CHAR LIMIT=130] Location mode screen, description for high accuracy mode -->
<string name="location_mode_high_accuracy_description">Use GPS, Wi\u2011Fi, and cellular networks to determine location </string>
<string name="location_mode_high_accuracy_description">Use GPS, Wi\u2011Fi, Bluetooth, or cellular networks to determine location </string>
<!-- [CHAR LIMIT=130] Location mode screen, description for battery saving mode -->
<string name="location_mode_battery_saving_description">Use Wi\u2011Fi and cellular networks to determine location</string>
<string name="location_mode_battery_saving_description">Use Wi\u2011Fi, Bluetooth, or cellular networks to determine location</string>
<!-- [CHAR LIMIT=130] Location mode screen, description for sensors only mode -->
<string name="location_mode_sensors_only_description">Use GPS to determine location</string>
<!-- Help menu label [CHAR LIMIT=20] Location settings screen, overflow menu that takes the user
@@ -2804,15 +2802,14 @@
<!-- [CHAR LIMIT=130] Preference title for Wi-Fi always scanning -->
<string name="location_scanning_wifi_always_scanning_title">Wi\u2011Fi scanning</string>
<!-- Preference description text for Wi-Fi always scanning -->
<string name="location_scanning_wifi_always_scanning_description">Improve
location by allowing apps and services to scan for Wi\u2011Fi networks
even when Wi\u2011Fi is off</string>
<string name="location_scanning_wifi_always_scanning_description">Improve location by allowing
system apps and services to detect Wi\u2011Fi networks at any time.</string>
<!-- [CHAR LIMIT=130] Description text for Bluetooth always scanning -->
<string name="location_scanning_bluetooth_always_scanning_title">Bluetooth scanning</string>
<!-- Description text for Bluetooth always scanning -->
<string name="location_scanning_bluetooth_always_scanning_description">
Improve location by allowing system services to scan for Bluetooth
devices, even when Bluetooth is off</string>
Improve location by allowing system apps and services to detect Bluetooth devices at any
time.</string>
<!-- [CHAR LIMIT=30] Security & location settings screen, setting check box label for Google location service (cell ID, wifi, etc.) -->
<string name="location_network_based">Wi\u2011Fi &amp; cellular network location</string>

View File

@@ -21,6 +21,7 @@ import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -30,6 +31,7 @@ import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.text.Spannable;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
@@ -381,11 +383,19 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
return;
}
final CharSequence briefText = getText(R.string.bluetooth_empty_list_bluetooth_off);
final ContentResolver resolver = getActivity().getContentResolver();
final boolean bleScanningMode = Settings.Global.getInt(
resolver, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1;
if (!bleScanningMode) {
// Show only the brief text if the scanning mode has been turned off.
mEmptyView.setText(briefText, TextView.BufferType.SPANNABLE);
} else {
final StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append(briefText);
contentBuilder.append("\n\n");
contentBuilder.append(getText(R.string.ble_scan_notify_text));
getPreferenceScreen().removeAll();
LinkifyUtils.linkify(mEmptyView, contentBuilder, new LinkifyUtils.OnClickListener() {
@Override
public void onClick() {
@@ -395,6 +405,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
R.string.location_scanning_screen_title, null, null, 0);
}
});
}
getPreferenceScreen().removeAll();
Spannable boldSpan = (Spannable) mEmptyView.getText();
boldSpan.setSpan(
new TextAppearanceSpan(getActivity(), android.R.style.TextAppearance_Medium), 0,

View File

@@ -708,8 +708,17 @@ public class WifiSettings extends RestrictedSettingsFragment
}
final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off);
if (isUiRestricted()) {
// Show only the brief text if the user is not allowed to configure scanning settings.
// 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 (isUiRestricted() || !wifiScanningMode) {
// Show only the brief text if the user is not allowed to configure scanning settings,
// or the scanning mode has been turned off.
mEmptyView.setText(briefText, BufferType.SPANNABLE);
} else {
// Append the description of scanning settings with link.