diff options
author | Eric Arseneau <earseneau@google.com> | 2019-12-16 12:42:40 -0800 |
---|---|---|
committer | Steven Laver <lavers@google.com> | 2019-12-17 16:06:42 -0800 |
commit | eae45d25367cd14cbe0b3ed92235b6f48c0afad5 (patch) | |
tree | a7b3b5463cd653676d9c7857842b2d55da4cb896 /init/reboot_utils.cpp | |
parent | 1a43c1292f22bb34a3741df64e292a5e3b331a2c (diff) | |
parent | f0db8d044bbd06e824450e6673bacd8131a3c1f8 (diff) |
Merge SPL-2019-12-05
Change-Id: I208823c4a4aa89ee4f3e9935762259184f9214a4
Diffstat (limited to 'init/reboot_utils.cpp')
-rw-r--r-- | init/reboot_utils.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/init/reboot_utils.cpp b/init/reboot_utils.cpp index d1a712f2e..de085cc9b 100644 --- a/init/reboot_utils.cpp +++ b/init/reboot_utils.cpp @@ -21,11 +21,12 @@ #include <string> -#include "android-base/file.h" -#include "android-base/logging.h" -#include "android-base/strings.h" -#include "backtrace/Backtrace.h" -#include "cutils/android_reboot.h" +#include <android-base/file.h> +#include <android-base/logging.h> +#include <android-base/properties.h> +#include <android-base/strings.h> +#include <backtrace/Backtrace.h> +#include <cutils/android_reboot.h> #include "capabilities.h" @@ -93,7 +94,14 @@ void __attribute__((noreturn)) RebootSystem(unsigned int cmd, const std::string& break; case ANDROID_RB_THERMOFF: - reboot(RB_POWER_OFF); + if (android::base::GetBoolProperty("ro.thermal_warmreset", false)) { + 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); + } else { + reboot(RB_POWER_OFF); + } break; } // In normal case, reboot should not return. |