aboutsummaryrefslogtreecommitdiffstats
path: root/recovery.c
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2011-01-25 13:15:30 -0800
committerDoug Zongker <dougz@android.com>2011-01-25 13:50:16 -0800
commit5cae445e43c5928daba0a76745b0dd2657274eda (patch)
tree2afc1e07d1dbd6e677af74419b31c321641b33aa /recovery.c
parent8f132ed870b4b83727d59f8019b8fabe49fe8ed4 (diff)
downloadbootable_recovery-5cae445e43c5928daba0a76745b0dd2657274eda.zip
bootable_recovery-5cae445e43c5928daba0a76745b0dd2657274eda.tar.gz
bootable_recovery-5cae445e43c5928daba0a76745b0dd2657274eda.tar.bz2
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
Diffstat (limited to 'recovery.c')
-rw-r--r--recovery.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/recovery.c b/recovery.c
index 9ad075d..c81a13c 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) {