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

Commit 1c32133f authored by Cheney Ni's avatar Cheney Ni
Browse files

A2DP: Clear remote suspend flag if local is also stopping

This flag is used to block the streaming if the remote doesn't want it,
and is unblocked by local suspending. Here we do for stopping cases in
the stack main thread.

Fixes: 185555891
Test: Manually check the flag by making a SCO after remote suspending
Tag: #compatibility
Change-Id: I0c2124122c2f703917ae982379164caf723441dd
parent 3cc5af2e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ class A2dpTransport
  void StopRequest() override {
    if (btif_av_get_peer_sep() == AVDT_TSEP_SNK &&
        !btif_av_stream_started_ready()) {
      btif_av_clear_remote_suspend_flag();
      return;
    }
    LOG(INFO) << __func__ << ": handling";
+13 −10
Original line number Diff line number Diff line
@@ -3282,16 +3282,19 @@ uint8_t btif_av_get_peer_sep(void) {
}

void btif_av_clear_remote_suspend_flag(void) {
  auto clear_remote_suspend_flag = []() {
    BtifAvPeer* peer = btif_av_find_active_peer();
    if (peer == nullptr) {
      BTIF_TRACE_WARNING("%s: No active peer found", __func__);
      return;
    }

    BTIF_TRACE_DEBUG("%s: Peer %s : flags=%s are cleared", __func__,
                     peer->PeerAddress().ToString().c_str(),
                     peer->FlagsToString().c_str());
    peer->ClearFlags(BtifAvPeer::kFlagRemoteSuspend);
  };
  // switch to main thread to prevent a race condition of accessing peers
  do_in_main_thread(FROM_HERE, base::Bind(clear_remote_suspend_flag));
}

bool btif_av_is_peer_edr(const RawAddress& peer_address) {