recovery: Bypass reboot prompt for sideload-auto-reboot

When we want to automatically reboot after a sideload, it doesn't make
much sense to try and prompt the user for a reboot into recovery.

Change-Id: Id0195965362b62bf940caba1f83ffe12191a73c6
This commit is contained in:
Joseph Annareddy 2023-08-16 12:04:56 -04:00 committed by zlewchan
parent 9e3932f787
commit 9002606988
4 changed files with 13 additions and 1 deletions

View file

@ -622,7 +622,7 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
if (package_is_ab) { if (package_is_ab) {
ab_package_installed = true; ab_package_installed = true;
PerformPowerwashIfRequired(zip, device); PerformPowerwashIfRequired(zip, device);
if (ask_to_ab_reboot(device)) { if (!ui->IsSideloadAutoReboot() && ask_to_ab_reboot(device)) {
reboot_to_recovery(); reboot_to_recovery();
} }
} }

View file

@ -858,6 +858,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
if (!sideload_auto_reboot) { if (!sideload_auto_reboot) {
ui->ShowText(true); ui->ShowText(true);
} }
ui->SetSideloadAutoReboot(sideload_auto_reboot);
status = ApplyFromAdb(device, false /* rescue_mode */, &next_action); status = ApplyFromAdb(device, false /* rescue_mode */, &next_action);
ui->Print("\nInstall from ADB complete (status: %d).\n", status); ui->Print("\nInstall from ADB complete (status: %d).\n", status);
if (sideload_auto_reboot) { if (sideload_auto_reboot) {

View file

@ -198,6 +198,14 @@ class RecoveryUI {
virtual bool IsUsbConnected(); virtual bool IsUsbConnected();
bool IsSideloadAutoReboot() const {
return sideload_auto_reboot_;
}
void SetSideloadAutoReboot(bool sar) {
sideload_auto_reboot_ = sar;
}
protected: protected:
void EnqueueKey(int key_code); void EnqueueKey(int key_code);
@ -214,6 +222,8 @@ class RecoveryUI {
bool fastbootd_logo_enabled_; bool fastbootd_logo_enabled_;
bool sideload_auto_reboot_;
private: private:
enum class ScreensaverState { enum class ScreensaverState {
DISABLED, DISABLED,

View file

@ -69,6 +69,7 @@ RecoveryUI::RecoveryUI()
DEFAULT_MAX_BRIGHTNESS_FILE)), DEFAULT_MAX_BRIGHTNESS_FILE)),
touch_screen_allowed_(false), touch_screen_allowed_(false),
fastbootd_logo_enabled_(false), fastbootd_logo_enabled_(false),
sideload_auto_reboot_(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",