Revert "recovery: report compliant reboot reason"

This reverts commit 6f4e4db4f9.

Reason for revert: Booting out of recovery (choose `Reboot system now`)
on taimen is broken. Device keeps booting back into recovery.

Bug: 133326470
Test: Choose `Reboot system now` from recovery menu. Deivce attempts
      normal boot.
Change-Id: I6e85fc248e18953a6fb94513c3abc7e7e0fb0477
This commit is contained in:
Tao Bao 2019-05-22 18:03:01 +00:00
parent d31fb2e7fc
commit feefbf2f56
7 changed files with 10 additions and 29 deletions

View file

@ -30,10 +30,10 @@
#include "recovery_ui/ui.h" #include "recovery_ui/ui.h"
static const std::vector<std::pair<std::string, Device::BuiltinAction>> kFastbootMenuActions{ static const std::vector<std::pair<std::string, Device::BuiltinAction>> kFastbootMenuActions{
{ "Reboot system now", Device::REBOOT_FROM_FASTBOOT }, { "Reboot system now", Device::REBOOT },
{ "Enter recovery", Device::ENTER_RECOVERY }, { "Enter recovery", Device::ENTER_RECOVERY },
{ "Reboot to bootloader", Device::REBOOT_BOOTLOADER }, { "Reboot to bootloader", Device::REBOOT_BOOTLOADER },
{ "Power off", Device::SHUTDOWN_FROM_FASTBOOT }, { "Power off", Device::SHUTDOWN },
}; };
Device::BuiltinAction StartFastboot(Device* device, const std::vector<std::string>& /* args */) { Device::BuiltinAction StartFastboot(Device* device, const std::vector<std::string>& /* args */) {

View file

@ -102,11 +102,11 @@ class MemMapping {
}; };
// Reboots the device into the specified target, by additionally handling quiescent reboot mode. // Reboots the device into the specified target, by additionally handling quiescent reboot mode.
// All unknown targets reboot into Android. // 'target' can be an empty string, which indicates booting into Android.
bool Reboot(std::string_view target); bool Reboot(std::string_view target);
// Triggers a shutdown. // Triggers a shutdown.
bool Shutdown(std::string_view target); bool Shutdown();
// Returns a null-terminated char* array, where the elements point to the C-strings in the given // Returns a null-terminated char* array, where the elements point to the C-strings in the given
// vector, plus an additional nullptr at the end. This is a helper function that facilitates // vector, plus an additional nullptr at the end. This is a helper function that facilitates

View file

@ -229,9 +229,9 @@ bool Reboot(std::string_view target) {
return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
} }
bool Shutdown(std::string_view target) { bool Shutdown() {
std::string cmd = "shutdown," + std::string(target); // "shutdown" doesn't need a "reason" arg nor a comma.
return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); return android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown");
} }
std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args) { std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args) {

View file

@ -356,8 +356,6 @@ static Device::BuiltinAction PromptAndWait(Device* device, InstallResult status)
: device->InvokeMenuItem(chosen_item); : device->InvokeMenuItem(chosen_item);
switch (chosen_action) { switch (chosen_action) {
case Device::REBOOT_FROM_FASTBOOT: // Can not happen
case Device::SHUTDOWN_FROM_FASTBOOT: // Can not happen
case Device::NO_ACTION: case Device::NO_ACTION:
break; break;

View file

@ -471,12 +471,7 @@ int main(int argc, char** argv) {
switch (ret) { switch (ret) {
case Device::SHUTDOWN: case Device::SHUTDOWN:
ui->Print("Shutting down...\n"); ui->Print("Shutting down...\n");
Shutdown("recovery"); Shutdown();
break;
case Device::SHUTDOWN_FROM_FASTBOOT:
ui->Print("Shutting down...\n");
Shutdown("fastboot");
break; break;
case Device::REBOOT_BOOTLOADER: case Device::REBOOT_BOOTLOADER:
@ -525,19 +520,9 @@ int main(int argc, char** argv) {
fastboot = false; fastboot = false;
break; break;
case Device::REBOOT:
ui->Print("Rebooting...\n");
Reboot("recovery_menu");
break;
case Device::REBOOT_FROM_FASTBOOT:
ui->Print("Rebooting...\n");
Reboot("fastboot_menu");
break;
default: default:
ui->Print("Rebooting...\n"); ui->Print("Rebooting...\n");
Reboot("unknown" + std::to_string(ret)); Reboot("");
break; break;
} }
} }

View file

@ -58,8 +58,6 @@ class Device {
REBOOT_FASTBOOT = 17, REBOOT_FASTBOOT = 17,
REBOOT_RECOVERY = 18, REBOOT_RECOVERY = 18,
REBOOT_RESCUE = 19, REBOOT_RESCUE = 19,
REBOOT_FROM_FASTBOOT = 20,
SHUTDOWN_FROM_FASTBOOT = 21,
}; };
explicit Device(RecoveryUI* ui); explicit Device(RecoveryUI* ui);

View file

@ -375,7 +375,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
case RecoveryUI::REBOOT: case RecoveryUI::REBOOT:
if (reboot_enabled) { if (reboot_enabled) {
Reboot("recovery_ui"); Reboot("");
while (true) { while (true) {
pause(); pause();
} }