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

Commit 73e49b2e authored by Huirong Liao's avatar Huirong Liao Committed by Rahul Arya
Browse files

Fix rc connect fail after remove bond

[Description]
Fix sometimes not notify framework connection status issue

[Root Cause]
when DUT is direct connect to RC, user remove bond of the RC.
whatever the RC connected or disconnected, it will not notify
framework the connection status, because bta_hh device will
be clear when remove bond.

[Solution]
so when remove bond and pending device is the connecting device,
then notify the framework disconnected, and cancel direct connect.

Bug: 245424920
Test: connect successfully after remove bond.
net_test_btif_hh unit test pass
Merged-In: Ib1a23c5bcd076e2e0a395b6b9a10fca90355d0df
Change-Id: I8d85fb54231b9417042ea5bbcc60ebf740b65af7
parent fd0c04da
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -538,6 +538,15 @@ bt_status_t btif_hh_virtual_unplug(const RawAddress* bd_addr) {
       (btif_hh_cb.status == BTIF_HH_DEV_CONNECTING)) {
          btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
          btif_hh_cb.pending_conn_address = RawAddress::kEmpty;

      /* need to notify up-layer device is disconnected to avoid
       * state out of sync with up-layer */
      do_in_jni_thread(base::Bind(
            [](RawAddress bd_addrcb) {
              HAL_CBACK(bt_hh_callbacks, connection_state_cb, &bd_addrcb,
                        BTHH_CONN_STATE_DISCONNECTED);
            },
           *bd_addr));
    }
    return BT_STATUS_FAIL;
  }