summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-11-07 00:01:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-11-07 00:01:24 +0000
commitb94cc009432f0b1c0e7b18ce3812580a56ff8d0f (patch)
tree37efdc7e0a7a4f8b4bf7e8669ff468c0fe360895
parentafb3a15f39e73978c071a58d3466993293c6d3b1 (diff)
parent98a6ae31e5de97b38d9cd68ab4c9fda01f12b710 (diff)
downloadcore-b94cc009432f0b1c0e7b18ce3812580a56ff8d0f.tar.gz
Merge "init: increase thermal shutdown timeout to 3s" into pi-dev
-rw-r--r--init/reboot.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 328164f78..503afdd47 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -350,15 +350,14 @@ void DoReboot(unsigned int cmd, const std::string& reason, const std::string& re
auto shutdown_timeout = 0ms;
if (!SHUTDOWN_ZERO_TIMEOUT) {
- if (is_thermal_shutdown) {
- constexpr unsigned int thermal_shutdown_timeout = 1;
- shutdown_timeout = std::chrono::seconds(thermal_shutdown_timeout);
- } else {
- constexpr unsigned int shutdown_timeout_default = 6;
- auto shutdown_timeout_property = android::base::GetUintProperty(
- "ro.build.shutdown_timeout", shutdown_timeout_default);
- shutdown_timeout = std::chrono::seconds(shutdown_timeout_property);
+ constexpr unsigned int shutdown_timeout_default = 6;
+ constexpr unsigned int max_thermal_shutdown_timeout = 3;
+ auto shutdown_timeout_final =
+ android::base::GetUintProperty("ro.build.shutdown_timeout", shutdown_timeout_default);
+ if (is_thermal_shutdown && shutdown_timeout_final > max_thermal_shutdown_timeout) {
+ shutdown_timeout_final = max_thermal_shutdown_timeout;
}
+ shutdown_timeout = std::chrono::seconds(shutdown_timeout_final);
}
LOG(INFO) << "Shutdown timeout: " << shutdown_timeout.count() << " ms";