diff options
author | eric_kuang.rs <eric_kuang.rs@realtek.com> | 2022-04-21 15:10:14 +0800 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2022-04-28 08:30:38 +0000 |
commit | f6990c3f0624de1d517264c11dff4bc75b4eb51b (patch) | |
tree | 2a6e2661b450bcdbb6b879acc5af9b2bd840825d | |
parent | 74a5335851cb9ce56e2a55eb501608c7a67be1ac (diff) | |
download | TvSettings-f6990c3f0624de1d517264c11dff4bc75b4eb51b.tar.gz |
Add BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED to BluetoothReceiver's filter.
And refresh UI when Hid connection state changed.
Bug: 229938031
Test: manual test
Change-Id: I4889d3ac841f75da726ab93a0ec80fdf764e7ff7
(cherry picked from commit 4d0445c66ac9ccdcd3360348df21776189e55f35)
(cherry picked from commit 19cc08629f0d04d42b62fee202e78ba1d5d35ae4)
Merged-In: I4889d3ac841f75da726ab93a0ec80fdf764e7ff7
-rw-r--r-- | Settings/src/com/android/tv/settings/accessories/BluetoothDevicesService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Settings/src/com/android/tv/settings/accessories/BluetoothDevicesService.java b/Settings/src/com/android/tv/settings/accessories/BluetoothDevicesService.java index dc1b7de15..6f80a601c 100644 --- a/Settings/src/com/android/tv/settings/accessories/BluetoothDevicesService.java +++ b/Settings/src/com/android/tv/settings/accessories/BluetoothDevicesService.java @@ -22,6 +22,7 @@ import android.app.Service; import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothHidHost; import android.bluetooth.BluetoothProfile; import android.content.BroadcastReceiver; import android.content.Context; @@ -132,6 +133,11 @@ public class BluetoothDevicesService extends Service { } } else { switch(action) { + case BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED: + if (device.getBondState() == BluetoothDevice.BOND_BONDED) { + mHandler.post(() -> onDeviceUpdated(device)); + } + break; case BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED: int state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, -1); mHandler.post(() -> onA2dpConnectionStateChanged(device.getName(), state)); @@ -169,6 +175,7 @@ public class BluetoothDevicesService extends Service { filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED); filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); + filter.addAction(BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED); // Headset connection filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); // Bluetooth toggle registerReceiver(mBluetoothReceiver, filter); |