aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu2017-04-20 20:08:21 -0500
committerTianjie Xu2017-04-21 17:49:30 -0500
commitd9d16297dd0cdc186ac7fbe867b61eb035e3548c (patch)
tree4f77cc6d066a0e567a362414b783d27a3a689457 /recovery.cpp
parentba3f078f6f00ce4dd4070741fc4e05b58e1d918b (diff)
downloadplatform-bootable-recovery-d9d16297dd0cdc186ac7fbe867b61eb035e3548c.tar.gz
platform-bootable-recovery-d9d16297dd0cdc186ac7fbe867b61eb035e3548c.tar.xz
platform-bootable-recovery-d9d16297dd0cdc186ac7fbe867b61eb035e3548c.zip
Reboot the device on user build after the install fails
Users can't do much after the install fails with the device showing "error" under recovery. So our best choice is to reboot the device since sometimes the system image is still bootable (i.e. on package verification failure). At worst the device would stuck in a boot loop where the users need the same professional knowledge to recover as before. Behaviors after installation failure (including data wipe): If recovery text is visible: No change. If recovery text is not visible: Old behavior: Wait under "error" screen. Reboot after UI timeout (120s) if not connected to usb charger. New behavior: Wait for 5s (shortens from the 120s timeout) under "error" screen and reboot (w or w/o charger). sideload-auto-reboot (only available for userdebug): Old behavior: Reboot immediately after installation failure. New behavior: Wait for 5s under "error" screen and reboot. Bug: 35386985 Test: On angler user, device auto reboots 5s after a failing OTA. Change-Id: I3ff0ead86e2ccec9445d6a2865bc2c463855f23c
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/recovery.cpp b/recovery.cpp
index b24efa96..99126eed 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -1593,14 +1593,22 @@ int main(int argc, char **argv) {
1593 } 1593 }
1594 } 1594 }
1595 1595
1596 if (!sideload_auto_reboot && (status == INSTALL_ERROR || status == INSTALL_CORRUPT)) { 1596 if (status == INSTALL_ERROR || status == INSTALL_CORRUPT) {
1597 copy_logs();
1598 ui->SetBackground(RecoveryUI::ERROR); 1597 ui->SetBackground(RecoveryUI::ERROR);
1598 if (!ui->IsTextVisible()) {
1599 sleep(5);
1600 }
1599 } 1601 }
1600 1602
1601 Device::BuiltinAction after = shutdown_after ? Device::SHUTDOWN : Device::REBOOT; 1603 Device::BuiltinAction after = shutdown_after ? Device::SHUTDOWN : Device::REBOOT;
1602 if ((status != INSTALL_SUCCESS && status != INSTALL_SKIPPED && !sideload_auto_reboot) || 1604 // 1. If the recovery menu is visible, prompt and wait for commands.
1603 ui->IsTextVisible()) { 1605 // 2. If the state is INSTALL_NONE, wait for commands. (i.e. In user build, manually reboot into
1606 // recovery to sideload a package.)
1607 // 3. sideload_auto_reboot is an option only available in user-debug build, reboot the device
1608 // without waiting.
1609 // 4. In all other cases, reboot the device. Therefore, normal users will observe the device
1610 // reboot after it shows the "error" screen for 5s.
1611 if ((status == INSTALL_NONE && !sideload_auto_reboot) || ui->IsTextVisible()) {
1604 Device::BuiltinAction temp = prompt_and_wait(device, status); 1612 Device::BuiltinAction temp = prompt_and_wait(device, status);
1605 if (temp != Device::NO_ACTION) { 1613 if (temp != Device::NO_ACTION) {
1606 after = temp; 1614 after = temp;