Reland: Rework platform version to hide codenames.

The public platform version no longer can be a codename, it is
always the most recently released platform.  A new build property
and API provides either the offical version or the current codename
as appropriate.  This will avoid breaking apps that look at the
platform version while development is under a codename.

Changes from the original version:
- Logic for emitting system properties has also been added to
  buildinfo_common.sh to make sure that ro.${partition}.build.*
  are consistent with ro.build.*.
- We also use PLATFORM_VERSION_LAST_STABLE as the value set in the
  boot image os_version header / hash tree additional headers to
  ensure they match with the ro.build.version.release system property.
  This is hopefully a temporary workaround while we stop using the
  system property for this purpose.

Bug:  143175463
Test: manual
Change-Id: Iaeefb35137de01c6ea57115d8830dd9bc30eccba
This commit is contained in:
Dianne Hackborn 2019-10-22 15:58:17 -07:00 committed by Narayan Kamath
parent 7f4a2cdb68
commit 25648e60b2
4 changed files with 45 additions and 40 deletions

View file

@ -241,8 +241,8 @@ define generate-common-build-props-with-product-vars-set
BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
DATE="$(DATE_FROM_FILE)" \
PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
PLATFORM_VERSION="$(PLATFORM_VERSION)" \
PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION)" \
TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
endef
@ -447,7 +447,7 @@ endif
BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
PLATFORM_VERSION="$(PLATFORM_VERSION)" \
PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION)" \
PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
@ -1121,7 +1121,7 @@ endif
endif
INTERNAL_MKBOOTIMG_VERSION_ARGS := \
--os_version $(PLATFORM_VERSION) \
--os_version $(PLATFORM_VERSION_LAST_STABLE) \
--os_patch_level $(PLATFORM_SECURITY_PATCH)
# Define these only if we are building boot
@ -3217,22 +3217,22 @@ endif
BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.system.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.product.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.product.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.product.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.system_ext.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION_LAST_STABLE) \
--prop com.android.build.system_ext.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.boot.os_version:$(PLATFORM_VERSION)
--prop com.android.build.boot.os_version:$(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.vendor_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
@ -3242,11 +3242,11 @@ BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS += \
BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.vendor.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.vendor.os_version:$(PLATFORM_VERSION)
--prop com.android.build.vendor.os_version:$(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
--prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
--prop com.android.build.odm.os_version:$(PLATFORM_VERSION)
--prop com.android.build.odm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)

View file

@ -84,38 +84,17 @@ MAX_PLATFORM_VERSION :=
# generate the range of allowed SDK versions, so it must have an entry for every
# unreleased API level targetable by this branch, not just those that are valid
# lunch targets for this branch.
PLATFORM_VERSION.RP1A := R
# The last stable version name of the platform that was released. During
# development, this stays at that previous version, while the codename indicates
# further work based on the previous version.
PLATFORM_VERSION_LAST_STABLE := 10
.KATI_READONLY := PLATFORM_VERSION_LAST_STABLE
# These are the current development codenames, if the build is not a final
# release build. If this is a final release build, it is simply "REL".
PLATFORM_VERSION_CODENAME.RP1A := R
ifndef PLATFORM_VERSION
PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
ifndef PLATFORM_VERSION
# PLATFORM_VERSION falls back to TARGET_PLATFORM_VERSION
PLATFORM_VERSION := $(TARGET_PLATFORM_VERSION)
endif
endif
.KATI_READONLY := PLATFORM_VERSION
ifndef PLATFORM_SDK_VERSION
# This is the canonical definition of the SDK version, which defines
# the set of APIs and functionality available in the platform. It
# is a single integer that increases monotonically as updates to
# the SDK are released. It should only be incremented when the APIs for
# the new release are frozen (so that developers don't write apps against
# intermediate builds). During development, this number remains at the
# SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
# the code-name of the new development work.
# When you increment the PLATFORM_SDK_VERSION please ensure you also
# clear out the following text file of all older PLATFORM_VERSION's:
# cts/tests/tests/os/assets/platform_versions.txt
PLATFORM_SDK_VERSION := 29
endif
.KATI_READONLY := PLATFORM_SDK_VERSION
ifndef PLATFORM_VERSION_CODENAME
PLATFORM_VERSION_CODENAME := $(PLATFORM_VERSION_CODENAME.$(TARGET_PLATFORM_VERSION))
ifndef PLATFORM_VERSION_CODENAME
@ -165,6 +144,32 @@ endif
PLATFORM_VERSION_ALL_CODENAMES \
PLATFORM_VERSION_FUTURE_CODENAMES
ifndef PLATFORM_VERSION
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE)
else
PLATFORM_VERSION := $(PLATFORM_VERSION_CODENAME)
endif
endif
.KATI_READONLY := PLATFORM_VERSION
ifndef PLATFORM_SDK_VERSION
# This is the canonical definition of the SDK version, which defines
# the set of APIs and functionality available in the platform. It
# is a single integer that increases monotonically as updates to
# the SDK are released. It should only be incremented when the APIs for
# the new release are frozen (so that developers don't write apps against
# intermediate builds). During development, this number remains at the
# SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
# the code-name of the new development work.
# When you increment the PLATFORM_SDK_VERSION please ensure you also
# clear out the following text file of all older PLATFORM_VERSION's:
# cts/tests/tests/os/assets/platform_versions.txt
PLATFORM_SDK_VERSION := 29
endif
.KATI_READONLY := PLATFORM_SDK_VERSION
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
PLATFORM_PREVIEW_SDK_VERSION := 0
else

View file

@ -11,8 +11,8 @@ echo "ro.build.version.preview_sdk=$PLATFORM_PREVIEW_SDK_VERSION"
echo "ro.build.version.preview_sdk_fingerprint=$PLATFORM_PREVIEW_SDK_FINGERPRINT"
echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
echo "ro.build.version.release=$PLATFORM_VERSION"
echo "ro.build.version.release_or_codename=$PLATFORM_VERSION_LAST_STABLE"
echo "ro.build.version.release=$PLATFORM_VERSION_LAST_STABLE"
echo "ro.build.version.release_or_codename=$PLATFORM_VERSION"
echo "ro.build.version.security_patch=$PLATFORM_SECURITY_PATCH"
echo "ro.build.version.base_os=$PLATFORM_BASE_OS"
echo "ro.build.version.min_supported_target_sdk=$PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION"

View file

@ -17,8 +17,8 @@ echo "ro.${partition}.build.id=$BUILD_ID"
echo "ro.${partition}.build.tags=$BUILD_VERSION_TAGS"
echo "ro.${partition}.build.type=$TARGET_BUILD_TYPE"
echo "ro.${partition}.build.version.incremental=$BUILD_NUMBER"
echo "ro.${partition}.build.version.release=$PLATFORM_VERSION"
echo "ro.${partition}.build.version.release_or_codename=$PLATFORM_VERSION_LAST_STABLE"
echo "ro.${partition}.build.version.release=$PLATFORM_VERSION_LAST_STABLE"
echo "ro.${partition}.build.version.release_or_codename=$PLATFORM_VERSION"
echo "ro.${partition}.build.version.sdk=$PLATFORM_SDK_VERSION"
echo "ro.product.${partition}.brand=$PRODUCT_BRAND"