Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7914644
Snap for 13147095 from 2b63f1cba7f04506a843fe1f96b0abbfa667d05b to 25…
Mar 3, 2025
d754725
Snap for 13185465 from 5aa97c82a0f0f6e6907d5dec32a570a5cb065660 to 25…
Mar 9, 2025
b9100a9
Snap for 13222886 from 5352247046acc1002401594aac7fd53ebe65afb0 to 25…
Mar 16, 2025
d2fc371
Import translations. DO NOT MERGE ANYWHERE
Mar 28, 2025
caf5a55
Snap for 13288885 from d2fc371b4a25adcf963a50c7c4286ff4847330c3 to 25…
Mar 29, 2025
685ff38
update update_verifier comments
zbw182 May 14, 2025
df1becd
update_verifier: use waitForService
zbw182 May 14, 2025
0a3928d
Snap for 13503953 from df1becd1b3063223c267fcb034dd4533cf1b40ea to 25…
May 15, 2025
bf60335
Use the exported log severity characters.
enh-google May 29, 2025
67e7b29
Create a bootable_recovery_resources filegroup
dasspandan May 30, 2025
a0aff04
Snap for 13580881 from 67e7b29c2d04d7fb8331a36d41f38aab9b8369bb to 25…
May 31, 2025
f63792b
Merge "Use the exported log severity characters." into main
enh-google Jun 3, 2025
f22b4ff
Snap for 13592639 from f63792b9469d729517d3c565e78472bc15178d09 to 25…
Jun 3, 2025
6c9c32c
remove useless sdcard menu entry
thestinger Sep 6, 2019
39c1cf7
rebrand to GrapheneOS
thestinger Sep 6, 2019
0d6da09
reject updates with serialno constraints
thestinger Aug 19, 2020
f342e36
Don't show serial number in recovery
flawedworld Aug 16, 2022
6feae1a
stop warning about interrupted virtual A/B update
thestinger Jan 30, 2023
8d9a05e
remove support for OtaType::BRICK
muhomorr Oct 4, 2023
237b85e
remove spurious warning on A/B update devices
thestinger Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions fastboot/fastboot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ static const std::vector<std::pair<std::string, Device::BuiltinAction>> kFastboo
};

void FillDefaultFastbootLines(std::vector<std::string>& 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 - " +
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", ""));
Expand Down
30 changes: 4 additions & 26 deletions install/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -232,32 +231,11 @@ bool CheckPackageMetadata(const std::map<std::string, std::string>& 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()) {
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) {
Expand Down
10 changes: 5 additions & 5 deletions recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -405,7 +404,8 @@ static Device::BuiltinAction PromptAndWait(Device* device, InstallResult status)
ui->SetProgressType(RecoveryUI::EMPTY);

std::vector<std::string> 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." };
}
Expand Down Expand Up @@ -737,7 +737,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri

std::vector<std::string> 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();
Expand Down
3 changes: 1 addition & 2 deletions recovery_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion recovery_ui/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ static std::vector<std::pair<std::string, Device::BuiltinAction>> 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 },
Expand Down
6 changes: 6 additions & 0 deletions tools/recovery_l10n/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ android_app {
"src/**/*.java",
],
}

filegroup {
name: "bootable_recovery_resources",
srcs: ["res/**/*.xml"],
path: "res",
}
4 changes: 2 additions & 2 deletions tools/recovery_l10n/res/values-mr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?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_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>
<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>
Expand Down
10 changes: 2 additions & 8 deletions update_verifier/include/update_verifier/update_verifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <functional>
#include <map>
#include <string>
#include <vector>

#include <snapuserd/snapuserd_client.h>
#include "otautil/rangeset.h"
Expand All @@ -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
Expand All @@ -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 <partition_name, ranges> 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 <partition_name, ranges> into the |partition_map_|.
bool ParseCareMap();

// Verifies the new boot by reading all the cared blocks for partitions in |partition_map_|.
Expand Down
2 changes: 1 addition & 1 deletion update_verifier/update_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ int update_verifier(int argc, char** argv) {

bool supports_checkpoint = false;
auto sm = android::defaultServiceManager();
android::sp<android::IBinder> binder = sm->getService(android::String16("vold"));
android::sp<android::IBinder> binder = sm->waitForService(android::String16("vold"));
if (binder) {
auto vold = android::interface_cast<android::os::IVold>(binder);
android::binder::Status status = vold->supportsCheckpoint(&supports_checkpoint);
Expand Down