diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-02-22 18:42:40 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-02-22 18:42:40 +0000 |
commit | 577ba9df7df91f1ebcfbac39dfb0783d041a925a (patch) | |
tree | 5a3f309960435e35391a9282bc18df3fbf6e10bc /init/reboot_utils.cpp | |
parent | 450e725969efff06a6067536770ca0e0aac2ba4f (diff) | |
parent | 90959cbc20e9a6ba27c06c335e5f18f1c1e6a08f (diff) |
Snap for 9635940 from 90959cbc20e9a6ba27c06c335e5f18f1c1e6a08f to tm-platform-release
Change-Id: I324cf3f190e31f1602073b538f96cf3963d814fd
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); } |