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:
@@ -122,9 +122,18 @@ public class WifiEnabler implements Preference.OnPreferenceChangeListener {
|
||||
mWifiCheckBoxPref.setChecked(wifiState == WIFI_STATE_ENABLED);
|
||||
mWifiCheckBoxPref
|
||||
.setSummary(wifiState == WIFI_STATE_DISABLED ? mOriginalSummary : null);
|
||||
|
||||
mWifiCheckBoxPref.setEnabled(isWifiAllowed(mContext));
|
||||
|
||||
|
||||
final boolean hasDependency = !TextUtils.isEmpty(mWifiCheckBoxPref.getDependency());
|
||||
final boolean wifiAllowed = isWifiAllowed(mContext);
|
||||
|
||||
// Avoid disabling when dependencies have been manually set,
|
||||
// workaround for framework bug http://b/2053751
|
||||
if (wifiAllowed) {
|
||||
mWifiCheckBoxPref.setEnabled(true);
|
||||
} else if (!hasDependency) {
|
||||
mWifiCheckBoxPref.setEnabled(false);
|
||||
}
|
||||
|
||||
} else if (wifiState == WIFI_STATE_DISABLING || wifiState == WIFI_STATE_ENABLING) {
|
||||
mWifiCheckBoxPref.setSummary(wifiState == WIFI_STATE_ENABLING ? R.string.wifi_starting
|
||||
: R.string.wifi_stopping);
|
||||
|
Reference in New Issue
Block a user