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

Commit f1111e1b authored by shuide chen's avatar shuide chen
Browse files

Fix AIBinder_setMinSchedulerPolicy failed to set sched policy



b/318477176

the first param of:
AIBinder_setMinSchedulerPolicy(mAidlComposerCallback->asBinder().get(), SCHED_FIFO, 2);

constructs a temprary SpAIBinder object, it destructed after this function called.
and destroyed the `BBinder` object. got this log printted:
01-03 06:04:25.884  3774  3774 W surfaceflinger: Binder 0xf3b821dc destroyed after setMinSchedulerPolicy before being parceled.

This CL can fix this issue, and the scheduler works as expected.

Change-Id: I8fcfb0103d1faa773132d8ac4cba04428055fb85
Signed-off-by: default avatarshuide chen <shuide.chen@amlogic.com>
parent 325c1e10
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -325,7 +325,9 @@ void AidlComposer::registerCallback(HWC2::ComposerCallback& callback) {
    }

    mAidlComposerCallback = ndk::SharedRefBase::make<AidlIComposerCallbackWrapper>(callback);
    AIBinder_setMinSchedulerPolicy(mAidlComposerCallback->asBinder().get(), SCHED_FIFO, 2);

    ndk::SpAIBinder binder = mAidlComposerCallback->asBinder();
    AIBinder_setMinSchedulerPolicy(binder.get(), SCHED_FIFO, 2);

    const auto status = mAidlComposerClient->registerCallback(mAidlComposerCallback);
    if (!status.isOk()) {