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

Commit e472b962 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Merge "Adds support for the LeAudioSuspended param in the BT Audio HAL" am: 4ca4693e

parents 0ae6e0e0 4ca4693e
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -113,6 +113,8 @@ class BluetoothAudioPort {

  virtual bool IsA2dp() const { return false; }

  virtual bool IsLeAudio() const { return false; }

  virtual bool GetPreferredDataIntervalUs(size_t* interval_us) const {
    return false;
  };
@@ -165,6 +167,20 @@ class BluetoothAudioPortAidl : public BluetoothAudioPort {
               SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
  }

  bool IsLeAudio() const override {
    return session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
           session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH ||
           session_type_ ==
               SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
           session_type_ ==
               SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
           session_type_ ==
               SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH ||
           session_type_ ==
               SessionType::
                   LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
  }

  bool GetPreferredDataIntervalUs(size_t* interval_us) const override;

 protected:
+11 −0
Original line number Diff line number Diff line
@@ -69,6 +69,17 @@ class BluetoothAudioPortHidl : public BluetoothAudioPort {
               SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH;
  }

  bool IsLeAudio() const override {
    return session_type_hidl_ ==
               SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
           session_type_hidl_ ==
               SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH ||
           session_type_hidl_ ==
               SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
           session_type_hidl_ ==
               SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH;
  }

  bool GetPreferredDataIntervalUs(size_t* interval_us) const override;

 protected:
+25 −0
Original line number Diff line number Diff line
@@ -366,6 +366,31 @@ static int out_set_parameters(struct audio_stream* stream,
    }
  }

  if (params.find("LeAudioSuspended") != params.end() &&
      out->bluetooth_output_->IsLeAudio()) {
    LOG(INFO) << __func__ << ": LeAudioSuspended found LEAudio="
              << out->bluetooth_output_->IsLeAudio();
    if (params["LeAudioSuspended"] == "true") {
      LOG(INFO) << __func__ << ": LeAudioSuspended true, state="
                << out->bluetooth_output_->GetState()
                << " stream param standby";
      if (out->bluetooth_output_->GetState() == BluetoothStreamState::STARTED) {
        LOG(INFO) << __func__ << ": Stream is started, suspending LE Audio";
      } else if (out->bluetooth_output_->GetState() !=
                 BluetoothStreamState::DISABLED) {
        LOG(INFO) << __func__ << ": Stream is disabled, suspending LE Audio";
      }
    } else {
      LOG(INFO) << __func__ << ": LeAudioSuspended false, state="
                << out->bluetooth_output_->GetState()
                << " stream param standby";
      if (out->bluetooth_output_->GetState() ==
          BluetoothStreamState::DISABLED) {
        LOG(INFO) << __func__ << ": Stream is disabled, unsuspending LE Audio";
      }
    }
  }

  if (params.find("closing") != params.end()) {
    if (params["closing"] == "true") {
      LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()