From 752386319c0d9fb7e4e429a0644086b318d3b4b5 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 27 May 2015 14:46:17 -0700 Subject: [PATCH] Clean up the sleep()'s after poking init services Change-Id: I77564fe5c59e604f1377b278681b7d1bff53a77a --- recovery.cpp | 19 +++++++++++-------- ui.cpp | 2 +- uncrypt/uncrypt.cpp | 12 ++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/recovery.cpp b/recovery.cpp index 80a8c7ba..bfc68950 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -31,24 +31,24 @@ #include #include +#include #include #include +#include +#include +#include "adb_install.h" #include "bootloader.h" #include "common.h" -#include "cutils/properties.h" -#include "cutils/android_reboot.h" +#include "device.h" +#include "fuse_sdcard_provider.h" +#include "fuse_sideload.h" #include "install.h" #include "minui/minui.h" #include "minzip/DirUtil.h" #include "roots.h" #include "ui.h" #include "screen_ui.h" -#include "device.h" -#include "adb_install.h" -#include "adb.h" -#include "fuse_sideload.h" -#include "fuse_sdcard_provider.h" struct selabel_handle *sehandle; @@ -1119,6 +1119,9 @@ main(int argc, char **argv) { property_set(ANDROID_RB_PROPERTY, "reboot,"); break; } - sleep(5); // should reboot before this finishes + while (true) { + pause(); + } + // Should be unreachable. return EXIT_SUCCESS; } diff --git a/ui.cpp b/ui.cpp index d88cbfeb..2efb759d 100644 --- a/ui.cpp +++ b/ui.cpp @@ -176,7 +176,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) { case RecoveryUI::REBOOT: if (reboot_enabled) { property_set(ANDROID_RB_PROPERTY, "reboot,"); - while(1) { pause(); } + while (true) { pause(); } } break; diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp index 11766f14..d71271d8 100644 --- a/uncrypt/uncrypt.cpp +++ b/uncrypt/uncrypt.cpp @@ -40,18 +40,20 @@ // file data to use as an update package. #include +#include +#include +#include #include #include #include -#include #include #include -#include -#include #include +#include #define LOG_TAG "uncrypt" #include +#include #include #include @@ -376,7 +378,9 @@ static void wipe_misc() { static void reboot_to_recovery() { ALOGI("rebooting to recovery"); property_set("sys.powerctl", "reboot,recovery"); - sleep(10); + while (true) { + pause(); + } ALOGE("reboot didn't succeed?"); }