DivestOS/Patches/LineageOS-21.0/android_bootable_recovery/0001-No_SerialNum_Restrictions.patch

34 lines
1.3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 19 Aug 2020 09:31:04 -0400
Subject: [PATCH] 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 9906a41f..e85a95c5 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -234,17 +234,8 @@ 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()) {