aboutsummaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorDoug Zongker2011-10-28 12:33:05 -0500
committerDoug Zongker2011-10-31 12:24:09 -0500
commit28ce47cfa6919518a8c298088bf08b03bb374c0f (patch)
tree0c429bcc8f4a1935f3be97d87ebdc2f4434ee887 /ui.h
parentd0181b8fcdac761afec252151a8bfda116916e96 (diff)
downloadplatform-bootable-recovery-28ce47cfa6919518a8c298088bf08b03bb374c0f.tar.gz
platform-bootable-recovery-28ce47cfa6919518a8c298088bf08b03bb374c0f.tar.xz
platform-bootable-recovery-28ce47cfa6919518a8c298088bf08b03bb374c0f.zip
turn recovery into a C++ binary
Change-Id: I423a23581048d451d53eef46e5f5eac485b77555
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/ui.h b/ui.h
new file mode 100644
index 00000000..fa7a53c1
--- /dev/null
+++ b/ui.h
@@ -0,0 +1,75 @@
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#ifndef RECOVERY_UI_H
18#define RECOVERY_UI_H
19
20// Initialize the graphics system.
21void ui_init();
22
23// Use KEY_* codes from <linux/input.h> or KEY_DREAM_* from "minui/minui.h".
24int ui_wait_key(); // waits for a key/button press, returns the code
25int ui_key_pressed(int key); // returns >0 if the code is currently pressed
26int ui_text_visible(); // returns >0 if text log is currently visible
27int ui_text_ever_visible(); // returns >0 if text log was ever visible
28void ui_show_text(int visible);
29void ui_clear_key_queue();
30
31// Write a message to the on-screen log shown with Alt-L (also to stderr).
32// The screen is small, and users may need to report these messages to support,
33// so keep the output short and not too cryptic.
34void ui_print(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
35
36// Display some header text followed by a menu of items, which appears
37// at the top of the screen (in place of any scrolling ui_print()
38// output, if necessary).
39void ui_start_menu(const char* const * headers, const char* const * items,
40 int initial_selection);
41// Set the menu highlight to the given index, and return it (capped to
42// the range [0..numitems).
43int ui_menu_select(int sel);
44// End menu mode, resetting the text overlay so that ui_print()
45// statements will be displayed.
46void ui_end_menu();
47
48// Set the icon (normally the only thing visible besides the progress bar).
49enum {
50 BACKGROUND_ICON_NONE,
51 BACKGROUND_ICON_INSTALLING,
52 BACKGROUND_ICON_ERROR,
53 NUM_BACKGROUND_ICONS
54};
55void ui_set_background(int icon);
56
57// Show a progress bar and define the scope of the next operation:
58// portion - fraction of the progress bar the next operation will use
59// seconds - expected time interval (progress bar moves at this minimum rate)
60void ui_show_progress(float portion, int seconds);
61void ui_set_progress(float fraction); // 0.0 - 1.0 within the defined scope
62
63// Default allocation of progress bar segments to operations
64static const int VERIFICATION_PROGRESS_TIME = 60;
65static const float VERIFICATION_PROGRESS_FRACTION = 0.25;
66static const float DEFAULT_FILES_PROGRESS_FRACTION = 0.4;
67static const float DEFAULT_IMAGE_PROGRESS_FRACTION = 0.1;
68
69// Show a rotating "barberpole" for ongoing operations. Updates automatically.
70void ui_show_indeterminate_progress();
71
72// Hide and reset the progress bar.
73void ui_reset_progress();
74
75#endif // RECOVERY_UI_H