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
This commit is contained in:
Alice Kuo
2023-05-17 10:27:28 +08:00
parent f91a331f1d
commit df394f762d

View File

@@ -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) {