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

Commit 7c436bc0 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Disable HOGP only if it was previously enabled

bta_hh_cleanup_disable() is called to cleanup after the HID host and
HOGP host has been disabled. HOGP host must be disabled only if it was
enabled in first place. This change also allows us to remove
bta_hh_cleanup_disable callback from core interfaces. This interface
was used by GATT client because the HOGP host would unregister from
GATT even when it was not registered with GATT beforehand.


Bug: 272153768
Test: Test regression
Change-Id: Iaff8495bbfcc1288b7011380474fa6a0eac302cc
parent d3e9b02b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -229,13 +229,6 @@ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback,

/** De-Register a GATT client application with BTA */
void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg) {
  if (!p_clreg) {
    LOG(ERROR) << __func__ << ": Deregister Failed unknown client cif";
    GetInterfaceToProfiles()->profileSpecific_HACK->bta_hh_cleanup_disable(
        BTA_HH_OK);
    return;
  }

  uint8_t accept_list_size = 0;
  if (controller_get_interface()->supports_ble()) {
    accept_list_size = controller_get_interface()->get_ble_acceptlist_size();
+6 −3
Original line number Diff line number Diff line
@@ -171,10 +171,13 @@ void bta_hh_disc_cmpl(void) {
  /* Deregister with lower layer */
  if (HID_HostDeregister() != HID_SUCCESS) status = BTA_HH_ERR;

  if (bta_hh_cb.gatt_if != BTA_GATTS_INVALID_IF) {
    LOG_DEBUG("Deregister HOGP host before cleanup");
    bta_hh_le_deregister();

  } else {
    bta_hh_cleanup_disable(status);
  }
}

/*******************************************************************************
 *
+0 −1
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ struct HACK_ProfileInterface {
                                          uint16_t* p_max_ssr_lat,
                                          uint16_t* p_min_ssr_tout);
  bool (*bta_hh_le_is_hh_gatt_if)(tGATT_IF client_if);
  void (*bta_hh_cleanup_disable)(tBTA_HH_STATUS status);

  // AVDTP hacks
  void (*btif_av_set_dynamic_audio_buffer_size)(
+0 −1
Original line number Diff line number Diff line
@@ -334,7 +334,6 @@ static bluetooth::core::CoreInterface* CreateInterfaceToProfiles() {
      .btif_hh_virtual_unplug = btif_hh_virtual_unplug,
      .bta_hh_read_ssr_param = bta_hh_read_ssr_param,
      .bta_hh_le_is_hh_gatt_if = bta_hh_le_is_hh_gatt_if,
      .bta_hh_cleanup_disable = bta_hh_cleanup_disable,

      // AVDTP
      .btif_av_set_dynamic_audio_buffer_size =
+0 −1
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ struct bluetooth::core::HACK_ProfileInterface HACK_profileInterface = {
    .btif_hh_virtual_unplug = nullptr,
    .bta_hh_read_ssr_param = nullptr,
    .bta_hh_le_is_hh_gatt_if = nullptr,
    .bta_hh_cleanup_disable = nullptr,

    // AVDTP
    .btif_av_set_dynamic_audio_buffer_size = nullptr,