Include per-partition fingerprint as AVB prop.

This allows querying per-partition fingerprint via libavb (in
particular, avb_property_lookup).

Bug: 80097573
Test: `m dist`; `avbtool info_image --image /path/to/image` to check the
      written prop.
Test: `atest --host releasetools_test releasetools_py3_test`
Test: Run sign_target_files_apks to sign a target_files.zip that's built
      with the change. Check the AVB prop in the signed images.
Change-Id: Id4f06df82c29e77aca128439c8c11f0367fe587e
This commit is contained in:
Tao Bao
2019-10-09 00:04:28 -07:00
parent 17f505e7ea
commit 19b02fe8e5
3 changed files with 95 additions and 13 deletions

View File

@@ -23,7 +23,8 @@ import common
import test_utils
from sign_target_files_apks import (
CheckApkAndApexKeysAvailable, EditTags, GetApkFileInfo, ReadApexKeysInfo,
ReplaceCerts, ReplaceVerityKeyId, RewriteProps, WriteOtacerts)
ReplaceCerts, ReplaceVerityKeyId, RewriteAvbProps, RewriteProps,
WriteOtacerts)
class SignTargetFilesApksTest(test_utils.ReleaseToolsTestCase):
@@ -52,6 +53,40 @@ name="apex.apexd_test_different_app.apex" public_key="system/apex/apexd/apexd_te
# Tags are sorted.
self.assertEqual(EditTags('xyz,abc,dev-keys,xyz'), ('abc,release-keys,xyz'))
def test_RewriteAvbProps(self):
misc_info = {
'avb_boot_add_hash_footer_args':
('--prop com.android.build.boot.os_version:R '
'--prop com.android.build.boot.security_patch:2019-09-05'),
'avb_system_add_hashtree_footer_args':
('--prop com.android.build.system.os_version:R '
'--prop com.android.build.system.security_patch:2019-09-05 '
'--prop com.android.build.system.fingerprint:'
'Android/aosp_taimen/taimen:R/QT/foo:userdebug/test-keys'),
'avb_vendor_add_hashtree_footer_args':
('--prop com.android.build.vendor.os_version:R '
'--prop com.android.build.vendor.security_patch:2019-09-05 '
'--prop com.android.build.vendor.fingerprint:'
'Android/aosp_taimen/taimen:R/QT/foo:userdebug/dev-keys'),
}
expected_dict = {
'avb_boot_add_hash_footer_args':
('--prop com.android.build.boot.os_version:R '
'--prop com.android.build.boot.security_patch:2019-09-05'),
'avb_system_add_hashtree_footer_args':
('--prop com.android.build.system.os_version:R '
'--prop com.android.build.system.security_patch:2019-09-05 '
'--prop com.android.build.system.fingerprint:'
'Android/aosp_taimen/taimen:R/QT/foo:userdebug/release-keys'),
'avb_vendor_add_hashtree_footer_args':
('--prop com.android.build.vendor.os_version:R '
'--prop com.android.build.vendor.security_patch:2019-09-05 '
'--prop com.android.build.vendor.fingerprint:'
'Android/aosp_taimen/taimen:R/QT/foo:userdebug/release-keys'),
}
RewriteAvbProps(misc_info)
self.assertDictEqual(expected_dict, misc_info)
def test_RewriteProps(self):
props = (
('', ''),