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: Hernán Castañón <herna@paranoidandroid.co>
Signed-off-by: theimpulson <aayushgupta219@gmail.com>
diff --git a/install/install.cpp b/install/install.cpp
index 80e5f1b..a417d18 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -187,9 +187,18 @@
 
 int CheckPackageMetadata(const std::map<std::string, std::string>& metadata, OtaType ota_type,
                          bool allow_ab_downgrade) {
+  // 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.
   auto device = android::base::GetProperty("ro.product.device", "");
   auto pkg_device = get_value(metadata, "pre-device");
-  if (pkg_device != device || pkg_device.empty()) {
+  bool product_name_match = false;
+  for (const auto& name : android::base::Split(pkg_device, ",")) {
+    if (device == android::base::Trim(name)) {
+      product_name_match = true;
+    }
+  }
+  if (!product_name_match) {
     LOG(ERROR) << "Package is for product " << pkg_device << " but expected " << device;
     return INSTALL_ERROR;
   }