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

Commit b6f493cb authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix crash when removing bond to HID device

This fixes:
JNI DETECTED ERROR IN APPLICATION: a thread (tid 4760 is making JNI calls
without being attached in call to ExceptionCheck

Bug: none
Test: manually connect and unbond HID device
Tag: #feature
Change-Id: I2f8bd0be6229c84ef34bd236962f00a69e630c5c
parent 0e23c8ce
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -469,8 +469,13 @@ void btif_hh_remove_device(RawAddress bd_addr) {

  /* need to notify up-layer device is disconnected to avoid state out of sync
   * with up-layer */
  HAL_CBACK(bt_hh_callbacks, connection_state_cb, &(p_dev->bd_addr),

  do_in_jni_thread(base::Bind(
      [](RawAddress bd_addr) {
        HAL_CBACK(bt_hh_callbacks, connection_state_cb, &bd_addr,
                  BTHH_CONN_STATE_DISCONNECTED);
      },
      p_dev->bd_addr));

  p_dev->dev_status = BTHH_CONN_STATE_UNKNOWN;
  p_dev->dev_handle = BTA_HH_INVALID_HANDLE;