summaryrefslogtreecommitdiff
path: root/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-04-07 20:07:08 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-07 20:07:08 +0000
commit31a6eb814ca9546c15f86c8de6f509f2381da7e9 (patch)
treec9d06fe18d3ed7c00e4d3da3b1fd94580ed16076 /bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
parente18c0f85fd9ed438033ed96cca9392f958807485 (diff)
parent6afd301d16d1f62840efa3a0909ece42d26d2134 (diff)
Merge "BtAudio: Prevent unlink dead binder" am: dc1a419baf am: 6afd301d16
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2046266 Change-Id: Ic24dfd49dffe5df40224510a446e54850cb5cffc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp')
-rw-r--r--bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
index 0dd814828c..2a88959af5 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
@@ -45,6 +45,7 @@ ndk::ScopedAStatus BluetoothAudioProvider::startSession(
latency_modes_ = latencyModes;
audio_config_ = std::make_unique<AudioConfiguration>(audio_config);
stack_iface_ = host_if;
+ is_binder_died = false;
AIBinder_linkToDeath(stack_iface_->asBinder().get(), death_recipient_.get(),
this);
@@ -59,8 +60,10 @@ ndk::ScopedAStatus BluetoothAudioProvider::endSession() {
if (stack_iface_ != nullptr) {
BluetoothAudioSessionReport::OnSessionEnded(session_type_);
- AIBinder_unlinkToDeath(stack_iface_->asBinder().get(),
- death_recipient_.get(), this);
+ if (!is_binder_died) {
+ AIBinder_unlinkToDeath(stack_iface_->asBinder().get(),
+ death_recipient_.get(), this);
+ }
} else {
LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
<< " has NO session";
@@ -147,6 +150,7 @@ void BluetoothAudioProvider::binderDiedCallbackAidl(void* ptr) {
LOG(ERROR) << __func__ << ": Null AudioProvider HAL died";
return;
}
+ provider->is_binder_died = true;
provider->endSession();
}