diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 5115ba401f..fe40936463 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -1061,6 +1061,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 diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py index 44703db535..c2da907762 100644 --- a/tools/releasetools/test_ota_from_target_files.py +++ b/tools/releasetools/test_ota_from_target_files.py @@ -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'],