diff options
author | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
commit | a7dd355e8fe8ad0c579a4f0acd06b2e3b52dfc3a (patch) | |
tree | 2b552b59793a33466247fc6fb8cf89ecbfdc4a05 /init/reboot_utils.cpp | |
parent | f0103ea35d56ccebbae16a43cac19ac38b11a9a2 (diff) | |
parent | 43816573a268998f892081eebf3ffe91d65b7e18 (diff) |
Merge tag 'LA.QSSI.13.0.r1-09800-qssi.0' into tachibanatachibana
"LA.QSSI.13.0.r1-09800-qssi.0"
Change-Id: I06ecf682f4d5595bce3383b6031506cc56bc0db2
Diffstat (limited to 'init/reboot_utils.cpp')
-rw-r--r-- | init/reboot_utils.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/init/reboot_utils.cpp b/init/reboot_utils.cpp index b3fa9fd3b..1f411636c 100644 --- a/init/reboot_utils.cpp +++ b/init/reboot_utils.cpp @@ -106,7 +106,8 @@ bool IsRebootCapable() { return value == CAP_SET; } -void __attribute__((noreturn)) RebootSystem(unsigned int cmd, const std::string& rebootTarget) { +void __attribute__((noreturn)) +RebootSystem(unsigned int cmd, const std::string& rebootTarget, const std::string& reboot_reason) { LOG(INFO) << "Reboot ending, jumping to kernel"; if (!IsRebootCapable()) { @@ -127,10 +128,12 @@ void __attribute__((noreturn)) RebootSystem(unsigned int cmd, const std::string& case ANDROID_RB_THERMOFF: if (android::base::GetBoolProperty("ro.thermal_warmreset", false)) { + std::string reason = "shutdown,thermal"; + if (!reboot_reason.empty()) reason = reboot_reason; + LOG(INFO) << "Try to trigger a warm reset for thermal shutdown"; - static constexpr const char kThermalShutdownTarget[] = "shutdown,thermal"; syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, - LINUX_REBOOT_CMD_RESTART2, kThermalShutdownTarget); + LINUX_REBOOT_CMD_RESTART2, reason.c_str()); } else { reboot(RB_POWER_OFF); } |