Shows LE audio hearing aid device in a11y settings page (1/3)

Handles HAP profile in LocalBluetoothProfileManager

Bug: 249235823
Test: build pass
Change-Id: Ieb31a1bade5ab43fb229a9e75cc782544d99d0dd
This commit is contained in:
Angela Wang
2022-10-11 08:51:36 +00:00
parent 020a6ef402
commit 8ae5134aef

View File

@@ -21,6 +21,7 @@ import android.bluetooth.BluetoothA2dpSink;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothCsipSetCoordinator;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHapClient;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothHeadsetClient;
import android.bluetooth.BluetoothHearingAid;
@@ -103,6 +104,7 @@ public class LocalBluetoothProfileManager {
private PbapClientProfile mPbapClientProfile;
private PbapServerProfile mPbapProfile;
private HearingAidProfile mHearingAidProfile;
private HapClientProfile mHapClientProfile;
private CsipSetCoordinatorProfile mCsipSetCoordinatorProfile;
private LeAudioProfile mLeAudioProfile;
private LocalBluetoothLeBroadcast mLeAudioBroadcast;
@@ -189,6 +191,12 @@ public class LocalBluetoothProfileManager {
addProfile(mHearingAidProfile, HearingAidProfile.NAME,
BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED);
}
if (mHapClientProfile == null && supportedList.contains(BluetoothProfile.HAP_CLIENT)) {
if (DEBUG) Log.d(TAG, "Adding local HAP_CLIENT profile");
mHapClientProfile = new HapClientProfile(mContext, mDeviceManager, this);
addProfile(mHapClientProfile, HapClientProfile.NAME,
BluetoothHapClient.ACTION_HAP_CONNECTION_STATE_CHANGED);
}
if (mHidProfile == null && supportedList.contains(BluetoothProfile.HID_HOST)) {
if (DEBUG) Log.d(TAG, "Adding local HID_HOST profile");
mHidProfile = new HidProfile(mContext, mDeviceManager, this);
@@ -524,6 +532,10 @@ public class LocalBluetoothProfileManager {
return mHearingAidProfile;
}
public HapClientProfile getHapClientProfile() {
return mHapClientProfile;
}
public LeAudioProfile getLeAudioProfile() {
return mLeAudioProfile;
}
@@ -675,6 +687,11 @@ public class LocalBluetoothProfileManager {
removedProfiles.remove(mHearingAidProfile);
}
if (mHapClientProfile != null && ArrayUtils.contains(uuids, BluetoothUuid.HAS)) {
profiles.add(mHapClientProfile);
removedProfiles.remove(mHapClientProfile);
}
if (mSapProfile != null && ArrayUtils.contains(uuids, BluetoothUuid.SAP)) {
profiles.add(mSapProfile);
removedProfiles.remove(mSapProfile);