summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-08-23 01:23:07 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-08-23 01:23:07 +0200
commit7379a5290dd96e9382232c1be625e5a3431f05b0 (patch)
treec68f0d6b6fdf9023e70981049484223d18f41bcf /install.cpp
parentMerge changes I5d7a6baa,Id0fb2d4e am: 89ad02206a am: cead180a2b (diff)
parentMerge "Allow comparison against multi serial nums for A/B package" am: 3810046a55 (diff)
downloadandroid_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.tar
android_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.tar.gz
android_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.tar.bz2
android_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.tar.lz
android_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.tar.xz
android_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.tar.zst
android_bootable_recovery-7379a5290dd96e9382232c1be625e5a3431f05b0.zip
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/install.cpp b/install.cpp
index 7fbf5c01f..1220c6ab7 100644
--- a/install.cpp
+++ b/install.cpp
@@ -148,13 +148,23 @@ static int check_newer_ab_build(ZipArchiveHandle zip) {
return INSTALL_ERROR;
}
- // We allow the package to not have any serialno, but if it has a non-empty
- // value it should match.
+ // We allow the package to not have any serialno; and we also allow it to carry multiple serial
+ // numbers split by "|"; e.g. serialno=serialno1|serialno2|serialno3 ... We will fail the
+ // verification if the device's serialno doesn't match any of these carried numbers.
value = android::base::GetProperty("ro.serialno", "");
const std::string& pkg_serial_no = metadata["serialno"];
- if (!pkg_serial_no.empty() && pkg_serial_no != value) {
- LOG(ERROR) << "Package is for serial " << pkg_serial_no;
- return INSTALL_ERROR;
+ if (!pkg_serial_no.empty()) {
+ bool match = false;
+ for (const std::string& number : android::base::Split(pkg_serial_no, "|")) {
+ if (value == android::base::Trim(number)) {
+ match = true;
+ break;
+ }
+ }
+ if (!match) {
+ LOG(ERROR) << "Package is for serial " << pkg_serial_no;
+ return INSTALL_ERROR;
+ }
}
if (metadata["ota-type"] != "AB") {