diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index fb861da0a7f0e..4e9073ce5a61e 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.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);