Loading init/reboot.cpp +14 −16 Original line number Diff line number Diff line Loading @@ -347,14 +347,10 @@ void DoReboot(unsigned int cmd, const std::string& reason, const std::string& re Timer t; LOG(INFO) << "Reboot start, reason: " << reason << ", rebootTarget: " << rebootTarget; android::base::WriteStringToFile(StringPrintf("%s\n", reason.c_str()), LAST_REBOOT_REASON_FILE, S_IRUSR | S_IWUSR, AID_SYSTEM, AID_SYSTEM); property_set(LAST_REBOOT_REASON_PROPERTY, reason.c_str()); sync(); bool is_thermal_shutdown = false; if (cmd == ANDROID_RB_THERMOFF) { is_thermal_shutdown = true; runFsck = false; } bool is_thermal_shutdown = cmd == ANDROID_RB_THERMOFF; auto shutdown_timeout = 0ms; if (!SHUTDOWN_ZERO_TIMEOUT) { Loading Loading @@ -476,10 +472,15 @@ bool HandlePowerctlMessage(const std::string& command) { command_invalid = true; } else if (cmd_params[0] == "shutdown") { cmd = ANDROID_RB_POWEROFF; if (cmd_params.size() == 2 && cmd_params[1] == "userrequested") { if (cmd_params.size() == 2) { if (cmd_params[1] == "userrequested") { // The shutdown reason is PowerManager.SHUTDOWN_USER_REQUESTED. // Run fsck once the file system is remounted in read-only mode. run_fsck = true; } else if (cmd_params[1] == "thermal") { // run_fsck is false to avoid delay cmd = ANDROID_RB_THERMOFF; } } } else if (cmd_params[0] == "reboot") { cmd = ANDROID_RB_RESTART2; Loading @@ -495,14 +496,11 @@ bool HandlePowerctlMessage(const std::string& command) { << err; } } // If there is an additional bootloader parameter, pass it along if (cmd_params.size() == 3) { // If there is an additional parameter, pass it along if ((cmd_params.size() == 3) && cmd_params[2].size()) { reboot_target += "," + cmd_params[2]; } } } else if (command == "thermal-shutdown") { // no additional parameter allowed // run_fsck is false to avoid delay cmd = ANDROID_RB_THERMOFF; } else { command_invalid = true; } Loading init/reboot.h +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ void __attribute__((noreturn)) RebootSystem(unsigned int cmd, const std::string& /* Reboot / shutdown the system. * cmd ANDROID_RB_* as defined in android_reboot.h * reason Reason string like "reboot", "userrequested" * reason Reason string like "reboot", "shutdown,userrequested" * rebootTarget Reboot target string like "bootloader". Otherwise, it should be an * empty string. * runFsck Whether to run fsck after umount is done. Loading libcutils/android_reboot.c +2 −2 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ int android_reboot(int cmd, int flags __unused, const char* arg) { restart_cmd = "shutdown"; break; case ANDROID_RB_THERMOFF: restart_cmd = "thermal-shutdown"; restart_cmd = "shutdown,thermal"; break; } if (!restart_cmd) return -1; if (arg) { if (arg && arg[0]) { ret = asprintf(&prop_value, "%s,%s", restart_cmd, arg); } else { ret = asprintf(&prop_value, "%s", restart_cmd); Loading libcutils/include/cutils/android_reboot.h +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ __BEGIN_DECLS /* Properties */ #define ANDROID_RB_PROPERTY "sys.powerctl" /* Android reboot reason stored in this file */ #define LAST_REBOOT_REASON_FILE "/data/misc/reboot/last_reboot_reason" /* Android reboot reason stored in this property */ #define LAST_REBOOT_REASON_PROPERTY "persist.sys.boot.reason" /* Reboot or shutdown the system. * This call uses ANDROID_RB_PROPERTY to request reboot to init process. Loading rootdir/init.rc +0 −1 Original line number Diff line number Diff line Loading @@ -434,7 +434,6 @@ on post-fs-data mkdir /data/misc/boottrace 0771 system shell mkdir /data/misc/update_engine 0700 root root mkdir /data/misc/trace 0700 root root mkdir /data/misc/reboot 0700 system system # profile file layout mkdir /data/misc/profiles 0771 system system mkdir /data/misc/profiles/cur 0771 system system Loading Loading
init/reboot.cpp +14 −16 Original line number Diff line number Diff line Loading @@ -347,14 +347,10 @@ void DoReboot(unsigned int cmd, const std::string& reason, const std::string& re Timer t; LOG(INFO) << "Reboot start, reason: " << reason << ", rebootTarget: " << rebootTarget; android::base::WriteStringToFile(StringPrintf("%s\n", reason.c_str()), LAST_REBOOT_REASON_FILE, S_IRUSR | S_IWUSR, AID_SYSTEM, AID_SYSTEM); property_set(LAST_REBOOT_REASON_PROPERTY, reason.c_str()); sync(); bool is_thermal_shutdown = false; if (cmd == ANDROID_RB_THERMOFF) { is_thermal_shutdown = true; runFsck = false; } bool is_thermal_shutdown = cmd == ANDROID_RB_THERMOFF; auto shutdown_timeout = 0ms; if (!SHUTDOWN_ZERO_TIMEOUT) { Loading Loading @@ -476,10 +472,15 @@ bool HandlePowerctlMessage(const std::string& command) { command_invalid = true; } else if (cmd_params[0] == "shutdown") { cmd = ANDROID_RB_POWEROFF; if (cmd_params.size() == 2 && cmd_params[1] == "userrequested") { if (cmd_params.size() == 2) { if (cmd_params[1] == "userrequested") { // The shutdown reason is PowerManager.SHUTDOWN_USER_REQUESTED. // Run fsck once the file system is remounted in read-only mode. run_fsck = true; } else if (cmd_params[1] == "thermal") { // run_fsck is false to avoid delay cmd = ANDROID_RB_THERMOFF; } } } else if (cmd_params[0] == "reboot") { cmd = ANDROID_RB_RESTART2; Loading @@ -495,14 +496,11 @@ bool HandlePowerctlMessage(const std::string& command) { << err; } } // If there is an additional bootloader parameter, pass it along if (cmd_params.size() == 3) { // If there is an additional parameter, pass it along if ((cmd_params.size() == 3) && cmd_params[2].size()) { reboot_target += "," + cmd_params[2]; } } } else if (command == "thermal-shutdown") { // no additional parameter allowed // run_fsck is false to avoid delay cmd = ANDROID_RB_THERMOFF; } else { command_invalid = true; } Loading
init/reboot.h +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ void __attribute__((noreturn)) RebootSystem(unsigned int cmd, const std::string& /* Reboot / shutdown the system. * cmd ANDROID_RB_* as defined in android_reboot.h * reason Reason string like "reboot", "userrequested" * reason Reason string like "reboot", "shutdown,userrequested" * rebootTarget Reboot target string like "bootloader". Otherwise, it should be an * empty string. * runFsck Whether to run fsck after umount is done. Loading
libcutils/android_reboot.c +2 −2 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ int android_reboot(int cmd, int flags __unused, const char* arg) { restart_cmd = "shutdown"; break; case ANDROID_RB_THERMOFF: restart_cmd = "thermal-shutdown"; restart_cmd = "shutdown,thermal"; break; } if (!restart_cmd) return -1; if (arg) { if (arg && arg[0]) { ret = asprintf(&prop_value, "%s,%s", restart_cmd, arg); } else { ret = asprintf(&prop_value, "%s", restart_cmd); Loading
libcutils/include/cutils/android_reboot.h +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ __BEGIN_DECLS /* Properties */ #define ANDROID_RB_PROPERTY "sys.powerctl" /* Android reboot reason stored in this file */ #define LAST_REBOOT_REASON_FILE "/data/misc/reboot/last_reboot_reason" /* Android reboot reason stored in this property */ #define LAST_REBOOT_REASON_PROPERTY "persist.sys.boot.reason" /* Reboot or shutdown the system. * This call uses ANDROID_RB_PROPERTY to request reboot to init process. Loading
rootdir/init.rc +0 −1 Original line number Diff line number Diff line Loading @@ -434,7 +434,6 @@ on post-fs-data mkdir /data/misc/boottrace 0771 system shell mkdir /data/misc/update_engine 0700 root root mkdir /data/misc/trace 0700 root root mkdir /data/misc/reboot 0700 system system # profile file layout mkdir /data/misc/profiles 0771 system system mkdir /data/misc/profiles/cur 0771 system system Loading