From 9e805d6ca0101f6bfc458e5c1e9b48fecb495a72 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 4 Sep 2013 13:44:38 -0700 Subject: allow CheckKey to request mounting /system Also provide a default implementation of CheckKey that's reasonable for many devices (those that have power and volume keys). Change-Id: Icf6c7746ebd866152d402059dbd27fd16bd51ff8 --- ui.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ui.h') diff --git a/ui.h b/ui.h index 6c8987a33..d85fc659b 100644 --- a/ui.h +++ b/ui.h @@ -77,7 +77,7 @@ class RecoveryUI { // Return value indicates whether an immediate operation should be // triggered (toggling the display, rebooting the device), or if // the key should be enqueued for use by the main thread. - enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE }; + enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE, MOUNT_SYSTEM }; virtual KeyAction CheckKey(int key); // Called immediately before each call to CheckKey(), tell you if @@ -121,6 +121,10 @@ private: int key_down_count; // under key_queue_mutex int rel_sum; + int consecutive_power_keys; + int consecutive_alternate_keys; + int last_key; + typedef struct { RecoveryUI* ui; int key_code; -- cgit v1.2.3 From e7265df3523d27c9f59829c858de256cf063da26 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 10 Sep 2013 16:53:12 -0700 Subject: recovery: ui changes for ev_*() switch to epoll Convert callback events parameter to unsigned int. Change-Id: Ife0e983f307c07bf4aca807d70574aeb20c460cd --- ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui.h') diff --git a/ui.h b/ui.h index d85fc659b..22f3e5c53 100644 --- a/ui.h +++ b/ui.h @@ -134,7 +134,7 @@ private: pthread_t input_t; static void* input_thread(void* cookie); - static int input_callback(int fd, short revents, void* data); + static int input_callback(int fd, unsigned int epevents, void* data); void process_key(int key_code, int updown); bool usb_connected(); -- cgit v1.2.3 From a5ef19fabd10428ccff2055455ef1a55dfdc5fa0 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 17 Sep 2013 13:39:10 -0700 Subject: recovery: fix epoll events type to uint32_t Change-Id: I5db9987102201c18821acb45d1f824e9865a1451 --- ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui.h') diff --git a/ui.h b/ui.h index 22f3e5c53..8cc1da1ba 100644 --- a/ui.h +++ b/ui.h @@ -134,7 +134,7 @@ private: pthread_t input_t; static void* input_thread(void* cookie); - static int input_callback(int fd, unsigned int epevents, void* data); + static int input_callback(int fd, uint32_t epevents, void* data); void process_key(int key_code, int updown); bool usb_connected(); -- cgit v1.2.3 From c87bab101893e8322b49d7c8600e3367b20ab50a Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Mon, 25 Nov 2013 13:53:25 -0800 Subject: add the functions for multi-stage packages to updater In order to support multi-stage recovery packages, we add the set_stage() and get_stage() functions, which store a short string somewhere it can be accessed across invocations of recovery. We also add reboot_now() which updater can invoke to immediately reboot the device, without doing normal recovery cleanup. (It can also choose whether to boot off the boot or recovery partition.) If the stage string is of the form "#/#", recovery's UI will be augmented with a simple indicator of what stage you're in, so it doesn't look like a reboot loop. Change-Id: I62f7ff0bc802b549c9bcf3cc154a6bad99f94603 --- ui.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui.h') diff --git a/ui.h b/ui.h index 6c8987a33..0757260b7 100644 --- a/ui.h +++ b/ui.h @@ -30,6 +30,8 @@ class RecoveryUI { // Initialize the object; called before anything else. virtual void Init(); + // Show a stage indicator. Call immediately after Init(). + virtual void SetStage(int current, int max) { } // After calling Init(), you can tell the UI what locale it is operating in. virtual void SetLocale(const char* locale) { } -- cgit v1.2.3 From c704e06ce596bd0a6de66b10b108aee95535468a Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 23 May 2014 08:40:35 -0700 Subject: disable async reboot during package installation The default recovery UI will reboot the device when the power key is pressed 7 times in a row, regardless of what recovery is doing. Disable this feature during package installation, to minimize the chance of corrupting the device due to a mid-install reboot. (Debug packages can explicitly request that the feature be reenabled.) Change-Id: I20f3ec240ecd344615d452005ff26d8dd7775acf --- ui.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ui.h') diff --git a/ui.h b/ui.h index faa0acd46..31a8a7fb1 100644 --- a/ui.h +++ b/ui.h @@ -93,6 +93,13 @@ class RecoveryUI { // be called with "true". virtual void KeyLongPress(int key); + // Normally in recovery there's a key sequence that triggers + // immediate reboot of the device, regardless of what recovery is + // doing (with the default CheckKey implementation, it's pressing + // the power button 7 times in row). Call this to enable or + // disable that feature. It is enabled by default. + virtual void SetEnableReboot(bool enabled); + // --- menu display --- // Display some header text followed by a menu of items, which appears @@ -121,6 +128,7 @@ private: int key_last_down; // under key_queue_mutex bool key_long_press; // under key_queue_mutex int key_down_count; // under key_queue_mutex + bool enable_reboot; // under key_queue_mutex int rel_sum; int consecutive_power_keys; -- cgit v1.2.3