From 983e2d571814ffaf9a88bc6cbc976ff3445d4aae Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 2 Jan 2019 11:35:38 -0800 Subject: Add a logo to the fastbootd screen. fastbootd looks too much like recovery, even if you're carefully reading the menu. It's not obvious the device is in a flashing mode, and it's too tempting to reboot or unplug the device in this state. As a first step, this patch adds a big red "fastbootd" logo so it's less obviously in recovery mode. Bug: 120429730 Test: manual test Change-Id: I73359f1fdfdc0b1694993f760fe7f35c5713b24e --- recovery_main.cpp | 2 ++ res-hdpi/images/fastbootd.png | Bin 0 -> 6916 bytes res-mdpi/images/fastbootd.png | Bin 0 -> 4607 bytes res-xhdpi/images/fastbootd.png | Bin 0 -> 9293 bytes res-xxhdpi/images/fastbootd.png | Bin 0 -> 13755 bytes res-xxxhdpi/images/fastbootd.png | Bin 0 -> 8107 bytes screen_ui.cpp | 14 ++++++++++++++ screen_ui.h | 2 ++ ui.cpp | 1 + ui.h | 8 +++++++- 10 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 res-hdpi/images/fastbootd.png create mode 100644 res-mdpi/images/fastbootd.png create mode 100644 res-xhdpi/images/fastbootd.png create mode 100644 res-xxhdpi/images/fastbootd.png create mode 100644 res-xxxhdpi/images/fastbootd.png diff --git a/recovery_main.cpp b/recovery_main.cpp index 6f5080238..7fb46163e 100644 --- a/recovery_main.cpp +++ b/recovery_main.cpp @@ -458,6 +458,8 @@ int main(int argc, char** argv) { } } + ui->SetEnableFastbootdLogo(fastboot); + auto ret = fastboot ? StartFastboot(device, args) : start_recovery(device, args); if (ret == Device::KEY_INTERRUPTED) { diff --git a/res-hdpi/images/fastbootd.png b/res-hdpi/images/fastbootd.png new file mode 100644 index 000000000..5127b3b37 Binary files /dev/null and b/res-hdpi/images/fastbootd.png differ diff --git a/res-mdpi/images/fastbootd.png b/res-mdpi/images/fastbootd.png new file mode 100644 index 000000000..c1b7bc2fb Binary files /dev/null and b/res-mdpi/images/fastbootd.png differ diff --git a/res-xhdpi/images/fastbootd.png b/res-xhdpi/images/fastbootd.png new file mode 100644 index 000000000..e3da85ad7 Binary files /dev/null and b/res-xhdpi/images/fastbootd.png differ diff --git a/res-xxhdpi/images/fastbootd.png b/res-xxhdpi/images/fastbootd.png new file mode 100644 index 000000000..482dbb29c Binary files /dev/null and b/res-xxhdpi/images/fastbootd.png differ diff --git a/res-xxxhdpi/images/fastbootd.png b/res-xxxhdpi/images/fastbootd.png new file mode 100644 index 000000000..a878b1f06 Binary files /dev/null and b/res-xxxhdpi/images/fastbootd.png differ diff --git a/screen_ui.cpp b/screen_ui.cpp index 6c00a2235..6f2b68b41 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -701,6 +701,16 @@ void ScreenRecoveryUI::draw_screen_locked() { void ScreenRecoveryUI::draw_menu_and_text_buffer_locked( const std::vector& help_message) { int y = margin_height_; + + if (fastbootd_logo_ && fastbootd_logo_enabled_) { + // Try to get this centered on screen. + auto width = gr_get_width(fastbootd_logo_.get()); + auto height = gr_get_height(fastbootd_logo_.get()); + auto centered_x = ScreenWidth() / 2 - width / 2; + DrawSurface(fastbootd_logo_.get(), 0, 0, width, height, centered_x, y); + y += height; + } + if (menu_) { int x = margin_width_ + kMenuIndent; @@ -890,6 +900,10 @@ bool ScreenRecoveryUI::Init(const std::string& locale) { no_command_text_ = LoadLocalizedBitmap("no_command_text"); error_text_ = LoadLocalizedBitmap("error_text"); + if (android::base::GetBoolProperty("ro.boot.dynamic_partitions", false)) { + fastbootd_logo_ = LoadBitmap("fastbootd"); + } + // Background text for "installing_update" could be "installing update" or // "installing security update". It will be set after Init() according to the commands in BCB. installing_text_.reset(); diff --git a/screen_ui.h b/screen_ui.h index acd44c819..5cda2a2e5 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -345,6 +345,8 @@ class ScreenRecoveryUI : public RecoveryUI, public DrawInterface { std::unique_ptr wipe_data_confirmation_text_; std::unique_ptr wipe_data_menu_header_text_; + std::unique_ptr fastbootd_logo_; + // current_icon_ points to one of the frames in intro_frames_ or loop_frames_, indexed by // current_frame_, or error_icon_. Icon current_icon_; diff --git a/ui.cpp b/ui.cpp index 14b5b0941..c12a11b36 100644 --- a/ui.cpp +++ b/ui.cpp @@ -59,6 +59,7 @@ RecoveryUI::RecoveryUI() brightness_file_(BRIGHTNESS_FILE), max_brightness_file_(MAX_BRIGHTNESS_FILE), touch_screen_allowed_(false), + fastbootd_logo_enabled_(false), touch_low_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_low_threshold", kDefaultTouchLowThreshold)), touch_high_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_high_threshold", diff --git a/ui.h b/ui.h index 4924fec52..b387ae3c9 100644 --- a/ui.h +++ b/ui.h @@ -168,7 +168,6 @@ class RecoveryUI { virtual size_t ShowPromptWipeDataMenu(const std::vector& backup_headers, const std::vector& backup_items, const std::function& key_handler) = 0; - // Displays the localized wipe data confirmation menu with pre-generated images. Falls back to // the text strings upon failures. The initial selection is the 0th item, which returns to the // upper level menu. @@ -176,6 +175,11 @@ class RecoveryUI { const std::vector& backup_headers, const std::vector& backup_items, const std::function& key_handler) = 0; + // Set whether or not the fastbootd logo is displayed. + void SetEnableFastbootdLogo(bool enable) { + fastbootd_logo_enabled_ = enable; + } + // Resets the key interrupt status. void ResetKeyInterruptStatus() { key_interrupted_ = false; @@ -200,6 +204,8 @@ class RecoveryUI { // Whether we should listen for touch inputs (default: false). bool touch_screen_allowed_; + bool fastbootd_logo_enabled_; + private: enum class ScreensaverState { DISABLED, -- cgit v1.2.3