Allow bluetooth in airplane mode when in "toggleable" list.
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS is a list of radios that can be toggled while in airplane mode. This CL changes BluetoothEnabler to respect this. It parallels the logic in WifiEnabler, which enables OEMs to allow Wifi changes when in airplane mode. Most existing devices don't include "bluetooth" in the toggleable list, which means bluetooth will continue to be disabled when in airplane mode for those devices. Fixes http://b/2297314
This commit is contained in:
@@ -107,12 +107,12 @@ public class WirelessSettings extends PreferenceActivity {
|
||||
Preference wifiPreference = findPreference(KEY_TOGGLE_WIFI);
|
||||
Preference btPreference = findPreference(KEY_TOGGLE_BLUETOOTH);
|
||||
Preference wifiSettings = findPreference(KEY_WIFI_SETTINGS);
|
||||
Preference btSettings = findPreference(KEY_BT_SETTINGS);
|
||||
Preference vpnSettings = findPreference(KEY_VPN_SETTINGS);
|
||||
|
||||
IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE);
|
||||
if (b == null) {
|
||||
// Disable BT Settings if BT service is not available.
|
||||
Preference btSettings = findPreference(KEY_BT_SETTINGS);
|
||||
btSettings.setEnabled(false);
|
||||
}
|
||||
|
||||
@@ -131,6 +131,13 @@ public class WirelessSettings extends PreferenceActivity {
|
||||
wifiSettings.setDependency(airplanePreference.getKey());
|
||||
vpnSettings.setDependency(airplanePreference.getKey());
|
||||
}
|
||||
|
||||
// Manually set dependencies for Bluetooth when not toggleable.
|
||||
if (toggleableRadios == null ||
|
||||
!toggleableRadios.contains(Settings.System.RADIO_BLUETOOTH)) {
|
||||
btPreference.setDependency(airplanePreference.getKey());
|
||||
btSettings.setDependency(airplanePreference.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user