Add compatibility metadata for Treble-enabled non-A/B OTA packages.
Commit 21803d3574350dbda0ba602038f8a12b1a91333d only added compatibility
metadata for A/B OTA packages, because by that time we didn't use
'ro.treble.enabled' property to determine if a target was Treble-enabled.
This CL uses 'ro.treble.enabled' to guard the packing of compatibility
metadata for both of A/B and non-A/B OTA packages. It also switches to
checking the system/vendor fingerprints to determine if there's an
update to the partition (previously it was computing the SHA-1 of the
images, which may have unintentionally changed due to issues that give
non-repetitive builds).
Bug: 64339310
Test: Generate OTA packages (full and incremental) on Treble-enabled
targets (sailfish, as well as a non-A/B angler target with
Treble-enabled locally); check that the compatibility.zip entry
exists.
Test: Generate OTA packages on Treble-unenabled non-A/B target (angler);
check that the compatibility.zip entry doesn't exist.
Test: Generate OTA packages on Treble-unenabled A/B target; check that
the compatibility.zip entry doesn't exist.
Change-Id: I2a1fcf612439d849ba8ccea217a0faf5d5ba8e14
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index ce57f62..789fefe 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -251,15 +251,16 @@
else:
d["fstab"] = None
- d["build.prop"] = LoadBuildProp(read_helper)
+ d["build.prop"] = LoadBuildProp(read_helper, 'SYSTEM/build.prop')
+ d["vendor.build.prop"] = LoadBuildProp(read_helper, 'VENDOR/build.prop')
return d
-def LoadBuildProp(read_helper):
+def LoadBuildProp(read_helper, prop_file):
try:
- data = read_helper("SYSTEM/build.prop")
+ data = read_helper(prop_file)
except KeyError:
- print("Warning: could not find SYSTEM/build.prop in %s" % (zip,))
+ print("Warning: could not read %s" % (prop_file,))
data = ""
return LoadDictionaryFromLines(data.split("\n"))