diff options
| author | 2019-08-27 18:20:05 -0700 | |
|---|---|---|
| committer | 2019-08-29 13:53:48 -0700 | |
| commit | d9b00ae794271c8d4b36b51ebbdec798887a2fbd (patch) | |
| tree | 854610aedbeec2a63a92c0c76c358bf44204d0e0 | |
| parent | 3ffad04adda722fc7784e689f4b0e961fb4b85a3 (diff) | |
PowerManagerService: use waitForService.
Instead of while(true) sleep1
Bug: N/A
Test: boot
Change-Id: I6f316fd1f9634b827f003998995e6358dde15a83
| -rw-r--r-- | services/core/jni/com_android_server_power_PowerManagerService.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp index 73bb579bd274..4e0434873944 100644 --- a/services/core/jni/com_android_server_power_PowerManagerService.cpp +++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp @@ -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; } |