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

Commit 30efd64f authored by weichinweng's avatar weichinweng Committed by Automerger Merge Worker
Browse files

HFP: Cleanup bt_hf_callbacks on the jni thread. am: 0afd3e7a

Change-Id: Ifcd8b78abd6690719f65322e38ba93957a063497
parents fa786544 0afd3e7a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1360,14 +1360,18 @@ void HeadsetInterface::Cleanup() {
  BTIF_TRACE_EVENT("%s", __func__);

  btif_queue_cleanup(UUID_SERVCLASS_AG_HANDSFREE);
  if (bt_hf_callbacks) {

  tBTA_SERVICE_MASK mask = btif_get_enabled_services_mask();
#if (defined(BTIF_HF_SERVICES) && (BTIF_HF_SERVICES & BTA_HFP_SERVICE_MASK))
  if ((mask & (1 << BTA_HFP_SERVICE_ID)) != 0) {
    btif_disable_service(BTA_HFP_SERVICE_ID);
  }
#else
  if ((mask & (1 << BTA_HSP_SERVICE_ID)) != 0) {
    btif_disable_service(BTA_HSP_SERVICE_ID);
#endif
    bt_hf_callbacks = nullptr;
  }
#endif
  do_in_jni_thread(FROM_HERE, base::Bind([]() { bt_hf_callbacks = nullptr; }));
}

bt_status_t HeadsetInterface::SetScoAllowed(bool value) {