recovery: Add runtime checks for A/B vs traditional updates

This allows A/B devices to install legacy (non-payload) style update.zip
packages like our addonsu or gapps.

Do not abort an update if META-INF/com/android/metadata is missing,
instead use it to determine whether the update is an A/B ota or not.

Change-Id: I907a92732470b947de007dde11fb71db64d94c9b
diff --git a/install/install.cpp b/install/install.cpp
index a9786cf..669b26b 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -85,7 +85,6 @@
   static constexpr const char* METADATA_PATH = "META-INF/com/android/metadata";
   ZipEntry64 entry;
   if (FindEntry(zip, METADATA_PATH, &entry) != 0) {
-    LOG(ERROR) << "Failed to find " << METADATA_PATH;
     return false;
   }
 
@@ -380,12 +379,9 @@
   auto ui = device->GetUI();
   std::map<std::string, std::string> metadata;
   auto zip = package->GetZipArchiveHandle();
-  if (!ReadMetadataFromPackage(zip, &metadata)) {
-    LOG(ERROR) << "Failed to parse metadata in the zip file";
-    return INSTALL_CORRUPT;
-  }
+  bool has_metadata = ReadMetadataFromPackage(zip, &metadata);
 
-  const bool package_is_ab = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB);
+  const bool package_is_ab = !has_metadata && get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB);
   const bool package_is_brick = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::BRICK);
   if (package_is_brick) {
     LOG(INFO) << "Installing a brick package";
@@ -400,8 +396,7 @@
     return WipeAbDevice(device, package) ? INSTALL_SUCCESS : INSTALL_ERROR;
   }
   bool device_supports_ab = android::base::GetBoolProperty("ro.build.ab_update", false);
-  bool ab_device_supports_nonab =
-      android::base::GetBoolProperty("ro.virtual_ab.allow_non_ab", false);
+  bool ab_device_supports_nonab = true;
   bool device_only_supports_ab = device_supports_ab && !ab_device_supports_nonab;
 
   const auto current_spl = android::base::GetProperty("ro.build.version.security_patch", "");