summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-05-22 20:03:01 +0200
committerTao Bao <tbao@google.com>2019-05-22 20:06:26 +0200
commitfeefbf2f5698a5a56adb80a057dba0bc07050c09 (patch)
tree45ea6aa3e7a034f376969cbc45b5e0b9ab630e17
parentMerge "recovery: report compliant reboot reason" (diff)
downloadandroid_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.tar
android_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.tar.gz
android_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.tar.bz2
android_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.tar.lz
android_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.tar.xz
android_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.tar.zst
android_bootable_recovery-feefbf2f5698a5a56adb80a057dba0bc07050c09.zip
-rw-r--r--fastboot/fastboot.cpp4
-rw-r--r--otautil/include/otautil/sysutil.h4
-rw-r--r--otautil/sysutil.cpp6
-rw-r--r--recovery.cpp2
-rw-r--r--recovery_main.cpp19
-rw-r--r--recovery_ui/include/recovery_ui/device.h2
-rw-r--r--recovery_ui/ui.cpp2
7 files changed, 10 insertions, 29 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 202334997..14f5e4bdc 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -30,10 +30,10 @@
#include "recovery_ui/ui.h"
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 },
{ "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 */) {
diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h
index 326db8644..48e9011e5 100644
--- a/otautil/include/otautil/sysutil.h
+++ b/otautil/include/otautil/sysutil.h
@@ -102,11 +102,11 @@ class MemMapping {
};
// 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);
// 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
// vector, plus an additional nullptr at the end. This is a helper function that facilitates
diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp
index a8829858d..420db4cac 100644
--- a/otautil/sysutil.cpp
+++ b/otautil/sysutil.cpp
@@ -229,9 +229,9 @@ bool Reboot(std::string_view target) {
return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
}
-bool Shutdown(std::string_view target) {
- std::string cmd = "shutdown," + std::string(target);
- return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
+bool Shutdown() {
+ // "shutdown" doesn't need a "reason" arg nor a comma.
+ return android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown");
}
std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args) {
diff --git a/recovery.cpp b/recovery.cpp
index eb0c2b216..20e5a1be3 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -356,8 +356,6 @@ static Device::BuiltinAction PromptAndWait(Device* device, InstallResult status)
: device->InvokeMenuItem(chosen_item);
switch (chosen_action) {
- case Device::REBOOT_FROM_FASTBOOT: // Can not happen
- case Device::SHUTDOWN_FROM_FASTBOOT: // Can not happen
case Device::NO_ACTION:
break;
diff --git a/recovery_main.cpp b/recovery_main.cpp
index f78c1c788..aba9c5d75 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -471,12 +471,7 @@ int main(int argc, char** argv) {
switch (ret) {
case Device::SHUTDOWN:
ui->Print("Shutting down...\n");
- Shutdown("recovery");
- break;
-
- case Device::SHUTDOWN_FROM_FASTBOOT:
- ui->Print("Shutting down...\n");
- Shutdown("fastboot");
+ Shutdown();
break;
case Device::REBOOT_BOOTLOADER:
@@ -525,19 +520,9 @@ int main(int argc, char** argv) {
fastboot = false;
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:
ui->Print("Rebooting...\n");
- Reboot("unknown" + std::to_string(ret));
+ Reboot("");
break;
}
}
diff --git a/recovery_ui/include/recovery_ui/device.h b/recovery_ui/include/recovery_ui/device.h
index 9a4edf261..7c76cdb0a 100644
--- a/recovery_ui/include/recovery_ui/device.h
+++ b/recovery_ui/include/recovery_ui/device.h
@@ -58,8 +58,6 @@ class Device {
REBOOT_FASTBOOT = 17,
REBOOT_RECOVERY = 18,
REBOOT_RESCUE = 19,
- REBOOT_FROM_FASTBOOT = 20,
- SHUTDOWN_FROM_FASTBOOT = 21,
};
explicit Device(RecoveryUI* ui);
diff --git a/recovery_ui/ui.cpp b/recovery_ui/ui.cpp
index fc5177576..7ea9307c9 100644
--- a/recovery_ui/ui.cpp
+++ b/recovery_ui/ui.cpp
@@ -375,7 +375,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
case RecoveryUI::REBOOT:
if (reboot_enabled) {
- Reboot("recovery_ui");
+ Reboot("");
while (true) {
pause();
}