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

Commit 50a12c60 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revise the provider null checker times" am: 6601d3f7 am: 4a8a90d7

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

Change-Id: I9241cc8ada8ecfb51c8d27a9cf6793eda1eeeb1a
parents f57129a8 4a8a90d7
Loading
Loading
Loading
Loading
+21 −23
Original line number Diff line number Diff line
@@ -922,11 +922,6 @@ int BluetoothAudioClientInterface::StartSession_2_2() {

void BluetoothAudioClientInterface::StreamStarted(
    const BluetoothAudioCtrlAck& ack) {
  if (provider_ == nullptr && provider_2_1_ == nullptr &&
      provider_2_2_ == nullptr) {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
    return;
  }
  if (ack == BluetoothAudioCtrlAck::PENDING) {
    LOG(INFO) << __func__ << ": " << ack << " ignored";
    return;
@@ -934,12 +929,16 @@ void BluetoothAudioClientInterface::StreamStarted(
  BluetoothAudioStatus status = BluetoothAudioCtrlAckToHalStatus(ack);

  ::android::hardware::Return<void> hidl_retval;
  if (provider_2_2_ != nullptr)
  if (provider_2_2_ != nullptr) {
    hidl_retval = provider_2_2_->streamStarted(status);
  else if (provider_2_1_ != nullptr)
  } else if (provider_2_1_ != nullptr) {
    hidl_retval = provider_2_1_->streamStarted(status);
  else
  } else if (provider_ != nullptr) {
    hidl_retval = provider_->streamStarted(status);
  } else {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
    return;
  }

  if (!hidl_retval.isOk()) {
    LOG(ERROR) << __func__
@@ -949,10 +948,6 @@ void BluetoothAudioClientInterface::StreamStarted(

void BluetoothAudioClientInterface::StreamSuspended(
    const BluetoothAudioCtrlAck& ack) {
  if (provider_ == nullptr) {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
    return;
  }
  if (ack == BluetoothAudioCtrlAck::PENDING) {
    LOG(INFO) << __func__ << ": " << ack << " ignored";
    return;
@@ -960,12 +955,16 @@ void BluetoothAudioClientInterface::StreamSuspended(
  BluetoothAudioStatus status = BluetoothAudioCtrlAckToHalStatus(ack);

  ::android::hardware::Return<void> hidl_retval;
  if (provider_2_2_ != nullptr)
  if (provider_2_2_ != nullptr) {
    hidl_retval = provider_2_2_->streamSuspended(status);
  else if (provider_2_1_ != nullptr)
  } else if (provider_2_1_ != nullptr) {
    hidl_retval = provider_2_1_->streamSuspended(status);
  else
  } else if (provider_ != nullptr) {
    hidl_retval = provider_->streamSuspended(status);
  } else {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
    return;
  }

  if (!hidl_retval.isOk()) {
    LOG(ERROR) << __func__
@@ -981,20 +980,19 @@ int BluetoothAudioClientInterface::EndSession() {
  }

  session_started_ = false;
  if (provider_2_2_ == nullptr && provider_2_1_ == nullptr &&
      provider_ == nullptr) {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
    return -EINVAL;
  }
  mDataMQ = nullptr;

  ::android::hardware::Return<void> hidl_retval;
  if (provider_2_2_ != nullptr)
  if (provider_2_2_ != nullptr) {
    hidl_retval = provider_2_2_->endSession();
  else if (provider_2_1_ != nullptr)
  } else if (provider_2_1_ != nullptr) {
    hidl_retval = provider_2_1_->endSession();
  else
  } else if (provider_ != nullptr) {
    hidl_retval = provider_->endSession();
  } else {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
    return -EINVAL;
  }

  if (!hidl_retval.isOk()) {
    LOG(ERROR) << __func__