diff options
author | Hernán Castañón <herna@paranoidandroid.co> | 2019-02-27 12:28:49 +0100 |
---|---|---|
committer | Aayush Gupta <aayushgupta219@gmail.com> | 2020-05-05 17:25:16 +0000 |
commit | 9d4b55b1b6a2e90a22e54b826eff2dcb1d18403c (patch) | |
tree | 864c298ea5b3d58b5552c794df024c22df2f5bcd | |
parent | bdfbecf3620f59c33dc271fc8058a8030aed4d4f (diff) | |
download | android_bootable_recovery-9d4b55b1b6a2e90a22e54b826eff2dcb1d18403c.tar.gz android_bootable_recovery-9d4b55b1b6a2e90a22e54b826eff2dcb1d18403c.tar.bz2 android_bootable_recovery-9d4b55b1b6a2e90a22e54b826eff2dcb1d18403c.zip |
bootable: Read all asserts in case there are more than onelineage-16.0
In A/B, the device check isn´t done by the updater script, but using
metadata for it.
Let´s search if the device codename/assert is included in the string.
Change-Id: Ie856ac699aaa83de2b364bc85a510a037d36edf9
Signed-off-by: Hernán Castañón <herna@paranoidandroid.co>
Signed-off-by: theimpulson <aayushgupta219@gmail.com>
-rw-r--r-- | install.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/install.cpp b/install.cpp index 8e956c6c..db5792b8 100644 --- a/install.cpp +++ b/install.cpp @@ -143,9 +143,18 @@ static int check_newer_ab_build(ZipArchiveHandle zip) { } } + // We allow the package to carry multiple product names split by ","; + // e.g. pre-device=device1,device2,device3 ... We will fail the + // verification if the device's name doesn't match any of these carried names. std::string value = android::base::GetProperty("ro.product.device", ""); const std::string& pkg_device = metadata["pre-device"]; - if (pkg_device != value || pkg_device.empty()) { + bool product_name_match = false; + for (const std::string& name : android::base::Split(pkg_device, ",")) { + if (value == android::base::Trim(name)) { + product_name_match = true; + } + } + if (!product_name_match) { LOG(ERROR) << "Package is for product " << pkg_device << " but expected " << value; return INSTALL_ERROR; } |