system/core
リビジョン | 961a88ab78ace6b5d76ef7ac1c22f92d3ab2f64d (tree) |
---|---|
日時 | 2019-12-17 14:24:56 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
コミッター | Chih-Wei Huang |
init: handle ctrl-alt-del event
By setting /proc/sys/kernel/ctrl-alt-del to 1, kernel will trap
ctrl-alt-del event and send a SIGINT signal to init.
Start the ctrl-alt-del service on receiving the signal.
@@ -29,6 +29,7 @@ | ||
29 | 29 | #include <cutils/android_reboot.h> |
30 | 30 | |
31 | 31 | #include "capabilities.h" |
32 | +#include "init.h" | |
32 | 33 | |
33 | 34 | namespace android { |
34 | 35 | namespace init { |
@@ -167,6 +168,12 @@ void InstallRebootSignalHandlers() { | ||
167 | 168 | #endif |
168 | 169 | sigaction(SIGSYS, &action, nullptr); |
169 | 170 | sigaction(SIGTRAP, &action, nullptr); |
171 | + | |
172 | + action.sa_handler = [](int sig) { | |
173 | + LOG(INFO) << "Got ctrl-alt-del: " << sig; | |
174 | + HandleControlMessage("start", "ctrl-alt-del", getpid()); | |
175 | + }; | |
176 | + sigaction(SIGINT, &action, nullptr); | |
170 | 177 | } |
171 | 178 | |
172 | 179 | } // namespace init |