From df394f762d8f2077ec1c46719385a29ef9147c3d Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Wed, 17 May 2023 10:27:28 +0800 Subject: [PATCH] Add the connection state change handle for the volume control profile Volume control profile broadcast the connection state change only for the connected when the bluetooth service get connected with connected VCP device. The other connection state didn't be handled. In some case, it would causes the system ui or setting got the vcp profile connected and then no further update for the real connection state. The patch add the VCP profile connection state handle that is the same as the other profile. Bug: 278982782 Bug: 279126500 Test: connect/disconnect and check the connection state change would update Change-Id: Ia94151456611a4bbe7d7291bb9c4931764b62b9b --- .../settingslib/bluetooth/LocalBluetoothProfileManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index 43e3a32c97b61..0e7b79ba297ab 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -37,6 +37,7 @@ import android.bluetooth.BluetoothPbapClient; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothSap; import android.bluetooth.BluetoothUuid; +import android.bluetooth.BluetoothVolumeControl; import android.content.Context; import android.content.Intent; import android.os.ParcelUuid; @@ -240,8 +241,8 @@ public class LocalBluetoothProfileManager { Log.d(TAG, "Adding local Volume Control profile"); } mVolumeControlProfile = new VolumeControlProfile(mContext, mDeviceManager, this); - // Note: no event handler for VCP, only for being connectable. - mProfileNameMap.put(VolumeControlProfile.NAME, mVolumeControlProfile); + addProfile(mVolumeControlProfile, VolumeControlProfile.NAME, + BluetoothVolumeControl.ACTION_CONNECTION_STATE_CHANGED); } if (mLeAudioProfile == null && supportedList.contains(BluetoothProfile.LE_AUDIO)) { if (DEBUG) {