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

Commit 57cd746c authored by Daniel Zheng's avatar Daniel Zheng
Browse files

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
parent 1be3989c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ class BootControlClientAidl final : public BootControlClient {
    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 @@ class BootControlClientAidl final : public BootControlClient {
  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();