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

Commit 474afa8f authored by Daniel Zheng's avatar Daniel Zheng
Browse files

fallback on older cow version

If a device's source or target cow version is specified at 2 (or
undefined) we should fallback on using the v2 writer.

e.g.
1. v3 -> v2 downgrade OTA
2. v2 -> v3

Bug: 322279333
Test: ota_from_target_files
Change-Id: I8c5139eceeb64ee255ddea66017b3e17bbdc44c0
parent e6045f8b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -479,6 +479,10 @@ class BuildInfo(object):
  def vabc_compression_param(self):
    return self.get("virtual_ab_compression_method", "")

  @property
  def vabc_cow_version(self):
    return self.get("virtual_ab_cow_version", "")

  @property
  def vendor_api_level(self):
    vendor_prop = self.info_dict.get("vendor.build.prop")
+10 −0
Original line number Diff line number Diff line
@@ -908,6 +908,16 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None):
          source_info.vabc_compression_param, target_info.vabc_compression_param, source_info.vabc_compression_param))
      vabc_compression_param = source_info.vabc_compression_param

    # Virtual AB Cow version 3 is introduced in Android U with improved memory
    # and install time performance. All OTA's with
    # both the source build and target build with VIRTUAL_AB_COW_VERSION = 3
    # can support the new format. Otherwise, fallback on older versions
    if not source_info.vabc_cow_version or not target_info.vabc_cow_version:
      logger.info("Source or Target doesn't have VABC_COW_VERSION specified, default to version 2")
      OPTIONS.vabc_cow_version = 2
    elif source_info.vabc_cow_version != target_info.vabc_cow_version:
      logger.info("Source and Target have different cow VABC_COW_VERSION specified, default to minimum version")
      OPTIONS.vabc_cow_version = min(source_info.vabc_cow_version, target_info.vabc_cow_version)
    # Virtual AB Compression was introduced in Androd S.
    # Later, we backported VABC to Android R. But verity support was not
    # backported, so if VABC is used and we are on Android R, disable