am 952146ee
: Merge "Clear profile connnection status of bonded devices when BT is turned off" into jb-mr1-dev
* commit '952146ee8f13ea87a890e3e4f7726fe49b60fc3d': Clear profile connnection status of bonded devices when BT is turned off
This commit is contained in:
@@ -119,6 +119,11 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
Log.d(TAG, "onProfileStateChanged: profile " + profile +
|
Log.d(TAG, "onProfileStateChanged: profile " + profile +
|
||||||
" newProfileState " + newProfileState);
|
" 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);
|
mProfileConnectionState.put(profile, newProfileState);
|
||||||
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
|
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
|
||||||
if (!mProfiles.contains(profile)) {
|
if (!mProfiles.contains(profile)) {
|
||||||
@@ -328,6 +333,16 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
|
|||||||
return mProfileConnectionState.get(profile);
|
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?
|
// TODO: do any of these need to run async on a background thread?
|
||||||
private void fillData() {
|
private void fillData() {
|
||||||
fetchName();
|
fetchName();
|
||||||
|
5
src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
Normal file → Executable file
5
src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
Normal file → Executable file
@@ -144,6 +144,11 @@ final class CachedBluetoothDeviceManager {
|
|||||||
if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) {
|
if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) {
|
||||||
cachedDevice.setVisible(false);
|
cachedDevice.setVisible(false);
|
||||||
mCachedDevices.remove(i);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user