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
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
index fb861da..4e9073c 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
@@ -21,6 +21,7 @@
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 @@
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 @@
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 @@
return mHearingAidProfile;
}
+ public HapClientProfile getHapClientProfile() {
+ return mHapClientProfile;
+ }
+
public LeAudioProfile getLeAudioProfile() {
return mLeAudioProfile;
}
@@ -675,6 +687,11 @@
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);