Lines Matching refs:device
161 static bool yes_no(Device* device, const char* question1, const char* question2) { in yes_no() argument
165 size_t chosen_item = device->GetUI()->ShowMenu( in yes_no()
167 std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); in yes_no()
171 static bool ask_to_wipe_data(Device* device) { in ask_to_wipe_data() argument
175 size_t chosen_item = device->GetUI()->ShowPromptWipeDataConfirmationMenu( in ask_to_wipe_data()
177 std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); in ask_to_wipe_data()
182 static InstallResult prompt_and_wipe_data(Device* device) { in prompt_and_wipe_data() argument
197 size_t chosen_item = device->GetUI()->ShowPromptWipeDataMenu( in prompt_and_wipe_data()
199 std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); in prompt_and_wipe_data()
208 if (ask_to_wipe_data(device)) { in prompt_and_wipe_data()
209 CHECK(device->GetReason().has_value()); in prompt_and_wipe_data()
210 bool convert_fbe = device->GetReason().value() == "convert_fbe"; in prompt_and_wipe_data()
211 if (WipeData(device, convert_fbe)) { in prompt_and_wipe_data()
220 static void choose_recovery_file(Device* device) { in choose_recovery_file() argument
256 chosen_item = device->GetUI()->ShowMenu( in choose_recovery_file()
258 std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); in choose_recovery_file()
266 device->GetUI()->ShowFile(entries[chosen_item]); in choose_recovery_file()
320 static bool AskToReboot(Device* device, Device::BuiltinAction chosen_action) { in AskToReboot() argument
350 size_t chosen_item = device->GetUI()->ShowMenu( in AskToReboot()
352 std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); in AskToReboot()
360 static Device::BuiltinAction PromptAndWait(Device* device, InstallResult status) { in PromptAndWait() argument
361 auto ui = device->GetUI(); in PromptAndWait()
362 bool update_in_progress = (device->GetReason().value_or("") == "update_in_progress"); in PromptAndWait()
394 headers, device->GetMenuItems(), 0, false, in PromptAndWait()
395 std::bind(&Device::HandleMenuKey, device, std::placeholders::_1, std::placeholders::_2)); in PromptAndWait()
405 : device->InvokeMenuItem(chosen_item); in PromptAndWait()
431 if (AskToReboot(device, chosen_action)) { in PromptAndWait()
439 if (ask_to_wipe_data(device)) { in PromptAndWait()
440 WipeData(device, false); in PromptAndWait()
443 WipeData(device, false); in PromptAndWait()
450 std::function<bool()> confirm_func = [&device]() { in PromptAndWait()
451 return yes_no(device, "Wipe cache?", " THIS CAN NOT BE UNDONE!"); in PromptAndWait()
471 status = ApplyFromAdb(device, true /* rescue_mode */, &reboot_action); in PromptAndWait()
473 status = ApplyFromAdb(device, false /* rescue_mode */, &reboot_action); in PromptAndWait()
476 status = ApplyFromSdcard(device); in PromptAndWait()
498 choose_recovery_file(device); in PromptAndWait()
593 Device::BuiltinAction start_recovery(Device* device, const std::vector<std::string>& args) { in start_recovery() argument
689 printf("stage is [%s]\n", device->GetStage().value_or("").c_str()); in start_recovery()
690 printf("reason is [%s]\n", device->GetReason().value_or("").c_str()); in start_recovery()
692 auto ui = device->GetUI(); in start_recovery()
699 if (!device->GetStage().has_value() && in start_recovery()
700 sscanf(device->GetStage().value().c_str(), "%d/%d", &st_cur, &st_max) == 2) { in start_recovery()
710 device->StartRecovery(); in start_recovery()
802 CHECK(device->GetReason().has_value()); in start_recovery()
803 bool convert_fbe = device->GetReason().value() == "convert_fbe"; in start_recovery()
804 if (!WipeData(device, convert_fbe)) { in start_recovery()
813 status = prompt_and_wipe_data(device); in start_recovery()
823 if (!WipeAbDevice(device, wipe_package_size)) { in start_recovery()
835 status = ApplyFromAdb(device, false /* rescue_mode */, &next_action); in start_recovery()
843 status = ApplyFromAdb(device, true /* rescue_mode */, &next_action); in start_recovery()
874 auto temp = PromptAndWait(device, status); in start_recovery()