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

Commit 24bcaae8 authored by Tianjie Xu's avatar Tianjie Xu Committed by Automerger Merge Worker
Browse files

Merge "Update ota script to match init's logic" am: 11e5f33e am: 75aa3ff5...

Merge "Update ota script to match init's logic" am: 11e5f33e am: 75aa3ff5 am: 3960278f am: 1f6729bc

Original change: https://android-review.googlesource.com/c/platform/build/+/1462694

Change-Id: I638cfa198a265e7dbc81bf23cf37d00847adbb4f
parents c6346b1d 1f6729bc
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -527,6 +527,27 @@ class BuildInfo(object):
        return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_LEGACY
    return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_CURRENT

  def _GetPlatformVersion(self):
    version_sdk = self.GetBuildProp("ro.build.version.sdk")
    # init code switches to version_release_or_codename (see b/158483506). After
    # API finalization, release_or_codename will be the same as release. This
    # is the best effort to support pre-S dev stage builds.
    if int(version_sdk) >= 30:
      try:
        return self.GetBuildProp("ro.build.version.release_or_codename")
      except ExternalError:
        logger.warning('Failed to find ro.build.version.release_or_codename')

    return self.GetBuildProp("ro.build.version.release")

  def _GetPartitionPlatformVersion(self, partition):
    try:
      return self.GetPartitionBuildProp("ro.build.version.release_or_codename",
                                        partition)
    except ExternalError:
      return self.GetPartitionBuildProp("ro.build.version.release",
                                        partition)

  def GetOemProperty(self, key):
    if self.oem_props is not None and key in self.oem_props:
      return self.oem_dicts[0][key]
@@ -543,7 +564,7 @@ class BuildInfo(object):
          self.GetPartitionBuildProp("ro.product.brand", partition),
          self.GetPartitionBuildProp("ro.product.name", partition),
          self.GetPartitionBuildProp("ro.product.device", partition),
          self.GetPartitionBuildProp("ro.build.version.release", partition),
          self._GetPartitionPlatformVersion(partition),
          self.GetPartitionBuildProp("ro.build.id", partition),
          self.GetPartitionBuildProp(
              "ro.build.version.incremental", partition),
@@ -559,7 +580,7 @@ class BuildInfo(object):
            self.GetBuildProp("ro.product.brand"),
            self.GetBuildProp("ro.product.name"),
            self.GetBuildProp("ro.product.device"),
            self.GetBuildProp("ro.build.version.release"),
            self._GetPlatformVersion(),
            self.GetBuildProp("ro.build.id"),
            self.GetBuildProp("ro.build.version.incremental"),
            self.GetBuildProp("ro.build.type"),
+2 −1
Original line number Diff line number Diff line
@@ -1205,11 +1205,12 @@ class RuntimeFingerprintTest(test_utils.ReleaseToolsTestCase):
  ]

  BUILD_PROP = [
      'ro.build.version.release=version-release',
      'ro.build.id=build-id',
      'ro.build.version.incremental=version-incremental',
      'ro.build.type=build-type',
      'ro.build.tags=build-tags',
      'ro.build.version.release=version-release',
      'ro.build.version.release_or_codename=version-release',
      'ro.build.version.sdk=30',
      'ro.build.version.security_patch=2020',
      'ro.build.date.utc=12345678',