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 --- recovery.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'recovery.cpp') diff --git a/recovery.cpp b/recovery.cpp index 7e1fa43a6..de916c633 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -369,7 +369,14 @@ static bool yes_no(Device* device, const char* question1, const char* question2) } static bool ask_to_wipe_data(Device* device) { - return yes_no(device, "Wipe all user data?", " THIS CAN NOT BE UNDONE!"); + std::vector headers{ "Wipe all user data?", " THIS CAN NOT BE UNDONE!" }; + std::vector items{ " Cancel", " Factory data reset" }; + + size_t chosen_item = ui->ShowPromptWipeDataConfirmationMenu( + headers, items, + std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); + + return (chosen_item == 1); } // Return true on success. @@ -420,7 +427,6 @@ static InstallResult prompt_and_wipe_data(Device* device) { return INSTALL_SUCCESS; // Just reboot, no wipe; not a failure, user asked for it } - // TODO(xunchang) localize the confirmation texts also. if (ask_to_wipe_data(device)) { if (wipe_data(device)) { return INSTALL_SUCCESS; -- cgit v1.2.3