bootctl: set on_unlinked
one call of setonunlinked is triggered for each call of linktodeath. To
suppress the warnings of not calling setonunlinked with a non-null
cookie, we should add this here. We don't actually want to do anything
with the cookie (the boot control client) that is passed to the death
recipient, since that is still alive.
test: th
Change-Id: I55d1df7e27bdb926923ef599e18fe79b5de49352
diff --git a/boot/aidl/client/BootControlClient.cpp b/boot/aidl/client/BootControlClient.cpp
index 5cca183..7aab5b4 100644
--- a/boot/aidl/client/BootControlClient.cpp
+++ b/boot/aidl/client/BootControlClient.cpp
@@ -80,6 +80,7 @@
explicit BootControlClientAidl(std::shared_ptr<IBootControl> module)
: module_(module),
boot_control_death_recipient(AIBinder_DeathRecipient_new(onBootControlServiceDied)) {
+ AIBinder_DeathRecipient_setOnUnlinked(boot_control_death_recipient, onCallbackUnlinked);
binder_status_t status =
AIBinder_linkToDeath(module->asBinder().get(), boot_control_death_recipient, this);
if (status != STATUS_OK) {
@@ -236,6 +237,11 @@
private:
std::shared_ptr<IBootControl> module_;
AIBinder_DeathRecipient* boot_control_death_recipient;
+ static void onCallbackUnlinked(void* /*client*/) {
+ // this is an empty function needed to suppress the "AIBinder_linkToDeath is being called
+ // with a non-null cookie and no onUnlink callback set. This might not be intended.
+ // AIBinder_DeathRecipient_setOnUnlinked should be called first." warning
+ }
static void onBootControlServiceDied(void* client) {
BootControlClientAidl* self = static_cast<BootControlClientAidl*>(client);
self->onBootControlServiceDied();