Merge "Revise the provider null checker times"
diff --git a/system/audio_hal_interface/client_interface.cc b/system/audio_hal_interface/client_interface.cc
index a743aa9..159c83f 100644
--- a/system/audio_hal_interface/client_interface.cc
+++ b/system/audio_hal_interface/client_interface.cc
@@ -922,11 +922,6 @@
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 @@
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::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 @@
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 @@
}
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__