Disable VABC if either source/target doesn't support it

If source supports VABC, delta_generator/update_engine will attempt to
use VABC. This dangerous, as the target build won't have snapuserd to
serve I/O request when device boots. Therefore, disable VABC if source
build doesn't supports it.

Test: downgrade from VABC enabled build to a build w/o VABC

Change-Id: Ie8353e00f65354c2242ee5255b6652c6b62483a4
This commit is contained in:
Kelvin Zhang
2021-04-28 12:46:17 -04:00
parent a6d2d8c79a
commit 563750f483
2 changed files with 49 additions and 24 deletions

View File

@@ -1051,15 +1051,18 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None):
"META/ab_partitions.txt is required for ab_update."
target_info = common.BuildInfo(OPTIONS.target_info_dict, OPTIONS.oem_dicts)
source_info = common.BuildInfo(OPTIONS.source_info_dict, OPTIONS.oem_dicts)
vendor_prop = source_info.info_dict.get("vendor.build.prop")
vabc_used = vendor_prop and \
vendor_prop.GetProp("ro.virtual_ab.compression.enabled") == "true" and \
not OPTIONS.disable_vabc
if vabc_used:
# If source supports VABC, delta_generator/update_engine will attempt to
# use VABC. This dangerous, as the target build won't have snapuserd to
# serve I/O request when device boots. Therefore, disable VABC if source
# build doesn't supports it.
if not source_info.is_vabc or not target_info.is_vabc:
OPTIONS.disable_vabc = True
if not OPTIONS.disable_vabc:
# TODO(zhangkelvin) Remove this once FEC on VABC is supported
logger.info("Virtual AB Compression enabled, disabling FEC")
OPTIONS.disable_fec_computation = True
OPTIONS.disable_verity_computation = True
else:
assert "ab_partitions" in OPTIONS.info_dict, \
"META/ab_partitions.txt is required for ab_update."