detachables: Select power off after language selection

Set current selection to power off after exiting the languages menu.
Previously, we were just defaulting to selecting the 0 index.  However,
this won't work anymore if we hide the "Enable Developer Mode" entry
in the recovery menu due to that entry being at the 0th index.

BUG=b:63078243, b:35585623
BRANCH=None
TEST=Boot into recovery when machine in normal mode.
     Select languages menu, make language selection and make sure
     that when return to recovery menu, power off item is selected.

Change-Id: I479c2270ca99197fd8c44386ab1ca4526ae7d64a
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/565527
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Shelley Chen
2017-07-10 10:31:20 -07:00
committed by chrome-bot
parent 356eab1c8e
commit fc7b3972bc

View File

@@ -572,10 +572,29 @@ VbError_t vb2_update_menu(struct vb2_context *ctx)
* because need to do in different order.
*/
current_menu = prev_menu;
current_menu_idx = 0;
prev_menu = VB_MENU_LANGUAGES;
selected = 0;
/* default to power off index */
switch (current_menu) {
case VB_MENU_DEV_WARNING:
current_menu_idx = VB_WARN_POWER_OFF;
break;
case VB_MENU_DEV:
current_menu_idx = VB_DEV_POWER_OFF;
break;
case VB_MENU_TO_NORM:
current_menu_idx = VB_TO_NORM_POWER_OFF;
break;
case VB_MENU_RECOVERY:
current_menu_idx = VB_RECOVERY_POWER_OFF;
break;
case VB_MENU_TO_DEV:
current_menu_idx = VB_TO_DEV_POWER_OFF;
break;
default:
current_menu_idx = 0;
break;
}
selected = current_menu_idx;
break;
}
default: