summaryrefslogtreecommitdiffstats
path: root/core/java/android/server/BluetoothService.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2009-12-01 18:25:02 -0800
committerJeff Sharkey <jsharkey@android.com>2009-12-22 14:32:15 -0800
commit44303922f14ac71b446a6e50e1180be4c8fed2c7 (patch)
tree4947e77acbbff8bc974ab6e7b57d3a1a400cb270 /core/java/android/server/BluetoothService.java
parent233d316553837ef81fdf152432281d878dc8f773 (diff)
downloadframeworks_base-44303922f14ac71b446a6e50e1180be4c8fed2c7.zip
frameworks_base-44303922f14ac71b446a6e50e1180be4c8fed2c7.tar.gz
frameworks_base-44303922f14ac71b446a6e50e1180be4c8fed2c7.tar.bz2
Watch for "bluetooth" in list of toggleable radios.
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS is a list of radios that can be toggled while in airplane mode. This change adds logic to BluetoothService to allow enabling when Settings.System.RADIO_BLUETOOTH appears in that list. Fixes http://b/2297314
Diffstat (limited to 'core/java/android/server/BluetoothService.java')
-rw-r--r--core/java/android/server/BluetoothService.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index b590449..dfb775f 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -74,6 +74,7 @@ public class BluetoothService extends IBluetooth.Stub {
private int mNativeData;
private BluetoothEventLoop mEventLoop;
private boolean mIsAirplaneSensitive;
+ private boolean mIsAirplaneToggleable;
private int mBluetoothState;
private boolean mRestart = false; // need to call enable() after disable()
private boolean mIsDiscovering;
@@ -370,7 +371,7 @@ public class BluetoothService extends IBluetooth.Stub {
"Need BLUETOOTH_ADMIN permission");
// Airplane mode can prevent Bluetooth radio from being turned on.
- if (mIsAirplaneSensitive && isAirplaneModeOn()) {
+ if (mIsAirplaneSensitive && isAirplaneModeOn() && !mIsAirplaneToggleable) {
return false;
}
if (mBluetoothState != BluetoothAdapter.STATE_OFF) {
@@ -545,7 +546,7 @@ public class BluetoothService extends IBluetooth.Stub {
mEventLoop.onPropertyChanged(propVal);
}
- if (mIsAirplaneSensitive && isAirplaneModeOn()) {
+ if (mIsAirplaneSensitive && isAirplaneModeOn() && !mIsAirplaneToggleable) {
disable(false);
}
@@ -1597,10 +1598,17 @@ public class BluetoothService extends IBluetooth.Stub {
};
private void registerForAirplaneMode(IntentFilter filter) {
- String airplaneModeRadios = Settings.System.getString(mContext.getContentResolver(),
+ final ContentResolver resolver = mContext.getContentResolver();
+ final String airplaneModeRadios = Settings.System.getString(resolver,
Settings.System.AIRPLANE_MODE_RADIOS);
- mIsAirplaneSensitive = airplaneModeRadios == null
- ? true : airplaneModeRadios.contains(Settings.System.RADIO_BLUETOOTH);
+ final String toggleableRadios = Settings.System.getString(resolver,
+ Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
+
+ mIsAirplaneSensitive = airplaneModeRadios == null ? true :
+ airplaneModeRadios.contains(Settings.System.RADIO_BLUETOOTH);
+ mIsAirplaneToggleable = toggleableRadios == null ? false :
+ toggleableRadios.contains(Settings.System.RADIO_BLUETOOTH);
+
if (mIsAirplaneSensitive) {
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
}
@@ -1661,6 +1669,7 @@ public class BluetoothService extends IBluetooth.Stub {
}
pw.println("mIsAirplaneSensitive = " + mIsAirplaneSensitive);
+ pw.println("mIsAirplaneToggleable = " + mIsAirplaneToggleable);
pw.println("Local address = " + getAddress());
pw.println("Local name = " + getName());