From 1a0a30a16a8071c59e265f52de60dedc54d31bd9 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 25 Oct 2018 15:22:07 -0700 Subject: Show wipe data confirmation text in recovery mode After we generate the localized confirmation text images for certain dpi, we can now load these images and display them under recovery. Devices that cannot load the images will use the backup text strings as before. Bug: 74397117 Test: check the menu with multiple locales, and check all the images locally with locale test, check the fall back strings. Change-Id: Ic31a55670026c909ec7a05cb0bb4a0fc1d5d15c7 --- screen_ui.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'screen_ui.cpp') diff --git a/screen_ui.cpp b/screen_ui.cpp index 765d2fe60..575605452 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -844,9 +844,13 @@ bool ScreenRecoveryUI::InitTextParams() { return true; } -// TODO(xunchang) load localized text icons for the menu. (Init for screenRecoveryUI but -// not wearRecoveryUI). bool ScreenRecoveryUI::LoadWipeDataMenuText() { + // Ignores the errors since the member variables will stay as nullptr. + cancel_wipe_data_text_ = LoadLocalizedBitmap("cancel_wipe_data_text"); + factory_data_reset_text_ = LoadLocalizedBitmap("factory_data_reset_text"); + try_again_text_ = LoadLocalizedBitmap("try_again_text"); + wipe_data_confirmation_text_ = LoadLocalizedBitmap("wipe_data_confirmation_text"); + wipe_data_menu_header_text_ = LoadLocalizedBitmap("wipe_data_menu_header_text"); return true; } @@ -1250,6 +1254,20 @@ size_t ScreenRecoveryUI::ShowPromptWipeDataMenu(const std::vector& return ShowMenu(std::move(wipe_data_menu), true, key_handler); } +size_t ScreenRecoveryUI::ShowPromptWipeDataConfirmationMenu( + const std::vector& backup_headers, const std::vector& backup_items, + const std::function& key_handler) { + auto confirmation_menu = + CreateMenu(wipe_data_confirmation_text_.get(), + { cancel_wipe_data_text_.get(), factory_data_reset_text_.get() }, backup_headers, + backup_items, 0); + if (confirmation_menu == nullptr) { + return 0; + } + + return ShowMenu(std::move(confirmation_menu), true, key_handler); +} + bool ScreenRecoveryUI::IsTextVisible() { std::lock_guard lg(updateMutex); int visible = show_text; -- cgit v1.2.3