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
This commit is contained in:
David Anderson 2019-01-02 11:35:38 -08:00
parent 90edbb17f8
commit 983e2d5718
10 changed files with 26 additions and 1 deletions

View file

@ -458,6 +458,8 @@ int main(int argc, char** argv) {
} }
} }
ui->SetEnableFastbootdLogo(fastboot);
auto ret = fastboot ? StartFastboot(device, args) : start_recovery(device, args); auto ret = fastboot ? StartFastboot(device, args) : start_recovery(device, args);
if (ret == Device::KEY_INTERRUPTED) { if (ret == Device::KEY_INTERRUPTED) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -701,6 +701,16 @@ void ScreenRecoveryUI::draw_screen_locked() {
void ScreenRecoveryUI::draw_menu_and_text_buffer_locked( void ScreenRecoveryUI::draw_menu_and_text_buffer_locked(
const std::vector<std::string>& help_message) { const std::vector<std::string>& help_message) {
int y = margin_height_; 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_) { if (menu_) {
int x = margin_width_ + kMenuIndent; int x = margin_width_ + kMenuIndent;
@ -890,6 +900,10 @@ bool ScreenRecoveryUI::Init(const std::string& locale) {
no_command_text_ = LoadLocalizedBitmap("no_command_text"); no_command_text_ = LoadLocalizedBitmap("no_command_text");
error_text_ = LoadLocalizedBitmap("error_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 // 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 security update". It will be set after Init() according to the commands in BCB.
installing_text_.reset(); installing_text_.reset();

View file

@ -345,6 +345,8 @@ class ScreenRecoveryUI : public RecoveryUI, public DrawInterface {
std::unique_ptr<GRSurface> wipe_data_confirmation_text_; std::unique_ptr<GRSurface> wipe_data_confirmation_text_;
std::unique_ptr<GRSurface> wipe_data_menu_header_text_; std::unique_ptr<GRSurface> wipe_data_menu_header_text_;
std::unique_ptr<GRSurface> fastbootd_logo_;
// current_icon_ points to one of the frames in intro_frames_ or loop_frames_, indexed by // current_icon_ points to one of the frames in intro_frames_ or loop_frames_, indexed by
// current_frame_, or error_icon_. // current_frame_, or error_icon_.
Icon current_icon_; Icon current_icon_;

1
ui.cpp
View file

@ -59,6 +59,7 @@ RecoveryUI::RecoveryUI()
brightness_file_(BRIGHTNESS_FILE), brightness_file_(BRIGHTNESS_FILE),
max_brightness_file_(MAX_BRIGHTNESS_FILE), max_brightness_file_(MAX_BRIGHTNESS_FILE),
touch_screen_allowed_(false), touch_screen_allowed_(false),
fastbootd_logo_enabled_(false),
touch_low_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_low_threshold", touch_low_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_low_threshold",
kDefaultTouchLowThreshold)), kDefaultTouchLowThreshold)),
touch_high_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_high_threshold", touch_high_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_high_threshold",

8
ui.h
View file

@ -168,7 +168,6 @@ class RecoveryUI {
virtual size_t ShowPromptWipeDataMenu(const std::vector<std::string>& backup_headers, virtual size_t ShowPromptWipeDataMenu(const std::vector<std::string>& backup_headers,
const std::vector<std::string>& backup_items, const std::vector<std::string>& backup_items,
const std::function<int(int, bool)>& key_handler) = 0; const std::function<int(int, bool)>& key_handler) = 0;
// Displays the localized wipe data confirmation menu with pre-generated images. Falls back to // 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 // the text strings upon failures. The initial selection is the 0th item, which returns to the
// upper level menu. // upper level menu.
@ -176,6 +175,11 @@ class RecoveryUI {
const std::vector<std::string>& backup_headers, const std::vector<std::string>& backup_items, const std::vector<std::string>& backup_headers, const std::vector<std::string>& backup_items,
const std::function<int(int, bool)>& key_handler) = 0; const std::function<int(int, bool)>& 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. // Resets the key interrupt status.
void ResetKeyInterruptStatus() { void ResetKeyInterruptStatus() {
key_interrupted_ = false; key_interrupted_ = false;
@ -200,6 +204,8 @@ class RecoveryUI {
// Whether we should listen for touch inputs (default: false). // Whether we should listen for touch inputs (default: false).
bool touch_screen_allowed_; bool touch_screen_allowed_;
bool fastbootd_logo_enabled_;
private: private:
enum class ScreensaverState { enum class ScreensaverState {
DISABLED, DISABLED,