Fix up tw_reboot function
Change-Id: I53d329e493f4bcb3fe9ed177e7b2dede30ccf490
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index b962457..a2970b0 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -50,6 +50,7 @@
#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
#include "openaes/inc/oaes_lib.h"
#endif
+#include "cutils/android_reboot.h"
extern "C" {
#include "libcrecovery/common.h"
@@ -524,10 +525,14 @@
return reboot(RB_AUTOBOOT);
case rb_recovery:
check_and_run_script("/sbin/rebootrecovery.sh", "reboot recovery");
- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "recovery");
+ property_set(ANDROID_RB_PROPERTY, "reboot,recovery");
+ sleep(5);
+ return 0;
case rb_bootloader:
check_and_run_script("/sbin/rebootbootloader.sh", "reboot bootloader");
- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "bootloader");
+ property_set(ANDROID_RB_PROPERTY, "reboot,bootloader");
+ sleep(5);
+ return 0;
case rb_poweroff:
check_and_run_script("/sbin/poweroff.sh", "power off");
#ifdef ANDROID_RB_POWEROFF
@@ -536,7 +541,9 @@
return reboot(RB_POWER_OFF);
case rb_download:
check_and_run_script("/sbin/rebootdownload.sh", "reboot download");
- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "download");
+ property_set(ANDROID_RB_PROPERTY, "reboot,download");
+ sleep(5);
+ return 0;
default:
return -1;
}