summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.bp3
-rw-r--r--TEST_MAPPING17
-rw-r--r--fsck_unshare_blocks.cpp1
-rw-r--r--install/Android.bp2
-rw-r--r--install/adb_install.cpp47
-rw-r--r--install/include/install/adb_install.h3
-rw-r--r--install/include/install/install.h3
-rw-r--r--install/include/install/wipe_device.h29
-rw-r--r--install/wipe_device.cpp198
-rw-r--r--minadbd/minadbd_services.cpp46
-rw-r--r--minadbd/minadbd_services_test.cpp2
-rw-r--r--minadbd/minadbd_types.h4
-rw-r--r--minui/resources.cpp18
-rw-r--r--otautil/Android.bp4
-rw-r--r--recovery.cpp191
-rw-r--r--recovery_main.cpp33
-rw-r--r--recovery_ui/include/recovery_ui/device.h11
-rw-r--r--recovery_ui/include/recovery_ui/ui.h2
-rw-r--r--recovery_ui/screen_ui.cpp20
-rw-r--r--tests/Android.bp2
-rw-r--r--tests/AndroidTest.xml33
-rw-r--r--tests/component/install_test.cpp1
-rw-r--r--tests/unit/locale_test.cpp4
-rw-r--r--tools/recovery_l10n/res/values-gl/strings.xml4
-rw-r--r--tools/recovery_l10n/res/values-ja/strings.xml2
25 files changed, 418 insertions, 262 deletions
diff --git a/Android.bp b/Android.bp
index f92078256..0eb5fd9e5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -76,7 +76,6 @@ cc_defaults {
// external dependencies
"libhealthhalutils",
- "libfstab",
],
}
@@ -150,7 +149,6 @@ cc_binary {
static_libs: [
"libotautil",
- "libfstab",
],
init_rc: [
@@ -177,7 +175,6 @@ cc_binary {
static_libs: [
"libotautil",
- "libfstab",
],
init_rc: [
diff --git a/TEST_MAPPING b/TEST_MAPPING
new file mode 100644
index 000000000..c87ece24e
--- /dev/null
+++ b/TEST_MAPPING
@@ -0,0 +1,17 @@
+{
+ "presubmit": [
+ {
+ "name": "minadbd_test"
+ },
+ {
+ "name": "recovery_unit_test"
+ },
+ {
+ "name": "recovery_component_test"
+ },
+ {
+ "name": "recovery_host_test",
+ "host": true
+ }
+ ]
+}
diff --git a/fsck_unshare_blocks.cpp b/fsck_unshare_blocks.cpp
index e74f8ba6f..0f8ffface 100644
--- a/fsck_unshare_blocks.cpp
+++ b/fsck_unshare_blocks.cpp
@@ -34,7 +34,6 @@
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
-#include <fstab/fstab.h>
#include "otautil/roots.h"
diff --git a/install/Android.bp b/install/Android.bp
index ea893a075..4696e501e 100644
--- a/install/Android.bp
+++ b/install/Android.bp
@@ -47,7 +47,6 @@ cc_defaults {
// external dependencies
"libvintf_recovery",
"libvintf",
- "libfstab",
],
}
@@ -67,6 +66,7 @@ cc_library_static {
"package.cpp",
"verifier.cpp",
"wipe_data.cpp",
+ "wipe_device.cpp",
],
shared_libs: [
diff --git a/install/adb_install.cpp b/install/adb_install.cpp
index d79f6f4b0..4dd1f1b09 100644
--- a/install/adb_install.cpp
+++ b/install/adb_install.cpp
@@ -43,6 +43,7 @@
#include "fuse_sideload.h"
#include "install/install.h"
+#include "install/wipe_data.h"
#include "minadbd_types.h"
#include "otautil/sysutil.h"
#include "recovery_ui/device.h"
@@ -121,19 +122,20 @@ static auto AdbInstallPackageHandler(RecoveryUI* ui, int* result) {
static auto AdbRebootHandler(MinadbdCommand command, int* result,
Device::BuiltinAction* reboot_action) {
+ // Use Device::REBOOT_{FASTBOOT,RECOVERY,RESCUE}, instead of the ones with ENTER_. This allows
+ // rebooting back into fastboot/recovery/rescue mode through bootloader, which may use a newly
+ // installed bootloader/recovery image.
switch (command) {
case MinadbdCommand::kRebootBootloader:
*reboot_action = Device::REBOOT_BOOTLOADER;
break;
case MinadbdCommand::kRebootFastboot:
- *reboot_action = Device::ENTER_FASTBOOT;
+ *reboot_action = Device::REBOOT_FASTBOOT;
break;
case MinadbdCommand::kRebootRecovery:
- *reboot_action = Device::ENTER_RECOVERY;
+ *reboot_action = Device::REBOOT_RECOVERY;
break;
case MinadbdCommand::kRebootRescue:
- // Use Device::REBOOT_RESCUE instead of Device::ENTER_RESCUE. This allows rebooting back into
- // rescue mode (potentially using a newly installed recovery image).
*reboot_action = Device::REBOOT_RESCUE;
break;
case MinadbdCommand::kRebootAndroid:
@@ -180,7 +182,7 @@ static bool HandleMessageFromMinadbd(int socket_fd,
// TODO(xunchang) add a wrapper function and kill the minadbd service there.
static void ListenAndExecuteMinadbdCommands(
- pid_t minadbd_pid, android::base::unique_fd&& socket_fd,
+ RecoveryUI* ui, pid_t minadbd_pid, android::base::unique_fd&& socket_fd,
const std::map<MinadbdCommand, CommandFunction>& command_map) {
android::base::unique_fd epoll_fd(epoll_create1(O_CLOEXEC));
if (epoll_fd == -1) {
@@ -203,6 +205,10 @@ static void ListenAndExecuteMinadbdCommands(
// Set the timeout to be 300s when waiting for minadbd commands.
constexpr int TIMEOUT_MILLIS = 300 * 1000;
while (true) {
+ // Reset the progress bar and the background image before each command.
+ ui->SetProgressType(RecoveryUI::EMPTY);
+ ui->SetBackground(RecoveryUI::NO_COMMAND);
+
// Poll for the status change of the socket_fd, and handle the message if the fd is ready to
// read.
int event_count =
@@ -266,7 +272,8 @@ static void ListenAndExecuteMinadbdCommands(
// b11. exit the listening loop
//
static void CreateMinadbdServiceAndExecuteCommands(
- const std::map<MinadbdCommand, CommandFunction>& command_map, bool rescue_mode) {
+ RecoveryUI* ui, const std::map<MinadbdCommand, CommandFunction>& command_map,
+ bool rescue_mode) {
signal(SIGPIPE, SIG_IGN);
android::base::unique_fd recovery_socket;
@@ -305,8 +312,8 @@ static void CreateMinadbdServiceAndExecuteCommands(
return;
}
- std::thread listener_thread(ListenAndExecuteMinadbdCommands, child, std::move(recovery_socket),
- std::ref(command_map));
+ std::thread listener_thread(ListenAndExecuteMinadbdCommands, ui, child,
+ std::move(recovery_socket), std::ref(command_map));
if (listener_thread.joinable()) {
listener_thread.join();
}
@@ -324,7 +331,7 @@ static void CreateMinadbdServiceAndExecuteCommands(
signal(SIGPIPE, SIG_DFL);
}
-int ApplyFromAdb(RecoveryUI* ui, bool rescue_mode, Device::BuiltinAction* reboot_action) {
+int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action) {
// Save the usb state to restore after the sideload operation.
std::string usb_state = android::base::GetProperty("sys.usb.state", "none");
// Clean up state and stop adbd.
@@ -333,13 +340,7 @@ int ApplyFromAdb(RecoveryUI* ui, bool rescue_mode, Device::BuiltinAction* reboot
return INSTALL_ERROR;
}
- if (!rescue_mode) {
- ui->Print(
- "\n\nNow send the package you want to apply\n"
- "to the device with \"adb sideload <filename>\"...\n");
- } else {
- ui->Print("\n\nWaiting for rescue commands...\n");
- }
+ RecoveryUI* ui = device->GetUI();
int install_result = INSTALL_ERROR;
std::map<MinadbdCommand, CommandFunction> command_map{
@@ -357,7 +358,19 @@ int ApplyFromAdb(RecoveryUI* ui, bool rescue_mode, Device::BuiltinAction* reboot
std::bind(&AdbRebootHandler, MinadbdCommand::kRebootRescue, &install_result, reboot_action) },
};
- CreateMinadbdServiceAndExecuteCommands(command_map, rescue_mode);
+ if (!rescue_mode) {
+ ui->Print(
+ "\n\nNow send the package you want to apply\n"
+ "to the device with \"adb sideload <filename>\"...\n");
+ } else {
+ ui->Print("\n\nWaiting for rescue commands...\n");
+ command_map.emplace(MinadbdCommand::kWipeData, [&device]() {
+ bool result = WipeData(device, false);
+ return std::make_pair(result, true);
+ });
+ }
+
+ CreateMinadbdServiceAndExecuteCommands(ui, command_map, rescue_mode);
// Clean up before switching to the older state, for example setting the state
// to none sets sys/class/android_usb/android0/enable to 0.
diff --git a/install/include/install/adb_install.h b/install/include/install/adb_install.h
index 49b32b54f..3a0a81747 100644
--- a/install/include/install/adb_install.h
+++ b/install/include/install/adb_install.h
@@ -17,9 +17,8 @@
#pragma once
#include <recovery_ui/device.h>
-#include <recovery_ui/ui.h>
// Applies a package via `adb sideload` or `adb rescue`. Returns the install result (in `enum
// InstallResult`). When a reboot has been requested, INSTALL_REBOOT will be the return value, with
// the reboot target set in reboot_action.
-int ApplyFromAdb(RecoveryUI* ui, bool rescue_mode, Device::BuiltinAction* reboot_action);
+int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action);
diff --git a/install/include/install/install.h b/install/include/install/install.h
index c0a8f1f4c..d90c20f3a 100644
--- a/install/include/install/install.h
+++ b/install/include/install/install.h
@@ -58,9 +58,6 @@ bool verify_package(Package* package, RecoveryUI* ui);
// result to |metadata|. Return true if succeed, otherwise return false.
bool ReadMetadataFromPackage(ZipArchiveHandle zip, std::map<std::string, std::string>* metadata);
-// Reads the "recovery.wipe" entry in the zip archive returns a list of partitions to wipe.
-std::vector<std::string> GetWipePartitionList(Package* wipe_package);
-
// Verifies the compatibility info in a Treble-compatible package. Returns true directly if the
// entry doesn't exist.
bool verify_package_compatibility(ZipArchiveHandle package_zip);
diff --git a/install/include/install/wipe_device.h b/install/include/install/wipe_device.h
new file mode 100644
index 000000000..c60b99997
--- /dev/null
+++ b/install/include/install/wipe_device.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "install/package.h"
+#include "recovery_ui/device.h"
+
+// Wipes the current A/B device, with a secure wipe of all the partitions in RECOVERY_WIPE.
+bool WipeAbDevice(Device* device, size_t wipe_package_size);
+
+// Reads the "recovery.wipe" entry in the zip archive returns a list of partitions to wipe.
+std::vector<std::string> GetWipePartitionList(Package* wipe_package);
diff --git a/install/wipe_device.cpp b/install/wipe_device.cpp
new file mode 100644
index 000000000..72b96f7b4
--- /dev/null
+++ b/install/wipe_device.cpp
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "install/wipe_device.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/fs.h>
+#include <stdint.h>
+#include <sys/ioctl.h>
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/strings.h>
+#include <android-base/unique_fd.h>
+#include <ziparchive/zip_archive.h>
+
+#include "bootloader_message/bootloader_message.h"
+#include "install/install.h"
+#include "install/package.h"
+#include "recovery_ui/device.h"
+#include "recovery_ui/ui.h"
+
+std::vector<std::string> GetWipePartitionList(Package* wipe_package) {
+ ZipArchiveHandle zip = wipe_package->GetZipArchiveHandle();
+ if (!zip) {
+ LOG(ERROR) << "Failed to get ZipArchiveHandle";
+ return {};
+ }
+
+ constexpr char RECOVERY_WIPE_ENTRY_NAME[] = "recovery.wipe";
+
+ std::string partition_list_content;
+ ZipString path(RECOVERY_WIPE_ENTRY_NAME);
+ ZipEntry entry;
+ if (FindEntry(zip, path, &entry) == 0) {
+ uint32_t length = entry.uncompressed_length;
+ partition_list_content = std::string(length, '\0');
+ if (auto err = ExtractToMemory(
+ zip, &entry, reinterpret_cast<uint8_t*>(partition_list_content.data()), length);
+ err != 0) {
+ LOG(ERROR) << "Failed to extract " << RECOVERY_WIPE_ENTRY_NAME << ": "
+ << ErrorCodeString(err);
+ return {};
+ }
+ } else {
+ LOG(INFO) << "Failed to find " << RECOVERY_WIPE_ENTRY_NAME
+ << ", falling back to use the partition list on device.";
+
+ constexpr char RECOVERY_WIPE_ON_DEVICE[] = "/etc/recovery.wipe";
+ if (!android::base::ReadFileToString(RECOVERY_WIPE_ON_DEVICE, &partition_list_content)) {
+ PLOG(ERROR) << "failed to read \"" << RECOVERY_WIPE_ON_DEVICE << "\"";
+ return {};
+ }
+ }
+
+ std::vector<std::string> result;
+ auto lines = android::base::Split(partition_list_content, "\n");
+ for (const auto& line : lines) {
+ auto partition = android::base::Trim(line);
+ // Ignore '#' comment or empty lines.
+ if (android::base::StartsWith(partition, "#") || partition.empty()) {
+ continue;
+ }
+ result.push_back(line);
+ }
+
+ return result;
+}
+
+// Secure-wipes a given partition. It uses BLKSECDISCARD, if supported. Otherwise, it goes with
+// BLKDISCARD (if device supports BLKDISCARDZEROES) or BLKZEROOUT.
+static bool SecureWipePartition(const std::string& partition) {
+ android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(partition.c_str(), O_WRONLY)));
+ if (fd == -1) {
+ PLOG(ERROR) << "Failed to open \"" << partition << "\"";
+ return false;
+ }
+
+ uint64_t range[2] = { 0, 0 };
+ if (ioctl(fd, BLKGETSIZE64, &range[1]) == -1 || range[1] == 0) {
+ PLOG(ERROR) << "Failed to get partition size";
+ return false;
+ }
+ LOG(INFO) << "Secure-wiping \"" << partition << "\" from " << range[0] << " to " << range[1];
+
+ LOG(INFO) << " Trying BLKSECDISCARD...";
+ if (ioctl(fd, BLKSECDISCARD, &range) == -1) {
+ PLOG(WARNING) << " Failed";
+
+ // Use BLKDISCARD if it zeroes out blocks, otherwise use BLKZEROOUT.
+ unsigned int zeroes;
+ if (ioctl(fd, BLKDISCARDZEROES, &zeroes) == 0 && zeroes != 0) {
+ LOG(INFO) << " Trying BLKDISCARD...";
+ if (ioctl(fd, BLKDISCARD, &range) == -1) {
+ PLOG(ERROR) << " Failed";
+ return false;
+ }
+ } else {
+ LOG(INFO) << " Trying BLKZEROOUT...";
+ if (ioctl(fd, BLKZEROOUT, &range) == -1) {
+ PLOG(ERROR) << " Failed";
+ return false;
+ }
+ }
+ }
+
+ LOG(INFO) << " Done";
+ return true;
+}
+
+static std::unique_ptr<Package> ReadWipePackage(size_t wipe_package_size) {
+ if (wipe_package_size == 0) {
+ LOG(ERROR) << "wipe_package_size is zero";
+ return nullptr;
+ }
+
+ std::string wipe_package;
+ if (std::string err_str; !read_wipe_package(&wipe_package, wipe_package_size, &err_str)) {
+ PLOG(ERROR) << "Failed to read wipe package" << err_str;
+ return nullptr;
+ }
+
+ return Package::CreateMemoryPackage(
+ std::vector<uint8_t>(wipe_package.begin(), wipe_package.end()), nullptr);
+}
+
+// Checks if the wipe package matches expectation. If the check passes, reads the list of
+// partitions to wipe from the package. Checks include
+// 1. verify the package.
+// 2. check metadata (ota-type, pre-device and serial number if having one).
+static bool CheckWipePackage(Package* wipe_package, RecoveryUI* ui) {
+ if (!verify_package(wipe_package, ui)) {
+ LOG(ERROR) << "Failed to verify package";
+ return false;
+ }
+
+ ZipArchiveHandle zip = wipe_package->GetZipArchiveHandle();
+ if (!zip) {
+ LOG(ERROR) << "Failed to get ZipArchiveHandle";
+ return false;
+ }
+
+ std::map<std::string, std::string> metadata;
+ if (!ReadMetadataFromPackage(zip, &metadata)) {
+ LOG(ERROR) << "Failed to parse metadata in the zip file";
+ return false;
+ }
+
+ return CheckPackageMetadata(metadata, OtaType::BRICK) == 0;
+}
+
+bool WipeAbDevice(Device* device, size_t wipe_package_size) {
+ auto ui = device->GetUI();
+ ui->SetBackground(RecoveryUI::ERASING);
+ ui->SetProgressType(RecoveryUI::INDETERMINATE);
+
+ auto wipe_package = ReadWipePackage(wipe_package_size);
+ if (!wipe_package) {
+ LOG(ERROR) << "Failed to open wipe package";
+ return false;
+ }
+
+ if (!CheckWipePackage(wipe_package.get(), ui)) {
+ LOG(ERROR) << "Failed to verify wipe package";
+ return false;
+ }
+
+ auto partition_list = GetWipePartitionList(wipe_package.get());
+ if (partition_list.empty()) {
+ LOG(ERROR) << "Empty wipe ab partition list";
+ return false;
+ }
+
+ for (const auto& partition : partition_list) {
+ // Proceed anyway even if it fails to wipe some partition.
+ SecureWipePartition(partition);
+ }
+ return true;
+}
diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp
index 9b1999d90..1c4c0f494 100644
--- a/minadbd/minadbd_services.cpp
+++ b/minadbd/minadbd_services.cpp
@@ -104,7 +104,7 @@ static MinadbdErrorCode RunAdbFuseSideload(int sfd, const std::string& args,
if (pieces.size() != 2 || !android::base::ParseInt(pieces[0], &file_size) || file_size <= 0 ||
!android::base::ParseInt(pieces[1], &block_size) || block_size <= 0) {
LOG(ERROR) << "bad sideload-host arguments: " << args;
- return kMinadbdPackageSizeError;
+ return kMinadbdHostCommandArgumentError;
}
LOG(INFO) << "sideload-host file size " << file_size << ", block size " << block_size;
@@ -124,17 +124,17 @@ static MinadbdErrorCode RunAdbFuseSideload(int sfd, const std::string& args,
return kMinadbdMessageFormatError;
}
- // Signal host-side adb to stop. For sideload mode, we always send kSideloadServiceExitSuccess
+ // Signal host-side adb to stop. For sideload mode, we always send kMinadbdServicesExitSuccess
// (i.e. "DONEDONE") regardless of the install result. For rescue mode, we send failure message on
// install error.
if (!rescue_mode || *status == MinadbdCommandStatus::kSuccess) {
- if (!android::base::WriteFully(sfd, kSideloadServiceExitSuccess,
- strlen(kSideloadServiceExitSuccess))) {
+ if (!android::base::WriteFully(sfd, kMinadbdServicesExitSuccess,
+ strlen(kMinadbdServicesExitSuccess))) {
return kMinadbdHostSocketIOError;
}
} else {
- if (!android::base::WriteFully(sfd, kSideloadServiceExitFailure,
- strlen(kSideloadServiceExitFailure))) {
+ if (!android::base::WriteFully(sfd, kMinadbdServicesExitFailure,
+ strlen(kMinadbdServicesExitFailure))) {
return kMinadbdHostSocketIOError;
}
}
@@ -200,6 +200,34 @@ static void RebootHostService(unique_fd /* sfd */, const std::string& target) {
}
}
+static void WipeDeviceService(unique_fd fd, const std::string& args) {
+ auto pieces = android::base::Split(args, ":");
+ if (pieces.size() != 2 || pieces[0] != "userdata") {
+ LOG(ERROR) << "Failed to parse wipe device command arguments " << args;
+ exit(kMinadbdHostCommandArgumentError);
+ }
+
+ size_t message_size;
+ if (!android::base::ParseUint(pieces[1], &message_size) ||
+ message_size < strlen(kMinadbdServicesExitSuccess)) {
+ LOG(ERROR) << "Failed to parse wipe device message size in " << args;
+ exit(kMinadbdHostCommandArgumentError);
+ }
+
+ WriteCommandToFd(MinadbdCommand::kWipeData, minadbd_socket);
+ MinadbdCommandStatus status;
+ if (!WaitForCommandStatus(minadbd_socket, &status)) {
+ exit(kMinadbdMessageFormatError);
+ }
+
+ std::string response = (status == MinadbdCommandStatus::kSuccess) ? kMinadbdServicesExitSuccess
+ : kMinadbdServicesExitFailure;
+ response += std::string(message_size - response.size(), '\0');
+ if (!android::base::WriteFully(fd, response.c_str(), response.size())) {
+ exit(kMinadbdHostSocketIOError);
+ }
+}
+
unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport */) {
// Common services that are supported both in sideload and rescue modes.
if (ConsumePrefix(&name, "reboot:")) {
@@ -225,7 +253,13 @@ unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport *
std::string args(name);
return create_service_thread(
"rescue-getprop", std::bind(RescueGetpropHostService, std::placeholders::_1, args));
+ } else if (ConsumePrefix(&name, "rescue-wipe:")) {
+ // rescue-wipe:target:<message-size>
+ std::string args(name);
+ return create_service_thread("rescue-wipe",
+ std::bind(WipeDeviceService, std::placeholders::_1, args));
}
+
return unique_fd{};
}
diff --git a/minadbd/minadbd_services_test.cpp b/minadbd/minadbd_services_test.cpp
index 593180bb3..f87873792 100644
--- a/minadbd/minadbd_services_test.cpp
+++ b/minadbd/minadbd_services_test.cpp
@@ -122,7 +122,7 @@ class MinadbdServicesTest : public ::testing::Test {
TEST_F(MinadbdServicesTest, SideloadHostService_wrong_size_argument) {
ASSERT_EXIT(ExecuteCommandAndWaitForExit("sideload-host:abc:4096"),
- ::testing::ExitedWithCode(kMinadbdPackageSizeError), "");
+ ::testing::ExitedWithCode(kMinadbdHostCommandArgumentError), "");
}
TEST_F(MinadbdServicesTest, SideloadHostService_wrong_block_size) {
diff --git a/minadbd/minadbd_types.h b/minadbd/minadbd_types.h
index b370b7952..99fd45e83 100644
--- a/minadbd/minadbd_types.h
+++ b/minadbd/minadbd_types.h
@@ -30,7 +30,7 @@ enum MinadbdErrorCode : int {
kMinadbdSocketIOError = 2,
kMinadbdMessageFormatError = 3,
kMinadbdAdbVersionError = 4,
- kMinadbdPackageSizeError = 5,
+ kMinadbdHostCommandArgumentError = 5,
kMinadbdFuseStartError = 6,
kMinadbdUnsupportedCommandError = 7,
kMinadbdCommandExecutionError = 8,
@@ -51,6 +51,8 @@ enum class MinadbdCommand : uint32_t {
kRebootFastboot = 4,
kRebootRecovery = 5,
kRebootRescue = 6,
+ kWipeCache = 7,
+ kWipeData = 8,
// Last but invalid command.
kError,
diff --git a/minui/resources.cpp b/minui/resources.cpp
index 069a49529..00d36d5fb 100644
--- a/minui/resources.cpp
+++ b/minui/resources.cpp
@@ -347,6 +347,10 @@ bool matches_locale(const std::string& prefix, const std::string& locale) {
// match the locale string without the {script} section.
// For instance, prefix == "en" matches locale == "en-US", prefix == "sr-Latn" matches locale
// == "sr-Latn-BA", and prefix == "zh-CN" matches locale == "zh-Hans-CN".
+ if (prefix.empty()) {
+ return false;
+ }
+
if (android::base::StartsWith(locale, prefix)) {
return true;
}
@@ -414,12 +418,18 @@ int res_create_localized_alpha_surface(const char* name,
__unused int len = row[4];
char* loc = reinterpret_cast<char*>(&row[5]);
- if (y + 1 + h >= height || matches_locale(loc, locale)) {
+ // We need to include one additional line for the metadata of the localized image.
+ if (y + 1 + h > height) {
+ printf("Read exceeds the image boundary, y %u, h %d, height %u\n", y, h, height);
+ return -8;
+ }
+
+ if (matches_locale(loc, locale)) {
printf(" %20s: %s (%d x %d @ %d)\n", name, loc, w, h, y);
auto surface = GRSurface::Create(w, h, w, 1);
if (!surface) {
- return -8;
+ return -9;
}
for (int i = 0; i < h; ++i, ++y) {
@@ -428,7 +438,7 @@ int res_create_localized_alpha_surface(const char* name,
}
*pSurface = surface.release();
- break;
+ return 0;
}
for (int i = 0; i < h; ++i, ++y) {
@@ -436,7 +446,7 @@ int res_create_localized_alpha_surface(const char* name,
}
}
- return 0;
+ return -10;
}
void res_free_surface(GRSurface* surface) {
diff --git a/otautil/Android.bp b/otautil/Android.bp
index 0a21731e8..73398c3aa 100644
--- a/otautil/Android.bp
+++ b/otautil/Android.bp
@@ -62,6 +62,10 @@ cc_library_static {
"libfs_mgr",
"libselinux",
],
+
+ export_static_lib_headers: [
+ "libfstab",
+ ],
},
},
}
diff --git a/recovery.cpp b/recovery.cpp
index 5bd9b1728..3cb6d6de5 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -18,11 +18,9 @@
#include <ctype.h>
#include <errno.h>
-#include <fcntl.h>
#include <getopt.h>
#include <inttypes.h>
#include <limits.h>
-#include <linux/fs.h>
#include <linux/input.h>
#include <stdio.h>
#include <stdlib.h>
@@ -30,8 +28,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <algorithm>
#include <functional>
+#include <iterator>
#include <memory>
#include <string>
#include <vector>
@@ -42,12 +40,11 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
-#include <android-base/unique_fd.h>
-#include <bootloader_message/bootloader_message.h>
#include <cutils/properties.h> /* for property_list */
#include <healthhalutils/HealthHalUtils.h>
#include <ziparchive/zip_archive.h>
+#include "bootloader_message/bootloader_message.h"
#include "common.h"
#include "fsck_unshare_blocks.h"
#include "install/adb_install.h"
@@ -55,6 +52,7 @@
#include "install/install.h"
#include "install/package.h"
#include "install/wipe_data.h"
+#include "install/wipe_device.h"
#include "otautil/error_code.h"
#include "otautil/logging.h"
#include "otautil/paths.h"
@@ -221,165 +219,6 @@ static InstallResult prompt_and_wipe_data(Device* device) {
}
}
-// Secure-wipe a given partition. It uses BLKSECDISCARD, if supported. Otherwise, it goes with
-// BLKDISCARD (if device supports BLKDISCARDZEROES) or BLKZEROOUT.
-static bool secure_wipe_partition(const std::string& partition) {
- android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(partition.c_str(), O_WRONLY)));
- if (fd == -1) {
- PLOG(ERROR) << "Failed to open \"" << partition << "\"";
- return false;
- }
-
- uint64_t range[2] = { 0, 0 };
- if (ioctl(fd, BLKGETSIZE64, &range[1]) == -1 || range[1] == 0) {
- PLOG(ERROR) << "Failed to get partition size";
- return false;
- }
- LOG(INFO) << "Secure-wiping \"" << partition << "\" from " << range[0] << " to " << range[1];
-
- LOG(INFO) << " Trying BLKSECDISCARD...";
- if (ioctl(fd, BLKSECDISCARD, &range) == -1) {
- PLOG(WARNING) << " Failed";
-
- // Use BLKDISCARD if it zeroes out blocks, otherwise use BLKZEROOUT.
- unsigned int zeroes;
- if (ioctl(fd, BLKDISCARDZEROES, &zeroes) == 0 && zeroes != 0) {
- LOG(INFO) << " Trying BLKDISCARD...";
- if (ioctl(fd, BLKDISCARD, &range) == -1) {
- PLOG(ERROR) << " Failed";
- return false;
- }
- } else {
- LOG(INFO) << " Trying BLKZEROOUT...";
- if (ioctl(fd, BLKZEROOUT, &range) == -1) {
- PLOG(ERROR) << " Failed";
- return false;
- }
- }
- }
-
- LOG(INFO) << " Done";
- return true;
-}
-
-static std::unique_ptr<Package> ReadWipePackage(size_t wipe_package_size) {
- if (wipe_package_size == 0) {
- LOG(ERROR) << "wipe_package_size is zero";
- return nullptr;
- }
-
- std::string wipe_package;
- std::string err_str;
- if (!read_wipe_package(&wipe_package, wipe_package_size, &err_str)) {
- PLOG(ERROR) << "Failed to read wipe package" << err_str;
- return nullptr;
- }
-
- return Package::CreateMemoryPackage(
- std::vector<uint8_t>(wipe_package.begin(), wipe_package.end()), nullptr);
-}
-
-// Checks if the wipe package matches expectation. If the check passes, reads the list of
-// partitions to wipe from the package. Checks include
-// 1. verify the package.
-// 2. check metadata (ota-type, pre-device and serial number if having one).
-static bool CheckWipePackage(Package* wipe_package) {
- if (!verify_package(wipe_package, ui)) {
- LOG(ERROR) << "Failed to verify package";
- return false;
- }
-
- ZipArchiveHandle zip = wipe_package->GetZipArchiveHandle();
- if (!zip) {
- LOG(ERROR) << "Failed to get ZipArchiveHandle";
- return false;
- }
-
- std::map<std::string, std::string> metadata;
- if (!ReadMetadataFromPackage(zip, &metadata)) {
- LOG(ERROR) << "Failed to parse metadata in the zip file";
- return false;
- }
-
- return CheckPackageMetadata(metadata, OtaType::BRICK) == 0;
-}
-
-std::vector<std::string> GetWipePartitionList(Package* wipe_package) {
- ZipArchiveHandle zip = wipe_package->GetZipArchiveHandle();
- if (!zip) {
- LOG(ERROR) << "Failed to get ZipArchiveHandle";
- return {};
- }
-
- static constexpr const char* RECOVERY_WIPE_ENTRY_NAME = "recovery.wipe";
-
- std::string partition_list_content;
- ZipString path(RECOVERY_WIPE_ENTRY_NAME);
- ZipEntry entry;
- if (FindEntry(zip, path, &entry) == 0) {
- uint32_t length = entry.uncompressed_length;
- partition_list_content = std::string(length, '\0');
- if (auto err = ExtractToMemory(
- zip, &entry, reinterpret_cast<uint8_t*>(partition_list_content.data()), length);
- err != 0) {
- LOG(ERROR) << "Failed to extract " << RECOVERY_WIPE_ENTRY_NAME << ": "
- << ErrorCodeString(err);
- return {};
- }
- } else {
- LOG(INFO) << "Failed to find " << RECOVERY_WIPE_ENTRY_NAME
- << ", falling back to use the partition list on device.";
-
- static constexpr const char* RECOVERY_WIPE_ON_DEVICE = "/etc/recovery.wipe";
- if (!android::base::ReadFileToString(RECOVERY_WIPE_ON_DEVICE, &partition_list_content)) {
- PLOG(ERROR) << "failed to read \"" << RECOVERY_WIPE_ON_DEVICE << "\"";
- return {};
- }
- }
-
- std::vector<std::string> result;
- std::vector<std::string> lines = android::base::Split(partition_list_content, "\n");
- for (const std::string& line : lines) {
- std::string partition = android::base::Trim(line);
- // Ignore '#' comment or empty lines.
- if (android::base::StartsWith(partition, "#") || partition.empty()) {
- continue;
- }
- result.push_back(line);
- }
-
- return result;
-}
-
-// Wipes the current A/B device, with a secure wipe of all the partitions in RECOVERY_WIPE.
-static bool wipe_ab_device(size_t wipe_package_size) {
- ui->SetBackground(RecoveryUI::ERASING);
- ui->SetProgressType(RecoveryUI::INDETERMINATE);
-
- auto wipe_package = ReadWipePackage(wipe_package_size);
- if (!wipe_package) {
- LOG(ERROR) << "Failed to open wipe package";
- return false;
- }
-
- if (!CheckWipePackage(wipe_package.get())) {
- LOG(ERROR) << "Failed to verify wipe package";
- return false;
- }
-
- auto partition_list = GetWipePartitionList(wipe_package.get());
- if (partition_list.empty()) {
- LOG(ERROR) << "Empty wipe ab partition list";
- return false;
- }
-
- for (const auto& partition : partition_list) {
- // Proceed anyway even if it fails to wipe some partition.
- secure_wipe_partition(partition);
- }
- return true;
-}
-
static void choose_recovery_file(Device* device) {
std::vector<std::string> entries;
if (has_cache) {
@@ -509,12 +348,14 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) {
case Device::NO_ACTION:
break;
+ case Device::ENTER_FASTBOOT:
+ case Device::ENTER_RECOVERY:
case Device::REBOOT:
- case Device::SHUTDOWN:
case Device::REBOOT_BOOTLOADER:
+ case Device::REBOOT_FASTBOOT:
+ case Device::REBOOT_RECOVERY:
case Device::REBOOT_RESCUE:
- case Device::ENTER_FASTBOOT:
- case Device::ENTER_RECOVERY:
+ case Device::SHUTDOWN:
return chosen_action;
case Device::WIPE_DATA:
@@ -549,9 +390,9 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) {
if (chosen_action == Device::ENTER_RESCUE) {
// Switch to graphics screen.
ui->ShowText(false);
- status = ApplyFromAdb(ui, true /* rescue_mode */, &reboot_action);
+ status = ApplyFromAdb(device, true /* rescue_mode */, &reboot_action);
} else if (chosen_action == Device::APPLY_ADB_SIDELOAD) {
- status = ApplyFromAdb(ui, false /* rescue_mode */, &reboot_action);
+ status = ApplyFromAdb(device, false /* rescue_mode */, &reboot_action);
} else {
adb = false;
status = ApplyFromSdcard(device, ui);
@@ -728,6 +569,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
{ "locale", required_argument, nullptr, 0 },
{ "prompt_and_wipe_data", no_argument, nullptr, 0 },
{ "reason", required_argument, nullptr, 0 },
+ { "rescue", no_argument, nullptr, 0 },
{ "retry_count", required_argument, nullptr, 0 },
{ "security", no_argument, nullptr, 0 },
{ "show_text", no_argument, nullptr, 't' },
@@ -750,6 +592,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
size_t wipe_package_size = 0;
bool sideload = false;
bool sideload_auto_reboot = false;
+ bool rescue = false;
bool just_exit = false;
bool shutdown_after = false;
bool fsck_unshare_blocks = false;
@@ -783,6 +626,8 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
should_prompt_and_wipe_data = true;
} else if (option == "reason") {
reason = optarg;
+ } else if (option == "rescue") {
+ rescue = true;
} else if (option == "retry_count") {
android::base::ParseInt(optarg, &retry_count, 0);
} else if (option == "security") {
@@ -928,7 +773,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
status = INSTALL_ERROR;
}
} else if (should_wipe_ab) {
- if (!wipe_ab_device(wipe_package_size)) {
+ if (!WipeAbDevice(device, wipe_package_size)) {
status = INSTALL_ERROR;
}
} else if (sideload) {
@@ -940,12 +785,16 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
if (!sideload_auto_reboot) {
ui->ShowText(true);
}
- status = ApplyFromAdb(ui, false /* rescue_mode */, &next_action);
+ status = ApplyFromAdb(device, false /* rescue_mode */, &next_action);
ui->Print("\nInstall from ADB complete (status: %d).\n", status);
if (sideload_auto_reboot) {
status = INSTALL_REBOOT;
ui->Print("Rebooting automatically.\n");
}
+ } else if (rescue) {
+ save_current_log = true;
+ status = ApplyFromAdb(device, true /* rescue_mode */, &next_action);
+ ui->Print("\nInstall from ADB complete (status: %d).\n", status);
} else if (fsck_unshare_blocks) {
if (!do_fsck_unshare_blocks()) {
status = INSTALL_ERROR;
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 18abff765..6e69b7009 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -155,9 +155,11 @@ static std::vector<std::string> get_args(const int argc, char** const argv) {
}
// Finally, if no arguments were specified, check whether we should boot
- // into fastboot.
+ // into fastboot or rescue mode.
if (args.size() == 1 && boot_command == "boot-fastboot") {
args.emplace_back("--fastboot");
+ } else if (args.size() == 1 && boot_command == "boot-rescue") {
+ args.emplace_back("--rescue");
}
return args;
@@ -373,7 +375,6 @@ int main(int argc, char** argv) {
}
if (locale.empty()) {
- static constexpr const char* DEFAULT_LOCALE = "en-US";
locale = DEFAULT_LOCALE;
}
}
@@ -470,6 +471,7 @@ int main(int argc, char** argv) {
switch (ret) {
case Device::SHUTDOWN:
ui->Print("Shutting down...\n");
+ // TODO: Move all the reboots to reboot(), which should conditionally set quiescent flag.
android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown,");
break;
@@ -478,11 +480,32 @@ int main(int argc, char** argv) {
android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,bootloader");
break;
- case Device::REBOOT_RESCUE:
- ui->Print("Rebooting to rescue...\n");
- android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,rescue");
+ case Device::REBOOT_FASTBOOT:
+ ui->Print("Rebooting to recovery/fastboot...\n");
+ android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,fastboot");
break;
+ case Device::REBOOT_RECOVERY:
+ ui->Print("Rebooting to recovery...\n");
+ reboot("reboot,recovery");
+ break;
+
+ case Device::REBOOT_RESCUE: {
+ // Not using `reboot("reboot,rescue")`, as it requires matching support in kernel and/or
+ // bootloader.
+ bootloader_message boot = {};
+ strlcpy(boot.command, "boot-rescue", sizeof(boot.command));
+ std::string err;
+ if (!write_bootloader_message(boot, &err)) {
+ LOG(ERROR) << "Failed to write bootloader message: " << err;
+ // Stay under recovery on failure.
+ continue;
+ }
+ ui->Print("Rebooting to recovery/rescue...\n");
+ reboot("reboot,recovery");
+ break;
+ }
+
case Device::ENTER_FASTBOOT:
if (logical_partitions_mapped()) {
ui->Print("Partitions may be mounted - rebooting to enter fastboot.");
diff --git a/recovery_ui/include/recovery_ui/device.h b/recovery_ui/include/recovery_ui/device.h
index 09b5d1f4d..7c76cdb0a 100644
--- a/recovery_ui/include/recovery_ui/device.h
+++ b/recovery_ui/include/recovery_ui/device.h
@@ -33,6 +33,10 @@ class Device {
static constexpr const int kHighlightDown = -3;
static constexpr const int kInvokeItem = -4;
+ // ENTER vs REBOOT: The latter will trigger a reboot that goes through bootloader, which allows
+ // using a new bootloader / recovery image if applicable. For example, REBOOT_RESCUE goes from
+ // rescue -> bootloader -> rescue, whereas ENTER_RESCUE switches from recovery -> rescue
+ // directly.
enum BuiltinAction {
NO_ACTION = 0,
REBOOT = 1,
@@ -50,11 +54,10 @@ class Device {
KEY_INTERRUPTED = 13,
ENTER_FASTBOOT = 14,
ENTER_RECOVERY = 15,
- // ENTER vs REBOOT: The latter will trigger a reboot that uses `rescue` as the reboot target.
- // So it goes from rescue -> bootloader -> rescue, whereas ENTER_RESCUE switches from recovery
- // -> rescue directly.
ENTER_RESCUE = 16,
- REBOOT_RESCUE = 17,
+ REBOOT_FASTBOOT = 17,
+ REBOOT_RECOVERY = 18,
+ REBOOT_RESCUE = 19,
};
explicit Device(RecoveryUI* ui);
diff --git a/recovery_ui/include/recovery_ui/ui.h b/recovery_ui/include/recovery_ui/ui.h
index d55322cf0..797e2f0d5 100644
--- a/recovery_ui/include/recovery_ui/ui.h
+++ b/recovery_ui/include/recovery_ui/ui.h
@@ -27,6 +27,8 @@
#include <thread>
#include <vector>
+static constexpr const char* DEFAULT_LOCALE = "en-US";
+
// Abstract class for controlling the user interface during recovery.
class RecoveryUI {
public:
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index 870db621c..823004521 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -817,12 +817,22 @@ std::unique_ptr<GRSurface> ScreenRecoveryUI::LoadBitmap(const std::string& filen
std::unique_ptr<GRSurface> ScreenRecoveryUI::LoadLocalizedBitmap(const std::string& filename) {
GRSurface* surface;
- if (auto result = res_create_localized_alpha_surface(filename.c_str(), locale_.c_str(), &surface);
- result < 0) {
- LOG(ERROR) << "Failed to load bitmap " << filename << " (error " << result << ")";
- return nullptr;
+ auto result = res_create_localized_alpha_surface(filename.c_str(), locale_.c_str(), &surface);
+ if (result == 0) {
+ return std::unique_ptr<GRSurface>(surface);
}
- return std::unique_ptr<GRSurface>(surface);
+ // TODO(xunchang) create a error code enum to refine the retry condition.
+ LOG(WARNING) << "Failed to load bitmap " << filename << " for locale " << locale_ << " (error "
+ << result << "). Falling back to use default locale.";
+
+ result = res_create_localized_alpha_surface(filename.c_str(), DEFAULT_LOCALE, &surface);
+ if (result == 0) {
+ return std::unique_ptr<GRSurface>(surface);
+ }
+
+ LOG(ERROR) << "Failed to load bitmap " << filename << " for locale " << DEFAULT_LOCALE
+ << " (error " << result << ")";
+ return nullptr;
}
static char** Alloc2d(size_t rows, size_t cols) {
diff --git a/tests/Android.bp b/tests/Android.bp
index 09ef716d6..2e5334d9e 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -197,6 +197,8 @@ cc_test_host {
"libz",
],
+ test_suites: ["general-tests"],
+
data: ["testdata/*"],
target: {
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
deleted file mode 100644
index 6b86085aa..000000000
--- a/tests/AndroidTest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration description="Config for recovery_component_test and recovery_unit_test">
- <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
- <option name="cleanup" value="true" />
- <option name="push" value="recovery_component_test->/data/local/tmp/recovery_component_test/recovery_component_test" />
- <option name="push" value="testdata->/data/local/tmp/recovery_component_test/testdata" />
- <option name="push" value="recovery_unit_test->/data/local/tmp/recovery_unit_test/recovery_unit_test" />
- <option name="push" value="testdata->/data/local/tmp/recovery_unit_test/testdata" />
- </target_preparer>
- <option name="test-suite-tag" value="apct" />
- <test class="com.android.tradefed.testtype.GTest" >
- <option name="native-test-device-path" value="/data/local/tmp/recovery_component_test" />
- <option name="module-name" value="recovery_component_test" />
- </test>
- <test class="com.android.tradefed.testtype.GTest" >
- <option name="native-test-device-path" value="/data/local/tmp/recovery_unit_test" />
- <option name="module-name" value="recovery_unit_test" />
- </test>
-</configuration>
diff --git a/tests/component/install_test.cpp b/tests/component/install_test.cpp
index 385132939..36820f837 100644
--- a/tests/component/install_test.cpp
+++ b/tests/component/install_test.cpp
@@ -33,6 +33,7 @@
#include <ziparchive/zip_writer.h>
#include "install/install.h"
+#include "install/wipe_device.h"
#include "otautil/paths.h"
#include "private/setup_commands.h"
diff --git a/tests/unit/locale_test.cpp b/tests/unit/locale_test.cpp
index cdaba0e8b..c69434c12 100644
--- a/tests/unit/locale_test.cpp
+++ b/tests/unit/locale_test.cpp
@@ -27,7 +27,7 @@ TEST(LocaleTest, Misc) {
EXPECT_FALSE(matches_locale("en-GB", "en"));
EXPECT_FALSE(matches_locale("en-GB", "en-US"));
EXPECT_FALSE(matches_locale("en-US", ""));
- // Empty locale prefix in the PNG file will match the input locale.
- EXPECT_TRUE(matches_locale("", "en-US"));
+ // Empty locale prefix in the PNG file should not match the input locale.
+ EXPECT_FALSE(matches_locale("", "en-US"));
EXPECT_TRUE(matches_locale("sr-Latn", "sr-Latn-BA"));
}
diff --git a/tools/recovery_l10n/res/values-gl/strings.xml b/tools/recovery_l10n/res/values-gl/strings.xml
index e6f2ffd84..e51b36dfb 100644
--- a/tools/recovery_l10n/res/values-gl/strings.xml
+++ b/tools/recovery_l10n/res/values-gl/strings.xml
@@ -6,9 +6,9 @@
<string name="recovery_no_command" msgid="4465476568623024327">"Non hai ningún comando"</string>
<string name="recovery_error" msgid="5748178989622716736">"Erro"</string>
<string name="recovery_installing_security" msgid="9184031299717114342">"Instalando actualización de seguranza"</string>
- <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Non se puido cargar o sistema Android. Os teus datos poden estar danados. Se segue aparecendo esta mensaxe, pode ser necesario restablecer os datos de fábrica e borrar todos os datos do usuario almacenados neste dispositivo."</string>
+ <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Non se puido cargar o sistema Android. Os teus datos poden estar danados. Se segue aparecendo esta mensaxe, pode ser necesario restablecer os datos de fábrica e borrar todos os datos de usuario almacenados neste dispositivo."</string>
<string name="recovery_try_again" msgid="7168248750158873496">"Tentar de novo"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"Restablecemento dos datos de fábrica"</string>
- <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"Queres borrar todos os datos do usuario?\n\n ESTA ACCIÓN NON SE PODE DESFACER."</string>
+ <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"Queres borrar todos os datos de usuario?\n\n ESTA ACCIÓN NON SE PODE DESFACER."</string>
<string name="recovery_cancel_wipe_data" msgid="66987687653647384">"Cancelar"</string>
</resources>
diff --git a/tools/recovery_l10n/res/values-ja/strings.xml b/tools/recovery_l10n/res/values-ja/strings.xml
index 2d6c0abc4..3d6637278 100644
--- a/tools/recovery_l10n/res/values-ja/strings.xml
+++ b/tools/recovery_l10n/res/values-ja/strings.xml
@@ -6,7 +6,7 @@
<string name="recovery_no_command" msgid="4465476568623024327">"コマンドが指定されていません"</string>
<string name="recovery_error" msgid="5748178989622716736">"エラーが発生しました。"</string>
<string name="recovery_installing_security" msgid="9184031299717114342">"セキュリティ アップデートをインストールしています"</string>
- <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android システムを読み込めません。データが破損している可能性があります。このメッセージが引き続き表示される場合は、データの初期化を行い、このデバイスに保存されているすべてのユーザー データを消去することが必要な場合があります。"</string>
+ <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android システムを読み込めません。データが破損している可能性があります。このメッセージが引き続き表示される場合は、データの初期化を行い、この端末に保存されているすべてのユーザー データを消去することが必要な場合があります。"</string>
<string name="recovery_try_again" msgid="7168248750158873496">"再試行"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"データの初期化"</string>
<string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"すべてのユーザー データをワイプしますか?\n\nこの操作は元に戻せません。"</string>