From 5f8dd9951d986b65d98d6a9ea38003427e9e46df Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Fri, 28 Jul 2017 00:05:40 -0700 Subject: ui: Move the support for touch inputs into RecoveryUI. - Added detection for EV_ABS events in minui/events.cpp, if it's allowed; - Added listening and processing touch inputs in ui.cpp; - Fixed an issue in recognizing swipe with multi-touch protocol A; - Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It now allows turning on text mode with + . The last change also fixed an issue on devices with protocol A: prior to this CL, user may accidentally toggle the text mode during an OTA. Because it was considered as a single-button device, a long tap that sent BTN_TOUCH event would turn on text mode. Test: Allow detecting touch inputs. Swiping (up, down, enter) works on angler, angelfish, dorado respectively. Bug: 36169090 Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd --- minui/include/minui/minui.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'minui/include') diff --git a/minui/include/minui/minui.h b/minui/include/minui/minui.h index 78dd4cb98..017ddde75 100644 --- a/minui/include/minui/minui.h +++ b/minui/include/minui/minui.h @@ -74,10 +74,11 @@ struct input_event; using ev_callback = std::function; using ev_set_key_callback = std::function; -int ev_init(ev_callback input_cb); +int ev_init(ev_callback input_cb, bool allow_touch_inputs = false); void ev_exit(); int ev_add_fd(int fd, ev_callback cb); void ev_iterate_available_keys(const std::function& f); +void ev_iterate_touch_inputs(const std::function& action); int ev_sync_key_state(const ev_set_key_callback& set_key_cb); // 'timeout' has the same semantics as poll(2). -- cgit v1.2.3 From 29d5575fa877770f6387420294d9dc184a84a115 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Wed, 20 Sep 2017 17:53:46 -0700 Subject: Add a new option in recovery menu to test the background texts Add a new option "Run locale test" to check the background text images (i.e. texts for "erasing", "error", "no_command" and "installing" with different locales.) Use volume up/down button to cycle through all the locales embedded in the png file, and power button to go back to recovery main menu. Test: Run locale test with bullhead. Change-Id: Ib16e119f372110cdb5e611ef497b0f9b9b418f51 --- minui/include/minui/minui.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'minui/include') diff --git a/minui/include/minui/minui.h b/minui/include/minui/minui.h index 017ddde75..27e603136 100644 --- a/minui/include/minui/minui.h +++ b/minui/include/minui/minui.h @@ -21,6 +21,7 @@ #include #include +#include // // Graphics. @@ -129,6 +130,9 @@ int res_create_alpha_surface(const char* name, GRSurface** pSurface); int res_create_localized_alpha_surface(const char* name, const char* locale, GRSurface** pSurface); +// Return a list of locale strings embedded in |png_name|. Return a empty list in case of failure. +std::vector get_locales_in_png(const std::string& png_name); + // Free a surface allocated by any of the res_create_*_surface() // functions. void res_free_surface(GRSurface* surface); -- cgit v1.2.3 From 846012fc444e6076dabf874ed8cbdab358c2e0fb Mon Sep 17 00:00:00 2001 From: Luke Song Date: Wed, 13 Sep 2017 15:56:16 -0700 Subject: graphics: add rotation logic Bug: 65556996 Bug: 63541890 Test: Tried 4 rotations, viewed logs and graphics test Change-Id: I2a6c18c28df03f0461663f63bf16db32c45211ec --- minui/include/minui/minui.h | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'minui/include') diff --git a/minui/include/minui/minui.h b/minui/include/minui/minui.h index 27e603136..f9da19999 100644 --- a/minui/include/minui/minui.h +++ b/minui/include/minui/minui.h @@ -28,17 +28,24 @@ // struct GRSurface { - int width; - int height; - int row_bytes; - int pixel_bytes; - unsigned char* data; + int width; + int height; + int row_bytes; + int pixel_bytes; + unsigned char* data; }; struct GRFont { - GRSurface* texture; - int char_width; - int char_height; + GRSurface* texture; + int char_width; + int char_height; +}; + +enum GRRotation { + ROTATION_NONE = 0, + ROTATION_RIGHT = 1, + ROTATION_DOWN = 2, + ROTATION_LEFT = 3, }; int gr_init(); @@ -58,14 +65,17 @@ void gr_texticon(int x, int y, GRSurface* icon); const GRFont* gr_sys_font(); int gr_init_font(const char* name, GRFont** dest); -void gr_text(const GRFont* font, int x, int y, const char *s, bool bold); -int gr_measure(const GRFont* font, const char *s); -void gr_font_size(const GRFont* font, int *x, int *y); +void gr_text(const GRFont* font, int x, int y, const char* s, bool bold); +int gr_measure(const GRFont* font, const char* s); +void gr_font_size(const GRFont* font, int* x, int* y); void gr_blit(GRSurface* source, int sx, int sy, int w, int h, int dx, int dy); unsigned int gr_get_width(GRSurface* surface); unsigned int gr_get_height(GRSurface* surface); +// Set rotation, flips gr_fb_width/height if 90 degree rotation difference +void gr_rotate(GRRotation rotation); + // // Input events. // @@ -115,8 +125,8 @@ int res_create_display_surface(const char* name, GRSurface** pSurface); // should have a 'Frames' text chunk whose value is the number of // frames this image represents. The pixel data itself is interlaced // by row. -int res_create_multi_display_surface(const char* name, int* frames, - int* fps, GRSurface*** pSurface); +int res_create_multi_display_surface(const char* name, int* frames, int* fps, + GRSurface*** pSurface); // Load a single alpha surface from a grayscale PNG image. int res_create_alpha_surface(const char* name, GRSurface** pSurface); -- cgit v1.2.3