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

Commit 80f2fd11 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:...

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

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2444540



Change-Id: Id53137d5dded256f77f36112f5ef8210237fea8c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4c62f9cb e472b962
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()