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

Commit 12ad6378 authored by Ivan Podogov's avatar Ivan Podogov
Browse files

Make HID Device service independent from HID Host.

By default, enabling the HID Device service is only possible
during disabling the HID Host service. If, on the other hand,
the HID Host service was never initialized, then a request to
enable the HID Device service should just be executed
immediately.

Test: manual, on a device without the HID Host profile.
Change-Id: I2ab4b8aec413b66d57eb322d38660f1b4c48ba32
parent a4170d8e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -672,5 +672,7 @@ const bthd_interface_t* btif_hd_get_interface() {
void btif_hd_service_registration() {
  BTIF_TRACE_API("%s", __func__);
  /* enable HD */
  if (bt_hd_callbacks != NULL) {
    BTA_HdEnable(bte_hd_evt);
  }
}
+8 −1
Original line number Diff line number Diff line
@@ -687,7 +687,14 @@ void btif_hh_service_registration(bool enable) {
  BTIF_TRACE_API("%s", __func__);

  BTIF_TRACE_API("enable = %d", enable);
  if (enable) {
  if (bt_hh_callbacks == NULL) {
    // The HID Host service was never initialized (it is either disabled or not
    // available in this build). We should proceed directly to changing the HID
    // Device service state (if needed).
    if (!enable) {
      btif_hd_service_registration();
    }
  } else if (enable) {
    BTA_HhEnable(BTA_SEC_ENCRYPT, bte_hh_evt);
  } else {
    btif_hh_cb.service_dereg_active = TRUE;