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

Commit d9b00ae7 authored by Steven Moreland's avatar Steven Moreland
Browse files

PowerManagerService: use waitForService.

Instead of while(true) sleep1

Bug: N/A
Test: boot
Change-Id: I6f316fd1f9634b827f003998995e6358dde15a83
parent 3ffad04a
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -201,13 +201,8 @@ sp<ISystemSuspend> getSuspendHal() {
sp<ISuspendControlService> getSuspendControl() {
    static std::once_flag suspendControlFlag;
    std::call_once(suspendControlFlag, [](){
        while(gSuspendControl == nullptr) {
            sp<IBinder> control =
                    defaultServiceManager()->getService(String16("suspend_control"));
            if (control != nullptr) {
                gSuspendControl = interface_cast<ISuspendControlService>(control);
            }
        }
        gSuspendControl = waitForService<ISuspendControlService>(String16("suspend_control"));
        LOG_ALWAYS_FATAL_IF(gSuspendControl == nullptr);
    });
    return gSuspendControl;
}