summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2012-09-04 15:31:03 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-04 15:31:04 -0700
commit952146ee8f13ea87a890e3e4f7726fe49b60fc3d (patch)
treee439f73908a62b7d0b048d16181c0f459578f771 /src
parent22dc1fe2bae886b385ddc22ee4f2819e5764c71a (diff)
parent7951b43bd9a759b01ea994b341c102b03011ca3c (diff)
downloadpackages_apps_settings-952146ee8f13ea87a890e3e4f7726fe49b60fc3d.zip
packages_apps_settings-952146ee8f13ea87a890e3e4f7726fe49b60fc3d.tar.gz
packages_apps_settings-952146ee8f13ea87a890e3e4f7726fe49b60fc3d.tar.bz2
Merge "Clear profile connnection status of bonded devices when BT is turned off" into jb-mr1-dev
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/settings/bluetooth/CachedBluetoothDevice.java15
-rwxr-xr-x[-rw-r--r--]src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java5
2 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index ef223d5..4b19b9c 100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -119,6 +119,11 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
Log.d(TAG, "onProfileStateChanged: profile " + profile +
" newProfileState " + newProfileState);
}
+ if (mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_TURNING_OFF)
+ {
+ if (Utils.D) Log.d(TAG, " BT Turninig Off...Profile conn state change ignored...");
+ return;
+ }
mProfileConnectionState.put(profile, newProfileState);
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
if (!mProfiles.contains(profile)) {
@@ -328,6 +333,16 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
return mProfileConnectionState.get(profile);
}
+ public void clearProfileConnectionState ()
+ {
+ if (Utils.D) {
+ Log.d(TAG," Clearing all connection state for dev:" + mDevice.getName());
+ }
+ for (LocalBluetoothProfile profile :getProfiles()) {
+ mProfileConnectionState.put(profile, BluetoothProfile.STATE_DISCONNECTED);
+ }
+ }
+
// TODO: do any of these need to run async on a background thread?
private void fillData() {
fetchName();
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
index 06be3c4..ff282cc 100644..100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
@@ -144,6 +144,11 @@ final class CachedBluetoothDeviceManager {
if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) {
cachedDevice.setVisible(false);
mCachedDevices.remove(i);
+ } else {
+ // For bonded devices, we need to clear the connection status so that
+ // when BT is enabled next time, device connection status shall be retrieved
+ // by making a binder call.
+ cachedDevice.clearProfileConnectionState();
}
}
}