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

Commit 50c3d701 authored by Devin Moore's avatar Devin Moore
Browse files

Log when AIBinder_linkToDeath is called before AIBinder_DeathRecipient_setOnUnlink

It is recommended to first call AIBinder_DeathRecipient_setOnUnlink
before AIBinder_linkToDeath if a cookie object is used.

Ignore-AOSP-First: b/334118276

Test: launch_cvd and look for log
Bug: 334118276
Change-Id: I824b601909b01825eacf26c2ff3a9033031ed535
parent f93b3102
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -487,6 +487,11 @@ binder_status_t AIBinder_DeathRecipient::linkToDeath(const sp<IBinder>& binder,
              "This will cause the onUnlinked callback to be called multiple times with the same "
              "cookie, which is usually not intended.");
    }
    if (!mOnUnlinked && cookie) {
        ALOGW("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.");
    }

    sp<TransferDeathRecipient> recipient =
            new TransferDeathRecipient(binder, cookie, this, mOnDied, mOnUnlinked);