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

Commit 23f985fe authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by android-build-merger
Browse files

Don't trigger AVDTP Suspend in response to AVDTP Suspend+Start from remote

am: 28faf875

Change-Id: Ibdb89a81251633762771e55c00b2f1f492b14094
parents fb4e4e57 28faf875
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -88,6 +88,11 @@ bool btif_a2dp_on_started(const RawAddress& peer_addr,
          }
          ack = true;
        }
      } else {
        // We were started remotely
        if (btif_av_is_a2dp_offload_enabled()) {
          btif_av_stream_start_offload();
        }
      }

      /* media task is autostarted upon a2dp audiopath connection */
+9 −3
Original line number Diff line number Diff line
@@ -1756,12 +1756,13 @@ bool BtifAvStateMachine::StateOpened::ProcessEvent(uint32_t event,

      // If remote tries to start A2DP when DUT is A2DP Source, then Suspend.
      // If A2DP is Sink and call is active, then disconnect the AVDTP channel.
      if (peer_.IsSink() && !peer_.CheckFlags(BtifAvPeer::kFlagPendingStart)) {
      bool should_suspend = false;
      if (peer_.IsSink() && !peer_.CheckFlags(BtifAvPeer::kFlagPendingStart |
                                              BtifAvPeer::kFlagRemoteSuspend)) {
        BTIF_TRACE_WARNING("%s: Peer %s : trigger Suspend as remote initiated",
                           __PRETTY_FUNCTION__,
                           peer_.PeerAddress().ToString().c_str());
        btif_av_source_dispatch_sm_event(peer_.PeerAddress(),
                                         BTIF_AV_SUSPEND_STREAM_REQ_EVT);
        should_suspend = true;
      }

      // If peer is A2DP Source, we do not want to ACK commands on UIPC
@@ -1786,6 +1787,11 @@ bool BtifAvStateMachine::StateOpened::ProcessEvent(uint32_t event,
        btif_a2dp_on_started(peer_.PeerAddress(), nullptr, true);
        // Pending start flag will be cleared when exit current state
      }

      if (should_suspend) {
        btif_av_source_dispatch_sm_event(peer_.PeerAddress(),
                                         BTIF_AV_SUSPEND_STREAM_REQ_EVT);
      }
      peer_.StateMachine().TransitionTo(BtifAvStateMachine::kStateStarted);

    } break;