diff options
author | Tao Bao <tbao@google.com> | 2018-05-08 19:46:01 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-05-08 19:46:01 +0200 |
commit | e5caa4095b8d250af3d11c6d910a4948f3d0e93c (patch) | |
tree | 7001c4d85fc343b3c4f8c1c2b8419487025e3058 /recovery.cpp | |
parent | [automerger skipped] Merge "recovery: Refactor logging code into logging.cpp" am: 5285c27bf4 (diff) | |
parent | Merge "recovery: Get UI and locale from device." (diff) | |
download | android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.tar android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.tar.gz android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.tar.bz2 android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.tar.lz android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.tar.xz android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.tar.zst android_bootable_recovery-e5caa4095b8d250af3d11c6d910a4948f3d0e93c.zip |
Diffstat (limited to 'recovery.cpp')
-rw-r--r-- | recovery.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/recovery.cpp b/recovery.cpp index 0ab34197f..37298d792 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -89,7 +89,6 @@ static constexpr const char* SDCARD_ROOT = "/sdcard"; // into target_files.zip. Assert the version defined in code and in Android.mk are consistent. static_assert(kRecoveryApiVersion == RECOVERY_API_VERSION, "Mismatching recovery API versions."); -static std::string locale; static bool has_cache = false; RecoveryUI* ui = nullptr; @@ -232,7 +231,8 @@ static void set_sdcard_update_bootloader_message() { // Clear the recovery command and prepare to boot a (hopefully working) system, // copy our log file to cache as well (for the system to read). This function is // idempotent: call it as many times as you like. -static void finish_recovery() { +static void finish_recovery(Device* device) { + std::string locale = device->GetUI()->GetLocale(); // Save the locale to cache, so if recovery is next started up without a '--locale' argument // (e.g., directly from the bootloader) it will use the last-known locale. if (!locale.empty() && has_cache) { @@ -809,7 +809,7 @@ static int apply_from_sdcard(Device* device, bool* wipe_cache) { // which is to reboot or shutdown depending on if the --shutdown_after flag was passed to recovery. static Device::BuiltinAction prompt_and_wait(Device* device, int status) { for (;;) { - finish_recovery(); + finish_recovery(device); switch (status) { case INSTALL_SUCCESS: case INSTALL_NONE: @@ -897,7 +897,7 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) { case Device::RUN_LOCALE_TEST: { ScreenRecoveryUI* screen_ui = static_cast<ScreenRecoveryUI*>(ui); - screen_ui->CheckBackgroundTextImages(locale); + screen_ui->CheckBackgroundTextImages(screen_ui->GetLocale()); break; } case Device::MOUNT_SYSTEM: @@ -1125,6 +1125,7 @@ int start_recovery(int argc, char** argv) { bool shutdown_after = false; int retry_count = 0; bool security_update = false; + std::string locale; int arg; int option_index; @@ -1202,6 +1203,7 @@ int start_recovery(int argc, char** argv) { ui = new StubRecoveryUI(); } } + device->SetUI(ui); // Set background string to "installing security update" for security update, // otherwise set it to "installing system update". @@ -1368,7 +1370,7 @@ int start_recovery(int argc, char** argv) { } // Save logs and clean up before rebooting or shutting down. - finish_recovery(); + finish_recovery(device); switch (after) { case Device::SHUTDOWN: |