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

Skip to content
Commit 21977800 authored by Jack He's avatar Jack He
Browse files

HFP: Use base::Bind instead of messages for bta_ag_api functions

Summary:
* Do not use bta_sys_sendmsg(BT_HDR) in bta/ag, use base::Bind instead
* Do not use BT_HDR in bta/ag
* Do not do memcpy during thread switch in bta/ag, instead, we use the
  default copy constructor

Details:
* Currently, bta_ag_api functions use explicit messages to cross from
  jni to bta thread. This adds unnecessary indirections that make it
  hard to figure out which methods in bta actually get called
* Instead, base::Bind can bind to methods in bta directly without
  putting parameters in an explicit struct. This greatly simplify our
  code without breaking the current threading model
* With base:Bind, we no longer rely on bta_sys_sendmsg(BT_HDR) to send
  event across threads. We can therefore get rid of BT_HDR in all
  sub-types of tBTA_AG_DATA. Instead of using BT_HDR->layer_specific
  flag to pass down handle IDs, we pass down handle ID directly,
  resulting in less confusion on the actual meaning of data

Bug: 70538124
Test: runtest bluetooth, native unit tests
Change-Id: Ic0b4498dd623d0ea31b4513d6b7861cae390bc72
parent 1c4a3f80
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment