PowerManagerService: use waitForService.
Instead of while(true) sleep1 Bug: N/A Test: boot Change-Id: I6f316fd1f9634b827f003998995e6358dde15a83
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user