Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 796c5b3b authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge "Handle unbonding in Hearing Aid profile"

parents a7b1dc9e e82e07ed
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -951,6 +951,7 @@ class HearingAidImpl : public HearingAid {

    VLOG(2) << __func__ << ": " << address;

    bool connected = hearingDevice->accepting_audio;
    hearingDevice->accepting_audio = false;

    if (hearingDevice->connecting_actively) {
@@ -972,6 +973,7 @@ class HearingAidImpl : public HearingAid {

    hearingDevices.Remove(address);

    if (connected)
      callbacks->OnConnectionState(ConnectionState::DISCONNECTED, address);
  }

+0 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include <base/callback_forward.h>
#include <hardware/bt_hearing_aid.h>

using bluetooth::Uuid;

/** Implementations of HearingAid will also implement this interface */
class HearingAidAudioReceiver {
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@

#include <bluetooth/uuid.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_hearing_aid.h>

#include "advertise_data_parser.h"
#include "bt_common.h"
@@ -244,6 +245,8 @@ extern bt_status_t btif_hf_client_execute_service(bool b_enable);
extern bt_status_t btif_sdp_execute_service(bool b_enable);
extern int btif_hh_connect(const RawAddress* bd_addr);
extern bt_status_t btif_hd_execute_service(bool b_enable);
extern bluetooth::hearing_aid::HearingAidInterface*
btif_hearing_aid_get_interface();

/******************************************************************************
 *  Functions
@@ -1648,6 +1651,7 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
#if (defined(BTA_HD_INCLUDED) && (BTA_HD_INCLUDED == TRUE))
      btif_hd_remove_device(bd_addr);
#endif
      btif_hearing_aid_get_interface()->RemoveDevice(bd_addr);
      btif_storage_remove_bonded_device(&bd_addr);
      bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_NONE);
      break;
+8 −0
Original line number Diff line number Diff line
@@ -101,6 +101,14 @@ class HearingAidInterfaceImpl
                                     Unretained(HearingAid::Get()), volume));
  }

  void RemoveDevice(const RawAddress& address) override {
    DVLOG(2) << __func__ << " address: " << address;
    do_in_bta_thread(FROM_HERE, Bind(&HearingAid::Disconnect,
                                     Unretained(HearingAid::Get()), address));
    do_in_jni_thread(FROM_HERE,
                     Bind(&btif_storage_remove_hearing_aid, address));
  }

  void Cleanup(void) {
    DVLOG(2) << __func__;
    do_in_bta_thread(FROM_HERE, Bind(&HearingAid::CleanUp));
+3 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ class HearingAidInterface {

  /** Closes the interface. */
  virtual void Cleanup(void) = 0;

  /* Called when Hearing Aid is unbonded. */
  virtual void RemoveDevice(const RawAddress& address) = 0;
};

}  // namespace hearing_aid