Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <errno.h> |
| 18 | #include <fcntl.h> |
| 19 | #include <linux/input.h> |
| 20 | #include <pthread.h> |
| 21 | #include <stdarg.h> |
| 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> |
| 24 | #include <string.h> |
| 25 | #include <sys/stat.h> |
| 26 | #include <sys/time.h> |
| 27 | #include <sys/types.h> |
| 28 | #include <time.h> |
| 29 | #include <unistd.h> |
| 30 | |
Dees_Troy | 38bd760 | 2012-09-14 13:33:53 -0400 | [diff] [blame] | 31 | #ifdef ANDROID_RB_RESTART |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 32 | #include <cutils/android_reboot.h> |
Dees_Troy | 38bd760 | 2012-09-14 13:33:53 -0400 | [diff] [blame] | 33 | #endif |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 34 | |
| 35 | #include "common.h" |
Doug Zongker | 9e805d6 | 2013-09-04 13:44:38 -0700 | [diff] [blame] | 36 | #include "roots.h" |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 37 | #include "device.h" |
| 38 | #include "minui/minui.h" |
| 39 | #include "screen_ui.h" |
| 40 | #include "ui.h" |
| 41 | |
| 42 | #define UI_WAIT_KEY_TIMEOUT_SEC 120 |
| 43 | |
Elliott Hughes | ec28340 | 2015-04-10 10:01:53 -0700 | [diff] [blame] | 44 | RecoveryUI::RecoveryUI() |
| 45 | : key_queue_len(0), |
| 46 | key_last_down(-1), |
| 47 | key_long_press(false), |
| 48 | key_down_count(0), |
| 49 | enable_reboot(true), |
| 50 | consecutive_power_keys(0), |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 51 | last_key(-1), |
| 52 | has_power_key(false), |
| 53 | has_up_key(false), |
| 54 | has_down_key(false) { |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 55 | pthread_mutex_init(&key_queue_mutex, nullptr); |
| 56 | pthread_cond_init(&key_queue_cond, nullptr); |
Mihai Serban | 187d626 | 2014-06-06 15:23:20 +0300 | [diff] [blame] | 57 | memset(key_pressed, 0, sizeof(key_pressed)); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 60 | void RecoveryUI::OnKeyDetected(int key_code) { |
| 61 | if (key_code == KEY_POWER) { |
| 62 | has_power_key = true; |
| 63 | } else if (key_code == KEY_DOWN || key_code == KEY_VOLUMEDOWN) { |
| 64 | has_down_key = true; |
| 65 | } else if (key_code == KEY_UP || key_code == KEY_VOLUMEUP) { |
| 66 | has_up_key = true; |
| 67 | } |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 68 | } |
| 69 | |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 70 | int RecoveryUI::InputCallback(int fd, uint32_t epevents, void* data) { |
| 71 | return reinterpret_cast<RecoveryUI*>(data)->OnInputEvent(fd, epevents); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 72 | } |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 73 | |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 74 | // Reads input events, handles special hot keys, and adds to the key queue. |
| 75 | static void* InputThreadLoop(void*) { |
| 76 | while (true) { |
| 77 | if (!ev_wait(-1)) { |
| 78 | ev_dispatch(); |
| 79 | } |
| 80 | } |
| 81 | return nullptr; |
| 82 | } |
| 83 | |
| 84 | void RecoveryUI::Init() { |
| 85 | ev_init(InputCallback, this); |
| 86 | |
| 87 | ev_iterate_available_keys(std::bind(&RecoveryUI::OnKeyDetected, this, std::placeholders::_1)); |
| 88 | |
| 89 | pthread_create(&input_thread_, nullptr, InputThreadLoop, nullptr); |
| 90 | } |
| 91 | |
| 92 | int RecoveryUI::OnInputEvent(int fd, uint32_t epevents) { |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 93 | struct input_event ev; |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 94 | if (ev_get_input(fd, epevents, &ev) == -1) { |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 95 | return -1; |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 96 | } |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 97 | |
| 98 | if (ev.type == EV_SYN) { |
| 99 | return 0; |
| 100 | } else if (ev.type == EV_REL) { |
| 101 | if (ev.code == REL_Y) { |
| 102 | // accumulate the up or down motion reported by |
| 103 | // the trackball. When it exceeds a threshold |
| 104 | // (positive or negative), fake an up/down |
| 105 | // key event. |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 106 | rel_sum += ev.value; |
| 107 | if (rel_sum > 3) { |
| 108 | ProcessKey(KEY_DOWN, 1); // press down key |
| 109 | ProcessKey(KEY_DOWN, 0); // and release it |
| 110 | rel_sum = 0; |
| 111 | } else if (rel_sum < -3) { |
| 112 | ProcessKey(KEY_UP, 1); // press up key |
| 113 | ProcessKey(KEY_UP, 0); // and release it |
| 114 | rel_sum = 0; |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 115 | } |
| 116 | } |
| 117 | } else { |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 118 | rel_sum = 0; |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 119 | } |
| 120 | |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 121 | if (ev.type == EV_KEY && ev.code <= KEY_MAX) { |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 122 | ProcessKey(ev.code, ev.value); |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 123 | } |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 124 | |
| 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | // Process a key-up or -down event. A key is "registered" when it is |
| 129 | // pressed and then released, with no other keypresses or releases in |
| 130 | // between. Registered keys are passed to CheckKey() to see if it |
| 131 | // should trigger a visibility toggle, an immediate reboot, or be |
| 132 | // queued to be processed next time the foreground thread wants a key |
| 133 | // (eg, for the menu). |
| 134 | // |
| 135 | // We also keep track of which keys are currently down so that |
| 136 | // CheckKey can call IsKeyPressed to see what other keys are held when |
| 137 | // a key is registered. |
| 138 | // |
| 139 | // updown == 1 for key down events; 0 for key up events |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 140 | void RecoveryUI::ProcessKey(int key_code, int updown) { |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 141 | bool register_key = false; |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 142 | bool long_press = false; |
Doug Zongker | c704e06 | 2014-05-23 08:40:35 -0700 | [diff] [blame] | 143 | bool reboot_enabled; |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 144 | |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 145 | pthread_mutex_lock(&key_queue_mutex); |
| 146 | key_pressed[key_code] = updown; |
| 147 | if (updown) { |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 148 | ++key_down_count; |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 149 | key_last_down = key_code; |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 150 | key_long_press = false; |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 151 | key_timer_t* info = new key_timer_t; |
| 152 | info->ui = this; |
| 153 | info->key_code = key_code; |
| 154 | info->count = key_down_count; |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 155 | pthread_t thread; |
| 156 | pthread_create(&thread, nullptr, &RecoveryUI::time_key_helper, info); |
| 157 | pthread_detach(thread); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 158 | } else { |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 159 | if (key_last_down == key_code) { |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 160 | long_press = key_long_press; |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 161 | register_key = true; |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 162 | } |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 163 | key_last_down = -1; |
| 164 | } |
Doug Zongker | c704e06 | 2014-05-23 08:40:35 -0700 | [diff] [blame] | 165 | reboot_enabled = enable_reboot; |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 166 | pthread_mutex_unlock(&key_queue_mutex); |
| 167 | |
| 168 | if (register_key) { |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 169 | switch (CheckKey(key_code, long_press)) { |
Doug Zongker | 48b5b07 | 2012-01-18 13:46:26 -0800 | [diff] [blame] | 170 | case RecoveryUI::IGNORE: |
| 171 | break; |
| 172 | |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 173 | case RecoveryUI::TOGGLE: |
| 174 | ShowText(!IsTextVisible()); |
| 175 | break; |
| 176 | |
| 177 | case RecoveryUI::REBOOT: |
Dees_Troy | 38bd760 | 2012-09-14 13:33:53 -0400 | [diff] [blame] | 178 | #ifdef ANDROID_RB_RESTART |
Doug Zongker | c704e06 | 2014-05-23 08:40:35 -0700 | [diff] [blame] | 179 | if (reboot_enabled) { |
| 180 | android_reboot(ANDROID_RB_RESTART, 0, 0); |
| 181 | } |
Dees_Troy | 38bd760 | 2012-09-14 13:33:53 -0400 | [diff] [blame] | 182 | #endif |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 183 | break; |
| 184 | |
| 185 | case RecoveryUI::ENQUEUE: |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 186 | EnqueueKey(key_code); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 187 | break; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 192 | void* RecoveryUI::time_key_helper(void* cookie) { |
| 193 | key_timer_t* info = (key_timer_t*) cookie; |
| 194 | info->ui->time_key(info->key_code, info->count); |
| 195 | delete info; |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 196 | return nullptr; |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | void RecoveryUI::time_key(int key_code, int count) { |
| 200 | usleep(750000); // 750 ms == "long" |
| 201 | bool long_press = false; |
| 202 | pthread_mutex_lock(&key_queue_mutex); |
| 203 | if (key_last_down == key_code && key_down_count == count) { |
| 204 | long_press = key_long_press = true; |
| 205 | } |
| 206 | pthread_mutex_unlock(&key_queue_mutex); |
| 207 | if (long_press) KeyLongPress(key_code); |
| 208 | } |
| 209 | |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 210 | void RecoveryUI::EnqueueKey(int key_code) { |
| 211 | pthread_mutex_lock(&key_queue_mutex); |
| 212 | const int queue_max = sizeof(key_queue) / sizeof(key_queue[0]); |
| 213 | if (key_queue_len < queue_max) { |
| 214 | key_queue[key_queue_len++] = key_code; |
| 215 | pthread_cond_signal(&key_queue_cond); |
| 216 | } |
| 217 | pthread_mutex_unlock(&key_queue_mutex); |
| 218 | } |
| 219 | |
Elliott Hughes | ec28340 | 2015-04-10 10:01:53 -0700 | [diff] [blame] | 220 | int RecoveryUI::WaitKey() { |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 221 | pthread_mutex_lock(&key_queue_mutex); |
| 222 | |
| 223 | // Time out after UI_WAIT_KEY_TIMEOUT_SEC, unless a USB cable is |
| 224 | // plugged in. |
| 225 | do { |
| 226 | struct timeval now; |
| 227 | struct timespec timeout; |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 228 | gettimeofday(&now, nullptr); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 229 | timeout.tv_sec = now.tv_sec; |
| 230 | timeout.tv_nsec = now.tv_usec * 1000; |
| 231 | timeout.tv_sec += UI_WAIT_KEY_TIMEOUT_SEC; |
| 232 | |
| 233 | int rc = 0; |
| 234 | while (key_queue_len == 0 && rc != ETIMEDOUT) { |
Elliott Hughes | ec28340 | 2015-04-10 10:01:53 -0700 | [diff] [blame] | 235 | rc = pthread_cond_timedwait(&key_queue_cond, &key_queue_mutex, &timeout); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 236 | } |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 237 | } while (IsUsbConnected() && key_queue_len == 0); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 238 | |
| 239 | int key = -1; |
| 240 | if (key_queue_len > 0) { |
| 241 | key = key_queue[0]; |
| 242 | memcpy(&key_queue[0], &key_queue[1], sizeof(int) * --key_queue_len); |
| 243 | } |
| 244 | pthread_mutex_unlock(&key_queue_mutex); |
| 245 | return key; |
| 246 | } |
| 247 | |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 248 | bool RecoveryUI::IsUsbConnected() { |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 249 | int fd = open("/sys/class/android_usb/android0/state", O_RDONLY); |
| 250 | if (fd < 0) { |
| 251 | printf("failed to open /sys/class/android_usb/android0/state: %s\n", |
| 252 | strerror(errno)); |
| 253 | return 0; |
| 254 | } |
| 255 | |
| 256 | char buf; |
Elliott Hughes | 985022a | 2015-04-13 13:04:32 -0700 | [diff] [blame] | 257 | // USB is connected if android_usb state is CONNECTED or CONFIGURED. |
Elliott Hughes | 2f5feed | 2015-04-28 17:24:24 -0700 | [diff] [blame] | 258 | int connected = (TEMP_FAILURE_RETRY(read(fd, &buf, 1)) == 1) && (buf == 'C'); |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 259 | if (close(fd) < 0) { |
| 260 | printf("failed to close /sys/class/android_usb/android0/state: %s\n", |
| 261 | strerror(errno)); |
| 262 | } |
| 263 | return connected; |
| 264 | } |
| 265 | |
Elliott Hughes | ec28340 | 2015-04-10 10:01:53 -0700 | [diff] [blame] | 266 | bool RecoveryUI::IsKeyPressed(int key) { |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 267 | pthread_mutex_lock(&key_queue_mutex); |
| 268 | int pressed = key_pressed[key]; |
| 269 | pthread_mutex_unlock(&key_queue_mutex); |
| 270 | return pressed; |
| 271 | } |
| 272 | |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 273 | bool RecoveryUI::IsLongPress() { |
| 274 | pthread_mutex_lock(&key_queue_mutex); |
| 275 | bool result = key_long_press; |
| 276 | pthread_mutex_unlock(&key_queue_mutex); |
| 277 | return result; |
| 278 | } |
| 279 | |
Elliott Hughes | 4af215b | 2015-04-10 15:00:34 -0700 | [diff] [blame] | 280 | bool RecoveryUI::HasThreeButtons() { |
| 281 | return has_power_key && has_up_key && has_down_key; |
| 282 | } |
| 283 | |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 284 | void RecoveryUI::FlushKeys() { |
| 285 | pthread_mutex_lock(&key_queue_mutex); |
| 286 | key_queue_len = 0; |
| 287 | pthread_mutex_unlock(&key_queue_mutex); |
| 288 | } |
| 289 | |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 290 | RecoveryUI::KeyAction RecoveryUI::CheckKey(int key, bool is_long_press) { |
| 291 | pthread_mutex_lock(&key_queue_mutex); |
| 292 | key_long_press = false; |
| 293 | pthread_mutex_unlock(&key_queue_mutex); |
| 294 | |
| 295 | // If we have power and volume up keys, that chord is the signal to toggle the text display. |
Elliott Hughes | 4af215b | 2015-04-10 15:00:34 -0700 | [diff] [blame] | 296 | if (HasThreeButtons()) { |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 297 | if (key == KEY_VOLUMEUP && IsKeyPressed(KEY_POWER)) { |
| 298 | return TOGGLE; |
| 299 | } |
| 300 | } else { |
| 301 | // Otherwise long press of any button toggles to the text display, |
| 302 | // and there's no way to toggle back (but that's pretty useless anyway). |
| 303 | if (is_long_press && !IsTextVisible()) { |
| 304 | return TOGGLE; |
| 305 | } |
| 306 | |
| 307 | // Also, for button-limited devices, a long press is translated to KEY_ENTER. |
| 308 | if (is_long_press && IsTextVisible()) { |
| 309 | EnqueueKey(KEY_ENTER); |
| 310 | return IGNORE; |
| 311 | } |
Doug Zongker | 9e805d6 | 2013-09-04 13:44:38 -0700 | [diff] [blame] | 312 | } |
| 313 | |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 314 | // Press power seven times in a row to reboot. |
Doug Zongker | 9e805d6 | 2013-09-04 13:44:38 -0700 | [diff] [blame] | 315 | if (key == KEY_POWER) { |
Doug Zongker | c704e06 | 2014-05-23 08:40:35 -0700 | [diff] [blame] | 316 | pthread_mutex_lock(&key_queue_mutex); |
| 317 | bool reboot_enabled = enable_reboot; |
| 318 | pthread_mutex_unlock(&key_queue_mutex); |
| 319 | |
| 320 | if (reboot_enabled) { |
| 321 | ++consecutive_power_keys; |
| 322 | if (consecutive_power_keys >= 7) { |
| 323 | return REBOOT; |
| 324 | } |
Doug Zongker | 9e805d6 | 2013-09-04 13:44:38 -0700 | [diff] [blame] | 325 | } |
| 326 | } else { |
| 327 | consecutive_power_keys = 0; |
| 328 | } |
| 329 | |
Doug Zongker | 9e805d6 | 2013-09-04 13:44:38 -0700 | [diff] [blame] | 330 | last_key = key; |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 331 | return IsTextVisible() ? ENQUEUE : IGNORE; |
Doug Zongker | 32a0a47 | 2011-11-01 11:00:20 -0700 | [diff] [blame] | 332 | } |
Doug Zongker | bb01d0c | 2012-12-17 10:52:58 -0800 | [diff] [blame] | 333 | |
Elliott Hughes | 642aaa7 | 2015-04-10 12:47:46 -0700 | [diff] [blame] | 334 | void RecoveryUI::KeyLongPress(int) { |
Doug Zongker | c0441d1 | 2013-07-31 11:28:24 -0700 | [diff] [blame] | 335 | } |
Doug Zongker | c704e06 | 2014-05-23 08:40:35 -0700 | [diff] [blame] | 336 | |
| 337 | void RecoveryUI::SetEnableReboot(bool enabled) { |
| 338 | pthread_mutex_lock(&key_queue_mutex); |
| 339 | enable_reboot = enabled; |
| 340 | pthread_mutex_unlock(&key_queue_mutex); |
| 341 | } |