From 92c343fc4018ef94050ce7093a9e14efea97a3dc Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 31 Jan 2017 14:15:20 -0800 Subject: [PATCH] powerctl: add thermal-shutdown command Add sys.powerctl property interface for initiating thermal shutdown. Bug: 30994946 Test: Manual: setprop sys.powerctl thermal-shutdown Change-Id: Iffce60bd3cb4b40a5859623d10b91bee5101f168 --- init/builtins.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/builtins.cpp b/init/builtins.cpp index 1186e9db9..3036ec23b 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -700,6 +700,9 @@ static int do_powerctl(const std::vector& args) { } else if (strncmp(command, "reboot", 6) == 0) { cmd = ANDROID_RB_RESTART2; len = 6; + } else if (strncmp(command, "thermal-shutdown", 16) == 0) { + cmd = ANDROID_RB_THERMOFF; + len = 16; } else { LOG(ERROR) << "powerctl: unrecognized command '" << command << "'"; return -EINVAL;