From d2fc371b4a25adcf963a50c7c4286ff4847330c3 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Fri, 28 Mar 2025 05:38:39 +0000 Subject: [PATCH 01/12] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I6860be20b5b0a992fcdf927d7449a986779132d4 --- tools/recovery_l10n/res/values-mr/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/recovery_l10n/res/values-mr/strings.xml b/tools/recovery_l10n/res/values-mr/strings.xml index 9b1370794..68c1525e2 100644 --- a/tools/recovery_l10n/res/values-mr/strings.xml +++ b/tools/recovery_l10n/res/values-mr/strings.xml @@ -1,12 +1,12 @@ - "सिस्टम अपडेट इंस्टॉल करत आहे" + "सिस्टीम अपडेट इंस्टॉल करत आहे" "मिटवत आहे" "कोणतीही कमांड नाही" "एरर!" "सुरक्षा अपडेट इंस्टॉल करत आहे" - "Android सिस्टम लोड करू शकत नाही. तुमचा डेटा धोक्यात असू शकतो.तुम्हाला हा मेसेज मिळत राहिल्यास, फॅक्टरी डेटा रीसेट करणे आणि या डिव्हाइसवर स्टोअर केलेला सर्व वापरकर्ता डेटा मिटवणे आवश्यक आहे." + "Android सिस्टीम लोड करता आली नाही. तुमचा डेटा धोक्यात असू शकतो. तुम्हाला हा मेसेज मिळत राहिल्यास, फॅक्टरी डेटा रीसेट करणे आणि या डिव्हाइसवर स्टोअर केलेला सर्व वापरकर्ता डेटा मिटवणे आवश्यक आहे." "पुन्हा प्रयत्न करा" "फॅक्‍टरी डेटा रीसेट" "सर्व वापरकर्ता डेटा पुसून टाकायचा का?\n\n हे पहिल्‍यासारखे करू शकत नाही!" From 685ff38a05449158a9cbd594aaefd67032418f59 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Wed, 14 May 2025 20:06:39 +0000 Subject: [PATCH 02/12] update update_verifier comments the .txt format of care_map.pb no longer is supported (removed in b/128536706). update the comments to support this change to avoid any confusion Test: th Change-Id: Id38e9843a8023ecc91427a868dccb023a99a9582 --- .../include/update_verifier/update_verifier.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/update_verifier/include/update_verifier/update_verifier.h b/update_verifier/include/update_verifier/update_verifier.h index 0cccc9075..f125508da 100644 --- a/update_verifier/include/update_verifier/update_verifier.h +++ b/update_verifier/include/update_verifier/update_verifier.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include "otautil/rangeset.h" @@ -28,10 +27,6 @@ // During the verification, it reads all the blocks in the care_map. And if a failure happens, // it rejects the current boot and triggers a fallback. -// Note that update_verifier should be backward compatible to not reject care_map.txt from old -// releases, which could otherwise fail to boot into the new release. For example, we've changed -// the care_map format between N and O. An O update_verifier would fail to work with N care_map.txt. -// This could be a result of sideloading an O OTA while the device having a pending N update. int update_verifier(int argc, char** argv); // The UpdateVerifier parses the content in the care map, and continues to verify the @@ -41,9 +36,8 @@ class UpdateVerifier { public: UpdateVerifier(); - // This function tries to process the care_map.pb as protobuf message; and falls back to use - // care_map.txt if the pb format file doesn't exist. If the parsing succeeds, put the result - // of the pair into the |partition_map_|. + // This function tries to process the care_map.pb as protobuf message. If the parsing succeeds, + // put the result of the pair into the |partition_map_|. bool ParseCareMap(); // Verifies the new boot by reading all the cared blocks for partitions in |partition_map_|. From df1becd1b3063223c267fcb034dd4533cf1b40ea Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Wed, 14 May 2025 20:11:27 +0000 Subject: [PATCH 03/12] update_verifier: use waitForService getService is a deprecated method, we should use its replacement instead Test: th Change-Id: Ia2e229220c09c6c948e88f2634538419a58fdabc --- update_verifier/update_verifier.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp index a0160e2fc..03b3741e1 100644 --- a/update_verifier/update_verifier.cpp +++ b/update_verifier/update_verifier.cpp @@ -369,7 +369,7 @@ int update_verifier(int argc, char** argv) { bool supports_checkpoint = false; auto sm = android::defaultServiceManager(); - android::sp binder = sm->getService(android::String16("vold")); + android::sp binder = sm->waitForService(android::String16("vold")); if (binder) { auto vold = android::interface_cast(binder); android::binder::Status status = vold->supportsCheckpoint(&supports_checkpoint); From bf6033509208d46fffbf0e8748752dc464bb57e9 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 29 May 2025 13:16:52 -0700 Subject: [PATCH 04/12] Use the exported log severity characters. Change-Id: If1ff7254d5f10d1ed0a7a0bb8b4332c1947f5728 --- recovery_main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recovery_main.cpp b/recovery_main.cpp index 903a31732..b65b4a824 100644 --- a/recovery_main.cpp +++ b/recovery_main.cpp @@ -76,11 +76,10 @@ static bool IsDeviceUnlocked() { static void UiLogger(android::base::LogId log_buffer_id, android::base::LogSeverity severity, const char* tag, const char* file, unsigned int line, const char* message) { android::base::KernelLogger(log_buffer_id, severity, tag, file, line, message); - static constexpr auto&& log_characters = "VDIWEF"; if (severity >= android::base::ERROR && ui != nullptr) { ui->Print("ERROR: %10s: %s\n", tag, message); } else { - fprintf(stdout, "%c:%s\n", log_characters[severity], message); + fprintf(stdout, "%c:%s\n", android::base::kSeverityChars[severity], message); } } From 67e7b29c2d04d7fb8331a36d41f38aab9b8369bb Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Fri, 30 May 2025 03:46:56 +0000 Subject: [PATCH 05/12] Create a bootable_recovery_resources filegroup These files are used by make packaging system to generate images for recovery.img. In prepartion for migrating to soong, create a filegroup for these resources This should be a noop for now. Bug: 420665555 Test: m nothing Change-Id: I75f280ecfe8cf48082afa1828464c68f1f344b06 --- tools/recovery_l10n/Android.bp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/recovery_l10n/Android.bp b/tools/recovery_l10n/Android.bp index ac08e1a5b..0040539b0 100644 --- a/tools/recovery_l10n/Android.bp +++ b/tools/recovery_l10n/Android.bp @@ -30,3 +30,9 @@ android_app { "src/**/*.java", ], } + +filegroup { + name: "bootable_recovery_resources", + srcs: ["res/**/*.xml"], + path: "res", +} From 6c9c32c02b7e851cf9f631a43da3b95f5f233cf8 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 6 Sep 2019 08:03:50 -0400 Subject: [PATCH 06/12] remove useless sdcard menu entry --- recovery_ui/device.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/recovery_ui/device.cpp b/recovery_ui/device.cpp index d46df92d3..312d8d8e9 100644 --- a/recovery_ui/device.cpp +++ b/recovery_ui/device.cpp @@ -31,7 +31,6 @@ static std::vector> g_menu_actions { "Reboot to bootloader", Device::REBOOT_BOOTLOADER }, { "Enter fastboot", Device::ENTER_FASTBOOT }, { "Apply update from ADB", Device::APPLY_ADB_SIDELOAD }, - { "Apply update from SD card", Device::APPLY_SDCARD }, { "Wipe data/factory reset", Device::WIPE_DATA }, { "Wipe cache partition", Device::WIPE_CACHE }, { "Mount /system", Device::MOUNT_SYSTEM }, From 39c1cf75df5bcf632123c92a6e19176237280699 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 6 Sep 2019 08:04:44 -0400 Subject: [PATCH 07/12] rebrand to GrapheneOS --- fastboot/fastboot.cpp | 2 +- recovery.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index 42f985e4f..3eba50048 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -37,7 +37,7 @@ static const std::vector> kFastboo }; void FillDefaultFastbootLines(std::vector& title_lines) { - title_lines.push_back("Android Fastboot"); + title_lines.push_back("GrapheneOS Fastboot"); title_lines.push_back("Product name - " + android::base::GetProperty("ro.product.device", "")); title_lines.push_back("Bootloader version - " + android::base::GetProperty("ro.bootloader", "")); title_lines.push_back("Baseband version - " + diff --git a/recovery.cpp b/recovery.cpp index b7bf629cc..af238a787 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -737,7 +737,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector title_lines = android::base::Split(android::base::GetProperty("ro.build.fingerprint", ""), ":"); - title_lines.insert(std::begin(title_lines), "Android Recovery"); + title_lines.insert(std::begin(title_lines), "GrapheneOS Recovery"); ui->SetTitle(title_lines); ui->ResetKeyInterruptStatus(); From 0d6da09b246a5ddcd8ffa247d16a6e8cc52df300 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 19 Aug 2020 09:31:04 -0400 Subject: [PATCH 08/12] reject updates with serialno constraints --- install/install.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/install/install.cpp b/install/install.cpp index ea9535cc0..99084f813 100644 --- a/install/install.cpp +++ b/install/install.cpp @@ -232,17 +232,8 @@ bool CheckPackageMetadata(const std::map& metadata, Ot auto pkg_serial_no = get_value(metadata, "serialno"); if (!pkg_serial_no.empty()) { - auto device_serial_no = android::base::GetProperty("ro.serialno", ""); - bool serial_number_match = false; - for (const auto& number : android::base::Split(pkg_serial_no, "|")) { - if (device_serial_no == android::base::Trim(number)) { - serial_number_match = true; - } - } - if (!serial_number_match) { - LOG(ERROR) << "Package is for serial " << pkg_serial_no; - return false; - } + LOG(ERROR) << "Serial number constraint not permitted: " << pkg_serial_no; + return INSTALL_ERROR; } else if (ota_type == OtaType::BRICK) { const auto device_build_tag = android::base::GetProperty("ro.build.tags", ""); if (device_build_tag.empty()) { From f342e36bd6c32d54a438f3c30eabe515ab9f7975 Mon Sep 17 00:00:00 2001 From: flawedworld Date: Tue, 16 Aug 2022 12:53:45 +0100 Subject: [PATCH 09/12] Don't show serial number in recovery To stop people leaking it during installation photos --- fastboot/fastboot.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index 3eba50048..fd7b5f1d7 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -42,7 +42,6 @@ void FillDefaultFastbootLines(std::vector& title_lines) { title_lines.push_back("Bootloader version - " + android::base::GetProperty("ro.bootloader", "")); title_lines.push_back("Baseband version - " + android::base::GetProperty("ro.build.expect.baseband", "")); - title_lines.push_back("Serial number - " + android::base::GetProperty("ro.serialno", "")); title_lines.push_back(std::string("Secure boot - ") + ((android::base::GetProperty("ro.secure", "") == "1") ? "yes" : "no")); title_lines.push_back("HW version - " + android::base::GetProperty("ro.revision", "")); From 6feae1ae83eb64aefcdc88b7a775dbdfdc325750 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 30 Jan 2023 18:43:29 -0500 Subject: [PATCH 10/12] stop warning about interrupted virtual A/B update --- recovery.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recovery.cpp b/recovery.cpp index af238a787..65404442f 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -339,9 +339,8 @@ static void WriteUpdateInProgress() { static bool AskToReboot(Device* device, Device::BuiltinAction chosen_action) { bool is_non_ab = android::base::GetProperty("ro.boot.slot_suffix", "").empty(); - bool is_virtual_ab = android::base::GetBoolProperty("ro.virtual_ab.enabled", false); - if (!is_non_ab && !is_virtual_ab) { - // Only prompt for non-A/B or Virtual A/B devices. + if (!is_non_ab) { + // Only prompt for non-A/B devices. return true; } From 8d9a05ebda2c1437bd2b7ac58710c9dc28d3ebf5 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Wed, 4 Oct 2023 22:45:59 +0300 Subject: [PATCH 11/12] remove support for OtaType::BRICK --- install/install.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/install/install.cpp b/install/install.cpp index 99084f813..721b4ba44 100644 --- a/install/install.cpp +++ b/install/install.cpp @@ -71,7 +71,6 @@ static constexpr int VERIFICATION_PROGRESS_TIME = 60; static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25; // The charater used to separate dynamic fingerprints. e.x. sargo|aosp-sargo static const char* FINGERPRING_SEPARATOR = "|"; -static constexpr auto&& RELEASE_KEYS_TAG = "release-keys"; // If brick packages are smaller than |MEMORY_PACKAGE_LIMIT|, read the entire package into memory static constexpr size_t MEMORY_PACKAGE_LIMIT = 1024 * 1024; @@ -235,20 +234,8 @@ bool CheckPackageMetadata(const std::map& metadata, Ot LOG(ERROR) << "Serial number constraint not permitted: " << pkg_serial_no; return INSTALL_ERROR; } else if (ota_type == OtaType::BRICK) { - const auto device_build_tag = android::base::GetProperty("ro.build.tags", ""); - if (device_build_tag.empty()) { - LOG(ERROR) << "Unable to determine device build tags, serial number is missing from package. " - "Rejecting the brick OTA package."; - return false; - } - if (device_build_tag == RELEASE_KEYS_TAG) { - LOG(ERROR) << "Device is release key build, serial number is missing from package. " - "Rejecting the brick OTA package."; - return false; - } - LOG(INFO) - << "Serial number is missing from brick OTA package, permitting anyway because device is " - << device_build_tag; + LOG(ERROR) << "OtaType::BRICK is not permitted"; + return INSTALL_ERROR; } if (ota_type == OtaType::AB) { From 237b85e92345b8873f481d896d8f052c4535c931 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 21 Jan 2025 04:02:44 -0500 Subject: [PATCH 12/12] remove spurious warning on A/B update devices --- recovery.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recovery.cpp b/recovery.cpp index 65404442f..8a7c3c68b 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -404,7 +404,8 @@ static Device::BuiltinAction PromptAndWait(Device* device, InstallResult status) ui->SetProgressType(RecoveryUI::EMPTY); std::vector headers; - if (update_in_progress) { + bool is_non_ab = android::base::GetProperty("ro.boot.slot_suffix", "").empty(); + if (is_non_ab && update_in_progress) { headers = { "WARNING: Previous installation has failed.", " Your device may fail to boot if you reboot or power off now." }; }