summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk15
-rw-r--r--common.h1
-rw-r--r--recovery.cpp226
-rw-r--r--recovery.h (renamed from private/recovery.h)7
-rw-r--r--recovery_main.cpp226
-rw-r--r--roots.cpp1
-rw-r--r--tools/recovery_l10n/res/values-as/strings.xml9
-rw-r--r--tools/recovery_l10n/res/values-en-rCA/strings.xml9
-rw-r--r--tools/recovery_l10n/res/values-en-rXC/strings.xml9
-rw-r--r--tools/recovery_l10n/res/values-or/strings.xml9
-rw-r--r--updater/install.cpp10
11 files changed, 327 insertions, 195 deletions
diff --git a/Android.mk b/Android.mk
index 214d028da..09feba289 100644
--- a/Android.mk
+++ b/Android.mk
@@ -150,7 +150,20 @@ LOCAL_CFLAGS := $(recovery_common_cflags)
LOCAL_C_INCLUDES += \
system/vold \
+# Health HAL dependency
LOCAL_STATIC_LIBRARIES := \
+ android.hardware.health@2.0-impl \
+ android.hardware.health@2.0 \
+ android.hardware.health@1.0 \
+ android.hardware.health@1.0-convert \
+ libhealthstoragedefault \
+ libhidltransport \
+ libhidlbase \
+ libhwbinder_noltopgo \
+ libvndksupport \
+ libbatterymonitor
+
+LOCAL_STATIC_LIBRARIES += \
librecovery \
$(TARGET_RECOVERY_UI_LIB) \
libbootloader_message \
@@ -174,8 +187,8 @@ LOCAL_STATIC_LIBRARIES := \
libtinyxml2 \
libziparchive \
libbase \
- libcutils \
libutils \
+ libcutils \
liblog \
libselinux \
libz \
diff --git a/common.h b/common.h
index 3dc36a960..c24431bd1 100644
--- a/common.h
+++ b/common.h
@@ -32,6 +32,7 @@ struct selabel_handle;
extern struct selabel_handle* sehandle;
extern RecoveryUI* ui;
extern bool modified_flash;
+extern bool has_cache;
// The current stage, e.g. "1/2".
extern std::string stage;
diff --git a/recovery.cpp b/recovery.cpp
index e427998a8..2360057d0 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "private/recovery.h"
+#include "recovery.h"
#include <ctype.h>
#include <dirent.h>
@@ -32,7 +32,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <time.h>
#include <unistd.h>
#include <algorithm>
@@ -49,12 +48,8 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <bootloader_message/bootloader_message.h>
-#include <cutils/android_reboot.h>
#include <cutils/properties.h> /* for property_list */
-#include <healthd/BatteryMonitor.h>
-#include <selinux/android.h>
-#include <selinux/label.h>
-#include <selinux/selinux.h>
+#include <health2/Health.h>
#include <ziparchive/zip_archive.h>
#include "adb_install.h"
@@ -70,7 +65,6 @@
#include "otautil/sysutil.h"
#include "roots.h"
#include "screen_ui.h"
-#include "stub_ui.h"
#include "ui.h"
static constexpr const char* CACHE_LOG_DIR = "/cache/recovery";
@@ -88,13 +82,9 @@ static constexpr const char* SDCARD_ROOT = "/sdcard";
// into target_files.zip. Assert the version defined in code and in Android.mk are consistent.
static_assert(kRecoveryApiVersion == RECOVERY_API_VERSION, "Mismatching recovery API versions.");
-static bool has_cache = false;
-
-RecoveryUI* ui = nullptr;
bool modified_flash = false;
std::string stage;
const char* reason = nullptr;
-struct selabel_handle* sehandle;
/*
* The recovery tool communicates with the main system through /cache files.
@@ -146,77 +136,6 @@ bool is_ro_debuggable() {
return android::base::GetBoolProperty("ro.debuggable", false);
}
-// command line args come from, in decreasing precedence:
-// - the actual command line
-// - the bootloader control block (one per line, after "recovery")
-// - the contents of COMMAND_FILE (one per line)
-static std::vector<std::string> get_args(const int argc, char** const argv) {
- CHECK_GT(argc, 0);
-
- bootloader_message boot = {};
- std::string err;
- if (!read_bootloader_message(&boot, &err)) {
- LOG(ERROR) << err;
- // If fails, leave a zeroed bootloader_message.
- boot = {};
- }
- stage = std::string(boot.stage);
-
- if (boot.command[0] != 0) {
- std::string boot_command = std::string(boot.command, sizeof(boot.command));
- LOG(INFO) << "Boot command: " << boot_command;
- }
-
- if (boot.status[0] != 0) {
- std::string boot_status = std::string(boot.status, sizeof(boot.status));
- LOG(INFO) << "Boot status: " << boot_status;
- }
-
- std::vector<std::string> args(argv, argv + argc);
-
- // --- if arguments weren't supplied, look in the bootloader control block
- if (args.size() == 1) {
- boot.recovery[sizeof(boot.recovery) - 1] = '\0'; // Ensure termination
- std::string boot_recovery(boot.recovery);
- std::vector<std::string> tokens = android::base::Split(boot_recovery, "\n");
- if (!tokens.empty() && tokens[0] == "recovery") {
- for (auto it = tokens.begin() + 1; it != tokens.end(); it++) {
- // Skip empty and '\0'-filled tokens.
- if (!it->empty() && (*it)[0] != '\0') args.push_back(std::move(*it));
- }
- LOG(INFO) << "Got " << args.size() << " arguments from boot message";
- } else if (boot.recovery[0] != 0) {
- LOG(ERROR) << "Bad boot message: \"" << boot_recovery << "\"";
- }
- }
-
- // --- if that doesn't work, try the command file (if we have /cache).
- if (args.size() == 1 && has_cache) {
- std::string content;
- if (ensure_path_mounted(COMMAND_FILE) == 0 &&
- android::base::ReadFileToString(COMMAND_FILE, &content)) {
- std::vector<std::string> tokens = android::base::Split(content, "\n");
- // All the arguments in COMMAND_FILE are needed (unlike the BCB message,
- // COMMAND_FILE doesn't use filename as the first argument).
- for (auto it = tokens.begin(); it != tokens.end(); it++) {
- // Skip empty and '\0'-filled tokens.
- if (!it->empty() && (*it)[0] != '\0') args.push_back(std::move(*it));
- }
- LOG(INFO) << "Got " << args.size() << " arguments from " << COMMAND_FILE;
- }
- }
-
- // Write the arguments (excluding the filename in args[0]) back into the
- // bootloader control block. So the device will always boot into recovery to
- // finish the pending work, until finish_recovery() is called.
- std::vector<std::string> options(args.cbegin() + 1, args.cend());
- if (!update_bootloader_message(options, &err)) {
- LOG(ERROR) << "Failed to set BCB message: " << err;
- }
-
- return args;
-}
-
// Set the BCB to reboot back into recovery (it won't resume the install from
// sdcard though).
static void set_sdcard_update_bootloader_message() {
@@ -921,21 +840,6 @@ static void print_property(const char* key, const char* name, void* /* cookie */
printf("%s=%s\n", key, name);
}
-static std::string load_locale_from_cache() {
- if (ensure_path_mounted(LOCALE_FILE) != 0) {
- LOG(ERROR) << "Can't mount " << LOCALE_FILE;
- return "";
- }
-
- std::string content;
- if (!android::base::ReadFileToString(LOCALE_FILE, &content)) {
- PLOG(ERROR) << "Can't read " << LOCALE_FILE;
- return "";
- }
-
- return android::base::Trim(content);
-}
-
void ui_print(const char* format, ...) {
std::string buffer;
va_list ap;
@@ -951,6 +855,11 @@ void ui_print(const char* format, ...) {
}
static bool is_battery_ok(int* required_battery_level) {
+ using android::hardware::health::V1_0::BatteryStatus;
+ using android::hardware::health::V2_0::Result;
+ using android::hardware::health::V2_0::toString;
+ using android::hardware::health::V2_0::implementation::Health;
+
struct healthd_config healthd_config = {
.batteryStatusPath = android::String8(android::String8::kEmptyString),
.batteryHealthPath = android::String8(android::String8::kEmptyString),
@@ -968,37 +877,52 @@ static bool is_battery_ok(int* required_battery_level) {
.boot_min_cap = 0,
.screen_on = nullptr
};
- healthd_board_init(&healthd_config);
- android::BatteryMonitor monitor;
- monitor.init(&healthd_config);
+ auto health =
+ android::hardware::health::V2_0::implementation::Health::initInstance(&healthd_config);
static constexpr int BATTERY_READ_TIMEOUT_IN_SEC = 10;
int wait_second = 0;
while (true) {
- int charge_status = monitor.getChargeStatus();
+ auto charge_status = BatteryStatus::UNKNOWN;
+ health
+ ->getChargeStatus([&charge_status](auto res, auto out_status) {
+ if (res == Result::SUCCESS) {
+ charge_status = out_status;
+ }
+ })
+ .isOk(); // should not have transport error
+
// Treat unknown status as charged.
- bool charged = (charge_status != android::BATTERY_STATUS_DISCHARGING &&
- charge_status != android::BATTERY_STATUS_NOT_CHARGING);
- android::BatteryProperty capacity;
- android::status_t status = monitor.getProperty(android::BATTERY_PROP_CAPACITY, &capacity);
- ui_print("charge_status %d, charged %d, status %d, capacity %" PRId64 "\n", charge_status,
- charged, status, capacity.valueInt64);
+ bool charged = (charge_status != BatteryStatus::DISCHARGING &&
+ charge_status != BatteryStatus::NOT_CHARGING);
+
+ Result res = Result::UNKNOWN;
+ int32_t capacity = INT32_MIN;
+ health
+ ->getCapacity([&res, &capacity](auto out_res, auto out_capacity) {
+ res = out_res;
+ capacity = out_capacity;
+ })
+ .isOk(); // should not have transport error
+
+ ui_print("charge_status %d, charged %d, status %s, capacity %" PRId32 "\n", charge_status,
+ charged, toString(res).c_str(), capacity);
// At startup, the battery drivers in devices like N5X/N6P take some time to load
// the battery profile. Before the load finishes, it reports value 50 as a fake
// capacity. BATTERY_READ_TIMEOUT_IN_SEC is set that the battery drivers are expected
// to finish loading the battery profile earlier than 10 seconds after kernel startup.
- if (status == 0 && capacity.valueInt64 == 50) {
+ if (res == Result::SUCCESS && capacity == 50) {
if (wait_second < BATTERY_READ_TIMEOUT_IN_SEC) {
sleep(1);
wait_second++;
continue;
}
}
- // If we can't read battery percentage, it may be a device without battery. In this situation,
- // use 100 as a fake battery percentage.
- if (status != 0) {
- capacity.valueInt64 = 100;
+ // If we can't read battery percentage, it may be a device without battery. In this
+ // situation, use 100 as a fake battery percentage.
+ if (res != Result::SUCCESS) {
+ capacity = 100;
}
// GmsCore enters recovery mode to install package when having enough battery percentage.
@@ -1007,7 +931,7 @@ static bool is_battery_ok(int* required_battery_level) {
static constexpr int BATTERY_OK_PERCENTAGE = 20;
static constexpr int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15;
*required_battery_level = charged ? BATTERY_WITH_CHARGER_OK_PERCENTAGE : BATTERY_OK_PERCENTAGE;
- return capacity.valueInt64 >= *required_battery_level;
+ return capacity >= *required_battery_level;
}
}
@@ -1059,15 +983,7 @@ static void log_failure_code(ErrorCode code, const std::string& update_package)
LOG(INFO) << log_content;
}
-int start_recovery(int argc, char** argv) {
- time_t start = time(nullptr);
-
- printf("Starting recovery (pid %d) on %s", getpid(), ctime(&start));
-
- load_volume_table();
- has_cache = volume_for_mount_point(CACHE_ROOT) != nullptr;
-
- std::vector<std::string> args = get_args(argc, argv);
+Device::BuiltinAction start_recovery(Device* device, const std::vector<std::string>& args) {
std::vector<char*> args_to_parse(args.size());
std::transform(args.cbegin(), args.cend(), args_to_parse.begin(),
[](const std::string& arg) { return const_cast<char*>(arg.c_str()); });
@@ -1097,7 +1013,6 @@ int start_recovery(int argc, char** argv) {
bool should_wipe_cache = false;
bool should_wipe_ab = false;
size_t wipe_package_size = 0;
- bool show_text = false;
bool sideload = false;
bool sideload_auto_reboot = false;
bool just_exit = false;
@@ -1112,7 +1027,7 @@ int start_recovery(int argc, char** argv) {
&option_index)) != -1) {
switch (arg) {
case 't':
- show_text = true;
+ // Handled in recovery_main.cpp
break;
case 'x':
just_exit = true;
@@ -1120,7 +1035,7 @@ int start_recovery(int argc, char** argv) {
case 0: {
std::string option = OPTIONS[option_index].name;
if (option == "locale") {
- locale = optarg;
+ // Handled in recovery_main.cpp
} else if (option == "prompt_and_wipe_data") {
should_prompt_and_wipe_data = true;
} else if (option == "reason") {
@@ -1155,37 +1070,9 @@ int start_recovery(int argc, char** argv) {
}
}
- if (locale.empty()) {
- if (has_cache) {
- locale = load_locale_from_cache();
- }
-
- if (locale.empty()) {
- static constexpr const char* DEFAULT_LOCALE = "en-US";
- locale = DEFAULT_LOCALE;
- }
- }
-
- printf("locale is [%s]\n", locale.c_str());
printf("stage is [%s]\n", stage.c_str());
printf("reason is [%s]\n", reason);
- Device* device = make_device();
- if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
- printf("Quiescent recovery mode.\n");
- device->ResetUI(new StubRecoveryUI());
- } else {
- if (!device->GetUI()->Init(locale)) {
- printf("Failed to initialize UI; using stub UI instead.\n");
- device->ResetUI(new StubRecoveryUI());
- }
- }
- ui = device->GetUI();
-
- if (!has_cache) {
- device->RemoveMenuItemForAction(Device::WIPE_CACHE);
- }
-
// Set background string to "installing security update" for security update,
// otherwise set it to "installing system update".
ui->SetSystemUpdateText(security_update);
@@ -1195,15 +1082,6 @@ int start_recovery(int argc, char** argv) {
ui->SetStage(st_cur, st_max);
}
- ui->SetBackground(RecoveryUI::NONE);
- if (show_text) ui->ShowText(true);
-
- sehandle = selinux_android_file_context_handle();
- selinux_android_set_sehandle(sehandle);
- if (!sehandle) {
- ui->Print("Warning: No file_contexts\n");
- }
-
device->StartRecovery();
printf("Command:");
@@ -1353,25 +1231,5 @@ int start_recovery(int argc, char** argv) {
// Save logs and clean up before rebooting or shutting down.
finish_recovery();
- switch (after) {
- case Device::SHUTDOWN:
- ui->Print("Shutting down...\n");
- android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown,");
- break;
-
- case Device::REBOOT_BOOTLOADER:
- ui->Print("Rebooting to bootloader...\n");
- android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,bootloader");
- break;
-
- default:
- ui->Print("Rebooting...\n");
- reboot("reboot,");
- break;
- }
- while (true) {
- pause();
- }
- // Should be unreachable.
- return EXIT_SUCCESS;
+ return after;
}
diff --git a/private/recovery.h b/recovery.h
index 5b2ca4b3f..00e22daa6 100644
--- a/private/recovery.h
+++ b/recovery.h
@@ -16,4 +16,9 @@
#pragma once
-int start_recovery(int argc, char** argv);
+#include <string>
+#include <vector>
+
+#include "device.h"
+
+Device::BuiltinAction start_recovery(Device* device, const std::vector<std::string>& args);
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 3147511ee..e21c782d0 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -14,22 +14,57 @@
* limitations under the License.
*/
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <linux/fs.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
#include <unistd.h>
-#include <chrono>
+#include <algorithm>
+#include <string>
+#include <vector>
+#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/properties.h>
+#include <android-base/strings.h>
+#include <bootloader_message/bootloader_message.h>
+#include <cutils/android_reboot.h>
#include <private/android_logger.h> /* private pmsg functions */
+#include <selinux/android.h>
+#include <selinux/label.h>
+#include <selinux/selinux.h>
#include "common.h"
+#include "device.h"
#include "logging.h"
#include "minadbd/minadbd.h"
#include "otautil/paths.h"
-#include "private/recovery.h"
+#include "otautil/sysutil.h"
+#include "recovery.h"
+#include "roots.h"
+#include "stub_ui.h"
#include "ui.h"
+static constexpr const char* COMMAND_FILE = "/cache/recovery/command";
+static constexpr const char* LOCALE_FILE = "/cache/recovery/last_locale";
+
+static constexpr const char* CACHE_ROOT = "/cache";
+
+bool has_cache = false;
+
+RecoveryUI* ui = nullptr;
+struct selabel_handle* sehandle;
+
static void UiLogger(android::base::LogId /* id */, android::base::LogSeverity severity,
const char* /* tag */, const char* /* file */, unsigned int /* line */,
const char* message) {
@@ -41,6 +76,92 @@ static void UiLogger(android::base::LogId /* id */, android::base::LogSeverity s
}
}
+// command line args come from, in decreasing precedence:
+// - the actual command line
+// - the bootloader control block (one per line, after "recovery")
+// - the contents of COMMAND_FILE (one per line)
+static std::vector<std::string> get_args(const int argc, char** const argv) {
+ CHECK_GT(argc, 0);
+
+ bootloader_message boot = {};
+ std::string err;
+ if (!read_bootloader_message(&boot, &err)) {
+ LOG(ERROR) << err;
+ // If fails, leave a zeroed bootloader_message.
+ boot = {};
+ }
+ stage = std::string(boot.stage);
+
+ if (boot.command[0] != 0) {
+ std::string boot_command = std::string(boot.command, sizeof(boot.command));
+ LOG(INFO) << "Boot command: " << boot_command;
+ }
+
+ if (boot.status[0] != 0) {
+ std::string boot_status = std::string(boot.status, sizeof(boot.status));
+ LOG(INFO) << "Boot status: " << boot_status;
+ }
+
+ std::vector<std::string> args(argv, argv + argc);
+
+ // --- if arguments weren't supplied, look in the bootloader control block
+ if (args.size() == 1) {
+ boot.recovery[sizeof(boot.recovery) - 1] = '\0'; // Ensure termination
+ std::string boot_recovery(boot.recovery);
+ std::vector<std::string> tokens = android::base::Split(boot_recovery, "\n");
+ if (!tokens.empty() && tokens[0] == "recovery") {
+ for (auto it = tokens.begin() + 1; it != tokens.end(); it++) {
+ // Skip empty and '\0'-filled tokens.
+ if (!it->empty() && (*it)[0] != '\0') args.push_back(std::move(*it));
+ }
+ LOG(INFO) << "Got " << args.size() << " arguments from boot message";
+ } else if (boot.recovery[0] != 0) {
+ LOG(ERROR) << "Bad boot message: \"" << boot_recovery << "\"";
+ }
+ }
+
+ // --- if that doesn't work, try the command file (if we have /cache).
+ if (args.size() == 1 && has_cache) {
+ std::string content;
+ if (ensure_path_mounted(COMMAND_FILE) == 0 &&
+ android::base::ReadFileToString(COMMAND_FILE, &content)) {
+ std::vector<std::string> tokens = android::base::Split(content, "\n");
+ // All the arguments in COMMAND_FILE are needed (unlike the BCB message,
+ // COMMAND_FILE doesn't use filename as the first argument).
+ for (auto it = tokens.begin(); it != tokens.end(); it++) {
+ // Skip empty and '\0'-filled tokens.
+ if (!it->empty() && (*it)[0] != '\0') args.push_back(std::move(*it));
+ }
+ LOG(INFO) << "Got " << args.size() << " arguments from " << COMMAND_FILE;
+ }
+ }
+
+ // Write the arguments (excluding the filename in args[0]) back into the
+ // bootloader control block. So the device will always boot into recovery to
+ // finish the pending work, until finish_recovery() is called.
+ std::vector<std::string> options(args.cbegin() + 1, args.cend());
+ if (!update_bootloader_message(options, &err)) {
+ LOG(ERROR) << "Failed to set BCB message: " << err;
+ }
+
+ return args;
+}
+
+static std::string load_locale_from_cache() {
+ if (ensure_path_mounted(LOCALE_FILE) != 0) {
+ LOG(ERROR) << "Can't mount " << LOCALE_FILE;
+ return "";
+ }
+
+ std::string content;
+ if (!android::base::ReadFileToString(LOCALE_FILE, &content)) {
+ PLOG(ERROR) << "Can't read " << LOCALE_FILE;
+ return "";
+ }
+
+ return android::base::Trim(content);
+}
+
static void redirect_stdio(const char* filename) {
int pipefd[2];
if (pipe(pipefd) == -1) {
@@ -154,9 +275,108 @@ int main(int argc, char** argv) {
return 0;
}
+ time_t start = time(nullptr);
+
// redirect_stdio should be called only in non-sideload mode. Otherwise we may have two logger
// instances with different timestamps.
redirect_stdio(Paths::Get().temporary_log_file().c_str());
- return start_recovery(argc, argv);
+ printf("Starting recovery (pid %d) on %s", getpid(), ctime(&start));
+
+ load_volume_table();
+ has_cache = volume_for_mount_point(CACHE_ROOT) != nullptr;
+
+ std::vector<std::string> args = get_args(argc, argv);
+ std::vector<char*> args_to_parse(args.size());
+ std::transform(args.cbegin(), args.cend(), args_to_parse.begin(),
+ [](const std::string& arg) { return const_cast<char*>(arg.c_str()); });
+
+ static constexpr struct option OPTIONS[] = {
+ { "locale", required_argument, nullptr, 0 },
+ { "show_text", no_argument, nullptr, 't' },
+ { nullptr, 0, nullptr, 0 },
+ };
+
+ bool show_text = false;
+ std::string locale;
+
+ int arg;
+ int option_index;
+ while ((arg = getopt_long(args_to_parse.size(), args_to_parse.data(), "", OPTIONS,
+ &option_index)) != -1) {
+ switch (arg) {
+ case 't':
+ show_text = true;
+ break;
+ case 0: {
+ std::string option = OPTIONS[option_index].name;
+ if (option == "locale") {
+ locale = optarg;
+ }
+ break;
+ }
+ }
+ }
+
+ if (locale.empty()) {
+ if (has_cache) {
+ locale = load_locale_from_cache();
+ }
+
+ if (locale.empty()) {
+ static constexpr const char* DEFAULT_LOCALE = "en-US";
+ locale = DEFAULT_LOCALE;
+ }
+ }
+
+ printf("locale is [%s]\n", locale.c_str());
+
+ Device* device = make_device();
+ if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+ printf("Quiescent recovery mode.\n");
+ device->ResetUI(new StubRecoveryUI());
+ } else {
+ if (!device->GetUI()->Init(locale)) {
+ printf("Failed to initialize UI; using stub UI instead.\n");
+ device->ResetUI(new StubRecoveryUI());
+ }
+ }
+ ui = device->GetUI();
+
+ if (!has_cache) {
+ device->RemoveMenuItemForAction(Device::WIPE_CACHE);
+ }
+
+ ui->SetBackground(RecoveryUI::NONE);
+ if (show_text) ui->ShowText(true);
+
+ sehandle = selinux_android_file_context_handle();
+ selinux_android_set_sehandle(sehandle);
+ if (!sehandle) {
+ ui->Print("Warning: No file_contexts\n");
+ }
+
+ Device::BuiltinAction after = start_recovery(device, args);
+
+ switch (after) {
+ case Device::SHUTDOWN:
+ ui->Print("Shutting down...\n");
+ android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown,");
+ break;
+
+ case Device::REBOOT_BOOTLOADER:
+ ui->Print("Rebooting to bootloader...\n");
+ android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,bootloader");
+ break;
+
+ default:
+ ui->Print("Rebooting...\n");
+ reboot("reboot,");
+ break;
+ }
+ while (true) {
+ pause();
+ }
+ // Should be unreachable.
+ return EXIT_SUCCESS;
}
diff --git a/roots.cpp b/roots.cpp
index 26ebf1fbe..3c811dfed 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -333,6 +333,7 @@ int format_volume(const char* volume, const char* directory) {
"-f",
"-O", "encrypt",
"-O", "quota",
+ "-O", "verity",
"-w", std::to_string(kSectorSize),
v->blk_device,
};
diff --git a/tools/recovery_l10n/res/values-as/strings.xml b/tools/recovery_l10n/res/values-as/strings.xml
new file mode 100644
index 000000000..2624cebe4
--- /dev/null
+++ b/tools/recovery_l10n/res/values-as/strings.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="recovery_installing" msgid="2013591905463558223">"আপডেইট ইনষ্টল কৰি থকা হৈছে"</string>
+ <string name="recovery_erasing" msgid="7334826894904037088">"মচি থকা হৈছে"</string>
+ <string name="recovery_no_command" msgid="4465476568623024327">"কোনো আদেশ নাই"</string>
+ <string name="recovery_error" msgid="5748178989622716736">"ত্ৰুটি!"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"সুৰক্ষা আপডেইট ইনষ্টল কৰি থকা হৈছে"</string>
+</resources>
diff --git a/tools/recovery_l10n/res/values-en-rCA/strings.xml b/tools/recovery_l10n/res/values-en-rCA/strings.xml
new file mode 100644
index 000000000..dc75c2374
--- /dev/null
+++ b/tools/recovery_l10n/res/values-en-rCA/strings.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="recovery_installing" msgid="2013591905463558223">"Installing system update"</string>
+ <string name="recovery_erasing" msgid="7334826894904037088">"Erasing"</string>
+ <string name="recovery_no_command" msgid="4465476568623024327">"No command"</string>
+ <string name="recovery_error" msgid="5748178989622716736">"Error!"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"Installing security update"</string>
+</resources>
diff --git a/tools/recovery_l10n/res/values-en-rXC/strings.xml b/tools/recovery_l10n/res/values-en-rXC/strings.xml
new file mode 100644
index 000000000..2d528b3fb
--- /dev/null
+++ b/tools/recovery_l10n/res/values-en-rXC/strings.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="recovery_installing" msgid="2013591905463558223">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‎‏‏‏‏‏‏‎‎‎‏‏‎‏‏‎‏‏‏‎‎‏‎‏‎‏‏‎‏‏‎‎‏‏‏‏‏‎‎‎‎‎‏‏‏‏‎‎‎‎‎‎‏‎‎‏‏‏‏‎Installing system update‎‏‎‎‏‎"</string>
+ <string name="recovery_erasing" msgid="7334826894904037088">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‏‎‏‏‏‎‎‏‎‏‎‏‎‎‎‏‎‏‎‎‎‏‏‎‎‏‏‎‎‎‎‎‏‏‏‏‎‏‏‏‏‎‎‏‎‎‎‏‏‏‎‏‏‏‎‎‎‎‎‎Erasing‎‏‎‎‏‎"</string>
+ <string name="recovery_no_command" msgid="4465476568623024327">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‏‎‏‏‏‏‏‏‎‎‎‏‎‎‎‏‏‏‏‎‏‎‎‎‏‏‏‏‎‏‏‎‎‎‏‏‎‎‏‏‎‏‏‎‎‎‎‏‎‎‎‏‏‎‎‎‏‏‏‎No command‎‏‎‎‏‎"</string>
+ <string name="recovery_error" msgid="5748178989622716736">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‎‏‏‏‏‏‏‎‎‎‏‎‏‏‎‏‎‎‎‏‎‎‏‎‏‎‏‎‏‏‏‏‏‏‏‎‏‏‏‎‏‎‎‏‏‎‏‏‎‏‎‎‏‎‏‎‎‎‎‎‎‎Error!‎‏‎‎‏‎"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‏‏‏‏‎‏‏‏‎‏‎‎‎‎‏‏‏‎‏‏‏‏‎‎‏‏‏‎‏‏‎‏‏‎‎‏‏‎‏‏‎‏‎‏‎‎‏‎‏‎‎‏‏‏‏‎‎‏‏‎‎Installing security update‎‏‎‎‏‎"</string>
+</resources>
diff --git a/tools/recovery_l10n/res/values-or/strings.xml b/tools/recovery_l10n/res/values-or/strings.xml
new file mode 100644
index 000000000..2b0851cdd
--- /dev/null
+++ b/tools/recovery_l10n/res/values-or/strings.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="recovery_installing" msgid="2013591905463558223">"ସିଷ୍ଟମ ଅପଡେଟ ଇନଷ୍ଟଲ କରୁଛି"</string>
+ <string name="recovery_erasing" msgid="7334826894904037088">"ଲିଭାଉଛି"</string>
+ <string name="recovery_no_command" msgid="4465476568623024327">"କୌଣସି କମାଣ୍ଡ ନାହିଁ"</string>
+ <string name="recovery_error" msgid="5748178989622716736">"ତ୍ରୁଟି!"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"ସୁରକ୍ଷା ଅପ୍‌ଡେଟ୍‌ ଇନ୍‌ଷ୍ଟଲ୍‌ କରୁଛି"</string>
+</resources>
diff --git a/updater/install.cpp b/updater/install.cpp
index bd22467ab..dfd2dc3ae 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -544,12 +544,10 @@ Value* FormatFn(const char* name, State* state, const std::vector<std::unique_pt
const char* f2fs_argv[] = { "mkfs.f2fs",
"-d1",
"-f",
- "-O",
- "encrypt",
- "-O",
- "quota",
- "-w",
- "512",
+ "-O", "encrypt",
+ "-O", "quota",
+ "-O", "verity",
+ "-w", "512",
location.c_str(),
(size < 512) ? nullptr : num_sectors.c_str(),
nullptr };