Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 393eeb49 authored by Tao Bao's avatar Tao Bao
Browse files

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
parent e34ff5ca
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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
+18 −0
Original line number Diff line number Diff line
@@ -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'],