diff options
author | Tom Marshall <tdm@cyngn.com> | 2014-11-24 15:11:41 -0800 |
---|---|---|
committer | Tom Marshall <tdm@cyngn.com> | 2015-11-25 15:35:20 -0800 |
commit | 89e2dcf83fa3901090893e98c17708e279dea47f (patch) | |
tree | 23a69ea49d0897fc5052ef44f75afc9a7f53c89a /ui.h | |
parent | acc855f711ae7bce20e4fc896c829e135a6801fc (diff) | |
download | bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.zip bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.tar.gz bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.tar.bz2 |
recovery: Initial dialog implementation
Implement two types of dialogs: info and error. Info dialogs are intended
to show that an operation is in progress and cannot be interrupted. Error
dialogs are intended to show that an error occurred. The user must respond
by dismissing the dialog with any input (a swipe or keypress).
Dialogs may be initiated internally within the UI code or externally via a
named local socket. Dialogs created via socket are presumed to be info
and may not be dismissed. When the client socket is closed, the dialog
automatically dismisses.
Initial implementation shows dialogs for adb backup and restore. Future
work will show dialogs for all errors and lengthy operations.
Change-Id: Icefea12ec0fd70fb487d54aa2eb1cae9dd451355
Diffstat (limited to 'ui.h')
-rw-r--r-- | ui.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -21,6 +21,7 @@ #include <pthread.h> #include <time.h> +#include "messagesocket.h" #include "voldclient.h" // Abstract class for controlling the user interface during recovery. @@ -39,7 +40,7 @@ class RecoveryUI { virtual void SetLocale(const char* locale) = 0; // Set the overall recovery state ("background image"). - enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, ERROR }; + enum Icon { NONE, INSTALLING_UPDATE, ERASING, NO_COMMAND, INFO, ERROR, NR_ICONS }; virtual void SetBackground(Icon icon) = 0; // --- progress indicator --- @@ -71,6 +72,12 @@ class RecoveryUI { virtual void ShowFile(const char* filename) = 0; + virtual void DialogShowInfo(const char* text) = 0; + virtual void DialogShowError(const char* text) = 0; + virtual int DialogShowing() const = 0; + virtual bool DialogDismissable() const = 0; + virtual void DialogDismiss() = 0; + // --- key handling --- // Wait for a key and return it. May return -1 after timeout. @@ -160,6 +167,8 @@ private: pthread_t input_thread_; + MessageSocket message_socket; + void OnKeyDetected(int key_code); static int InputCallback(int fd, uint32_t epevents, void* data); |