diff --git a/services/core/jni/com_android_server_VibratorService.cpp b/services/core/jni/com_android_server_VibratorService.cpp index cb8416b36be5c..45e9cc785bf80 100644 --- a/services/core/jni/com_android_server_VibratorService.cpp +++ b/services/core/jni/com_android_server_VibratorService.cpp @@ -73,11 +73,13 @@ Return halCall(Return (I::* fn)(Args0...), Args1&&... args1) { ret = (sHal == nullptr) ? NullptrStatus() : (*sHal.*fn)(std::forward(args1)...); - if (!ret.isOk()) { - ALOGE("Failed to issue command to vibrator HAL. Retrying."); - // Restoring connection to the HAL. - sHal = I::tryGetService(); + if (ret.isOk()) { + break; } + + ALOGE("Failed to issue command to vibrator HAL. Retrying."); + // Restoring connection to the HAL. + sHal = I::tryGetService(); } return ret; }