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

Commit 54cc4be2 authored by Zach Johnson's avatar Zach Johnson
Browse files

bta_dm_search_cancel can only happen in the active state

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Id94ae72f838a754a39dbd5339a6892c8438e7897
parent 42a73fdc
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -821,25 +821,16 @@ void bta_dm_search_start(tBTA_DM_MSG* p_data) {
 *
 ******************************************************************************/
void bta_dm_search_cancel() {
  tBTA_DM_MSG* p_msg;

  if (BTM_IsInquiryActive()) {
    BTM_CancelInquiry();
    bta_dm_search_cancel_notify();
    p_msg = (tBTA_DM_MSG*)osi_malloc(sizeof(tBTA_DM_MSG));
    p_msg->hdr.event = BTA_DM_SEARCH_CMPL_EVT;
    p_msg->hdr.layer_specific = BTA_DM_API_DISCOVER_EVT;
    bta_sys_sendmsg(p_msg);
    bta_dm_search_cmpl();
  }
  /* If no Service Search going on then issue cancel remote name in case it is
     active */
  else if (!bta_dm_search_cb.name_discover_done) {
    BTM_CancelRemoteDeviceName();

    p_msg = (tBTA_DM_MSG*)osi_malloc(sizeof(tBTA_DM_MSG));
    p_msg->hdr.event = BTA_DM_SEARCH_CMPL_EVT;
    p_msg->hdr.layer_specific = BTA_DM_API_DISCOVER_EVT;
    bta_sys_sendmsg(p_msg);
    bta_dm_search_cmpl();
  } else {
    bta_dm_inq_cmpl(0);
  }