aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deymo2016-08-03 23:03:53 -0500
committerAlex Deymo2016-08-11 20:55:11 -0500
commit4344d636d4f8687054593f88ddd7509ff8581419 (patch)
tree649779ffef3d413eadb67d85419056c1d9ef4752 /device.cpp
parente49c0d6406dcce19bdcf81d635b3449004f44c7e (diff)
downloadplatform-bootable-recovery-4344d636d4f8687054593f88ddd7509ff8581419.tar.gz
platform-bootable-recovery-4344d636d4f8687054593f88ddd7509ff8581419.tar.xz
platform-bootable-recovery-4344d636d4f8687054593f88ddd7509ff8581419.zip
Call update_engine_sideload from recovery.
This patch enables sideloading an OTA on A/B devices while running from recovery. Recovery accepts the same OTA package format as recent versions of GMS, which consists of .zip file with the payload in it. Bug: 27178350 TEST=`adb sideload` successfully a full OTA (*) TEST=Failed to take several invalid payloads (wrong product, fingerprint, update type, serial, etc). <small>(*) with no postinstall script.</small> Change-Id: I951869340100feb5a37e41fac0ee59c10095659e
Diffstat (limited to 'device.cpp')
-rw-r--r--device.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/device.cpp b/device.cpp
index f8fbb8a4..e717dddf 100644
--- a/device.cpp
+++ b/device.cpp
@@ -16,36 +16,15 @@
16 16
17#include "device.h" 17#include "device.h"
18 18
19#if defined(AB_OTA_UPDATER)
20
21static const char* MENU_ITEMS[] = {
22 "Reboot system now",
23 "Reboot to bootloader",
24 "Wipe data/factory reset",
25 "Mount /system",
26 "Run graphics test",
27 "Power off",
28 NULL,
29};
30
31static const Device::BuiltinAction MENU_ACTIONS[] = {
32 Device::REBOOT,
33 Device::REBOOT_BOOTLOADER,
34 Device::WIPE_DATA,
35 Device::MOUNT_SYSTEM,
36 Device::RUN_GRAPHICS_TEST,
37 Device::SHUTDOWN,
38};
39
40#else
41
42static const char* MENU_ITEMS[] = { 19static const char* MENU_ITEMS[] = {
43 "Reboot system now", 20 "Reboot system now",
44 "Reboot to bootloader", 21 "Reboot to bootloader",
45 "Apply update from ADB", 22 "Apply update from ADB",
46 "Apply update from SD card", 23 "Apply update from SD card",
47 "Wipe data/factory reset", 24 "Wipe data/factory reset",
25#ifndef AB_OTA_UPDATER
48 "Wipe cache partition", 26 "Wipe cache partition",
27#endif // !AB_OTA_UPDATER
49 "Mount /system", 28 "Mount /system",
50 "View recovery logs", 29 "View recovery logs",
51 "Run graphics test", 30 "Run graphics test",
@@ -59,14 +38,19 @@ static const Device::BuiltinAction MENU_ACTIONS[] = {
59 Device::APPLY_ADB_SIDELOAD, 38 Device::APPLY_ADB_SIDELOAD,
60 Device::APPLY_SDCARD, 39 Device::APPLY_SDCARD,
61 Device::WIPE_DATA, 40 Device::WIPE_DATA,
41#ifndef AB_OTA_UPDATER
62 Device::WIPE_CACHE, 42 Device::WIPE_CACHE,
43#endif // !AB_OTA_UPDATER
63 Device::MOUNT_SYSTEM, 44 Device::MOUNT_SYSTEM,
64 Device::VIEW_RECOVERY_LOGS, 45 Device::VIEW_RECOVERY_LOGS,
65 Device::RUN_GRAPHICS_TEST, 46 Device::RUN_GRAPHICS_TEST,
66 Device::SHUTDOWN, 47 Device::SHUTDOWN,
67}; 48};
68 49
69#endif 50static_assert(sizeof(MENU_ITEMS) / sizeof(MENU_ITEMS[0]) ==
51 sizeof(MENU_ACTIONS) / sizeof(MENU_ACTIONS[0]) + 1,
52 "MENU_ITEMS and MENU_ACTIONS should have the same length, "
53 "except for the extra NULL entry in MENU_ITEMS.");
70 54
71const char* const* Device::GetMenuItems() { 55const char* const* Device::GetMenuItems() {
72 return MENU_ITEMS; 56 return MENU_ITEMS;