summaryrefslogtreecommitdiffstats
path: root/recovery_ui/screen_ui.cpp
diff options
context:
space:
mode:
authorxunchang <xunchang@google.com>2019-04-16 21:07:42 +0200
committerxunchang <xunchang@google.com>2019-04-22 23:39:51 +0200
commit9d05c8a35776444f6e967f8a4ac5863a31e54cf6 (patch)
tree3bea493d37159d462e27802aae147a425c9810ed /recovery_ui/screen_ui.cpp
parentMerge "Allow entering rescue mode via recovery UI." (diff)
downloadandroid_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.gz
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.bz2
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.lz
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.xz
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.zst
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.zip
Diffstat (limited to 'recovery_ui/screen_ui.cpp')
-rw-r--r--recovery_ui/screen_ui.cpp20
1 files changed, 15 insertions, 5 deletions
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) {