releasetools: Include retrofit info into package metadata.

Fixes: 126754990
Test: Generate retrofit and non-retrofit OTAs. Check the package
      metadata entry.
Test: python -m unittest test_ota_from_target_files
Change-Id: I076a013a6224a2ffea8e0b8581890b66f847f165
This commit is contained in:
Tao Bao 2019-03-06 16:00:38 -08:00
parent e34ff5ca5d
commit 393eeb4918
2 changed files with 21 additions and 0 deletions

View file

@ -1060,6 +1060,9 @@ def GetPackageMetadata(target_info, source_info=None):
if OPTIONS.wipe_user_data:
metadata['ota-wipe'] = 'yes'
if OPTIONS.retrofit_dynamic_partitions:
metadata['ota-retrofit-dynamic-partitions'] = 'yes'
is_incremental = source_info is not None
if is_incremental:
metadata['pre-build'] = source_info.fingerprint

View file

@ -415,6 +415,7 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase):
# Reset the global options as in ota_from_target_files.py.
common.OPTIONS.incremental_source = None
common.OPTIONS.downgrade = False
common.OPTIONS.retrofit_dynamic_partitions = False
common.OPTIONS.timestamp = False
common.OPTIONS.wipe_user_data = False
common.OPTIONS.no_signing = False
@ -517,6 +518,23 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase):
},
metadata)
def test_GetPackageMetadata_retrofitDynamicPartitions(self):
target_info = BuildInfo(self.TEST_TARGET_INFO_DICT, None)
common.OPTIONS.retrofit_dynamic_partitions = True
metadata = GetPackageMetadata(target_info)
self.assertDictEqual(
{
'ota-retrofit-dynamic-partitions' : 'yes',
'ota-type' : 'BLOCK',
'post-build' : 'build-fingerprint-target',
'post-build-incremental' : 'build-version-incremental-target',
'post-sdk-level' : '27',
'post-security-patch-level' : '2017-12-01',
'post-timestamp' : '1500000000',
'pre-device' : 'product-device',
},
metadata)
@staticmethod
def _test_GetPackageMetadata_swapBuildTimestamps(target_info, source_info):
(target_info['build.prop']['ro.build.date.utc'],