diff options
author | Tianjie Xu <xunchang@google.com> | 2019-04-23 20:37:17 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-04-23 20:37:17 +0200 |
commit | 8445949f2f1cc15b1ef30922efa3ea58f90bd36e (patch) | |
tree | 9d6686b48ad443fb4a89270bb68999cfc0493edd /recovery_ui | |
parent | Merge "minadbd: Support rescue install and getprop commands." am: f365574a60 am: 8c7085878c (diff) | |
parent | Merge changes Ibdb7dd0b,Iafd3e846 am: 72e6e55e34 (diff) | |
download | android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.tar android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.tar.gz android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.tar.bz2 android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.tar.lz android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.tar.xz android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.tar.zst android_bootable_recovery-8445949f2f1cc15b1ef30922efa3ea58f90bd36e.zip |
Diffstat (limited to 'recovery_ui')
-rw-r--r-- | recovery_ui/include/recovery_ui/ui.h | 2 | ||||
-rw-r--r-- | recovery_ui/screen_ui.cpp | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/recovery_ui/include/recovery_ui/ui.h b/recovery_ui/include/recovery_ui/ui.h index d55322cf0..797e2f0d5 100644 --- a/recovery_ui/include/recovery_ui/ui.h +++ b/recovery_ui/include/recovery_ui/ui.h @@ -27,6 +27,8 @@ #include <thread> #include <vector> +static constexpr const char* DEFAULT_LOCALE = "en-US"; + // Abstract class for controlling the user interface during recovery. class RecoveryUI { public: diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp index 870db621c..823004521 100644 --- a/recovery_ui/screen_ui.cpp +++ b/recovery_ui/screen_ui.cpp @@ -817,12 +817,22 @@ std::unique_ptr<GRSurface> ScreenRecoveryUI::LoadBitmap(const std::string& filen std::unique_ptr<GRSurface> ScreenRecoveryUI::LoadLocalizedBitmap(const std::string& filename) { GRSurface* surface; - if (auto result = res_create_localized_alpha_surface(filename.c_str(), locale_.c_str(), &surface); - result < 0) { - LOG(ERROR) << "Failed to load bitmap " << filename << " (error " << result << ")"; - return nullptr; + auto result = res_create_localized_alpha_surface(filename.c_str(), locale_.c_str(), &surface); + if (result == 0) { + return std::unique_ptr<GRSurface>(surface); } - return std::unique_ptr<GRSurface>(surface); + // TODO(xunchang) create a error code enum to refine the retry condition. + LOG(WARNING) << "Failed to load bitmap " << filename << " for locale " << locale_ << " (error " + << result << "). Falling back to use default locale."; + + result = res_create_localized_alpha_surface(filename.c_str(), DEFAULT_LOCALE, &surface); + if (result == 0) { + return std::unique_ptr<GRSurface>(surface); + } + + LOG(ERROR) << "Failed to load bitmap " << filename << " for locale " << DEFAULT_LOCALE + << " (error " << result << ")"; + return nullptr; } static char** Alloc2d(size_t rows, size_t cols) { |