From 5cae445e43c5928daba0a76745b0dd2657274eda Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 25 Jan 2011 13:15:30 -0800 Subject: make recovery reboot after 2 minutes of no activity If recovery sits for 2 minutes in prompt_and_wait(), and you've never turned the screen on via the magic keypress, go ahead and reboot. (We used to assume that the user could pull the battery to get out of this state, but on devices with nonremovable batteries...) If you've ever enabled display of the log/menu since recovery started, we assume you know what you're doing and will stay in recovery until you choose to reboot. Bug: 3387873 Bug: 3387274 Change-Id: I041621e5db132df9a925e6808845a7c45e1b427a --- recovery.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'recovery.c') diff --git a/recovery.c b/recovery.c index 9ad075d74..c81a13c37 100644 --- a/recovery.c +++ b/recovery.c @@ -446,6 +446,16 @@ get_menu_selection(char** headers, char** items, int menu_only, int key = ui_wait_key(); int visible = ui_text_visible(); + if (key == -1) { // ui_wait_key() timed out + if (ui_text_ever_visible()) { + continue; + } else { + LOGI("timed out waiting for key input; rebooting.\n"); + ui_end_menu(); + return ITEM_REBOOT; + } + } + int action = device_handle_key(key, visible); if (action < 0) { -- cgit v1.2.3