vboot/ui: Add refresh flag to support force refresh the screen in action

CL:2163088 is working on depthcharge side to support refreshing
everything in vboot side, but it is still work in progress.
In the meanwhile, we can have a flag to control the refreshing for
already support refreshing everytime screen.

This flag can be removed after all screens are supported refreshing
everytime in vboot.

BRANCH=none
BUG=b:156692539, b:156693348
TEST=emerge-hatch vboot_reference
TEST=verfied in later CL that the screen is refreshed when the action
callback set this flag.

Signed-off-by: Meng-Huan Yu <menghuan@chromium.org>
Change-Id: Ie76e8dce5186d0acfbc176a4cc8079c3df37fd38
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2336239
Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
diff --git a/firmware/2lib/2ui.c b/firmware/2lib/2ui.c
index 99cedb0..85c0067 100644
--- a/firmware/2lib/2ui.c
+++ b/firmware/2lib/2ui.c
@@ -314,12 +314,14 @@
 	while (1) {
 		/* Draw if there are state changes. */
 		if (memcmp(&prev_state, ui.state, sizeof(*ui.state)) ||
-		    /* We want to redraw when timer is disabled. */
+		    /* Redraw when timer is disabled. */
 		    prev_disable_timer != ui.disable_timer ||
-		    /* We want to redraw/beep on a transition. */
+		    /* Redraw/beep on a transition. */
 		    prev_error_code != ui.error_code ||
-		    /* We want to beep. */
-		    ui.error_beep != 0) {
+		    /* Beep. */
+		    ui.error_beep != 0 ||
+		    /* Redraw on a screen request to refresh. */
+		    ui.force_display) {
 
 			menu = get_menu(&ui);
 			VB2_DEBUG("<%s> menu item <%s>\n",
@@ -338,6 +340,9 @@
 				ui.error_beep = 0;
 			}
 
+			/* Reset refresh flag. */
+			ui.force_display = 0;
+
 			/* Update prev variables. */
 			memcpy(&prev_state, ui.state, sizeof(*ui.state));
 			prev_disable_timer = ui.disable_timer;
diff --git a/firmware/2lib/include/2ui.h b/firmware/2lib/include/2ui.h
index 867b0c8..790301e 100644
--- a/firmware/2lib/include/2ui.h
+++ b/firmware/2lib/include/2ui.h
@@ -108,6 +108,10 @@
 
 	/* For displaying error messages. */
 	enum vb2_ui_error error_code;
+
+	/* Force calling vb2ex_display_ui for refreshing the screen. This flag
+	   will be reset after done. */
+	int force_display;
 };
 
 vb2_error_t vb2_ui_developer_mode_boot_internal_action(