Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d4b55b1 authored by Hernán Castañón's avatar Hernán Castañón Committed by Aayush Gupta
Browse files

bootable: Read all asserts in case there are more than one



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: default avatarHernán Castañón <herna@paranoidandroid.co>
Signed-off-by: default avatartheimpulson <aayushgupta219@gmail.com>
parent bdfbecf3
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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;
  }