From 89e2dcf83fa3901090893e98c17708e279dea47f Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Mon, 24 Nov 2014 15:11:41 -0800 Subject: 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 --- ui.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ui.h') diff --git a/ui.h b/ui.h index ecf221b..123dc34 100644 --- a/ui.h +++ b/ui.h @@ -21,6 +21,7 @@ #include #include +#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); -- cgit v1.1