No need to abort the audio HAL / Bluetooth when failed to suspend
When the headset was disconnecting, the audio HAL may not be able to
suspend the stream successfully, and it is no need to abort the process
for such acceptable failure. This change also adds extra log messages
about HIDL status.
Bug: 127654107
Test: Play / pause music via the Bluetooth manually
Change-Id: I335fcf75708343c7971ebd97514fea5db50f17a0
diff --git a/audio_hal_interface/client_interface.cc b/audio_hal_interface/client_interface.cc
index cc1c96e..e83ae84 100644
--- a/audio_hal_interface/client_interface.cc
+++ b/audio_hal_interface/client_interface.cc
@@ -75,7 +75,7 @@
auto hidl_retval =
provider_->streamStarted(BluetoothAudioCtrlAckToHalStatus(ack));
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal Failure";
+ LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description();
}
}
return Void();
@@ -87,7 +87,7 @@
auto hidl_retval =
provider_->streamSuspended(BluetoothAudioCtrlAckToHalStatus(ack));
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal Failure";
+ LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description();
}
}
return Void();
@@ -200,7 +200,7 @@
if (provider_ != nullptr) {
auto hidl_retval = provider_->unlinkToDeath(death_recipient_);
if (!hidl_retval.isOk()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioDeathRecipient Failure";
+ LOG(FATAL) << __func__ << ": BluetoothAudioDeathRecipient failure: " << hidl_retval.description();
}
}
}
@@ -237,10 +237,10 @@
sink_->GetSessionType(), getProviderCapabilities_cb);
getProviderCapabilities_future.get();
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__
- << ": BluetoothAudioHal::getProviderCapabilities Failure";
+ LOG(FATAL) << __func__ << ": BluetoothAudioHal::getProviderCapabilities failure: " << hidl_retval.description();
return;
- } else if (capabilities_.empty()) {
+ }
+ if (capabilities_.empty()) {
LOG(WARNING) << __func__
<< ": SessionType=" << toString(sink_->GetSessionType())
<< " Not supported by BluetoothAudioHal";
@@ -267,12 +267,12 @@
providersFactory->openProvider(sink_->GetSessionType(), openProvider_cb);
openProvider_future.get();
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal::openProvider Failure";
+ LOG(FATAL) << __func__ << ": BluetoothAudioHal::openProvider failure: " << hidl_retval.description();
}
CHECK(provider_ != nullptr);
if (!provider_->linkToDeath(death_recipient_, 0).isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioDeathRecipient Failure";
+ LOG(FATAL) << __func__ << ": BluetoothAudioDeathRecipient failure: " << hidl_retval.description();
}
LOG(INFO) << "IBluetoothAudioProvidersFactory::openProvider() returned "
@@ -338,7 +338,7 @@
stack_if, sink_->GetAudioConfiguration(), hidl_cb);
hidl_startSession_future.get();
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal Failure";
+ LOG(FATAL) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description();
return -EPROTO;
}
@@ -368,14 +368,15 @@
if (provider_ == nullptr) {
LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
return;
- } else if (ack == BluetoothAudioCtrlAck::PENDING) {
+ }
+ if (ack == BluetoothAudioCtrlAck::PENDING) {
LOG(INFO) << __func__ << ": " << ack << " ignored";
return;
}
BluetoothAudioStatus status = BluetoothAudioCtrlAckToHalStatus(ack);
auto hidl_retval = provider_->streamStarted(status);
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal Failure";
+ LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description();
}
}
@@ -384,14 +385,15 @@
if (provider_ == nullptr) {
LOG(ERROR) << __func__ << ": BluetoothAudioHal nullptr";
return;
- } else if (ack == BluetoothAudioCtrlAck::PENDING) {
+ }
+ if (ack == BluetoothAudioCtrlAck::PENDING) {
LOG(INFO) << __func__ << ": " << ack << " ignored";
return;
}
BluetoothAudioStatus status = BluetoothAudioCtrlAckToHalStatus(ack);
auto hidl_retval = provider_->streamSuspended(status);
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal Failure";
+ LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description();
}
}
@@ -410,7 +412,7 @@
mDataMQ = nullptr;
auto hidl_retval = provider_->endSession();
if (!hidl_retval.isOk()) {
- LOG(FATAL) << __func__ << ": BluetoothAudioHal Failure";
+ LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " << hidl_retval.description();
return -EPROTO;
}
return 0;