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

Commit 9d2c1d84 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[DisplayService] Check hidl return value.

Handle the returned status from HIDL.

Test: manual
BUG: 72423188
Change-Id: I49010fbb56b149797430946054e93a00e2b3677c
parent c650f621
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -102,10 +102,20 @@ int DisplayEventReceiver::AttachedEvent::handleEvent(int fd, int events, void* /

            switch(buf[i].header.type) {
                case FwkReceiver::DISPLAY_EVENT_VSYNC: {
                    mCallback->onVsync(timestamp, event.vsync.count);
                    auto ret = mCallback->onVsync(timestamp, event.vsync.count);
                    if (!ret.isOk()) {
                        LOG(ERROR) << "AttachedEvent handleEvent fails on onVsync callback"
                                   << " because of " << ret.description();
                        return 0;  // remove the callback
                    }
                } break;
                case FwkReceiver::DISPLAY_EVENT_HOTPLUG: {
                    mCallback->onHotplug(timestamp, event.hotplug.connected);
                    auto ret = mCallback->onHotplug(timestamp, event.hotplug.connected);
                    if (!ret.isOk()) {
                        LOG(ERROR) << "AttachedEvent handleEvent fails on onHotplug callback"
                                   << " because of " << ret.description();
                        return 0;  // remove the callback
                    }
                } break;
                default: {
                    LOG(ERROR) << "AttachedEvent handleEvent unknown type: " << type;