From 2d94586cff7adece05361e0f7aad729ef34226f6 Mon Sep 17 00:00:00 2001 From: satayev Date: Wed, 9 Feb 2022 21:59:28 +0000 Subject: [PATCH] Introduce ro.build.version.known_codenames sysprop. It defines values for Build.VERSION.KNOWN_CODENAMES constant, and should contain all codenames starting from Q, including current codename for in development branches. Bug: 211747008 Test: presubmit Change-Id: If8995750e369ba39bfc7041580c21b2f96632a78 --- core/sysprop.mk | 1 + core/version_defaults.mk | 7 +++++++ core/version_util.mk | 9 +++++++++ tools/buildinfo.sh | 1 + 4 files changed, 18 insertions(+) diff --git a/core/sysprop.mk b/core/sysprop.mk index 12ead6ee73..86435d9654 100644 --- a/core/sysprop.mk +++ b/core/sysprop.mk @@ -270,6 +270,7 @@ $(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) | $(B PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \ PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ + PLATFORM_VERSION_KNOWN_CODENAMES="$(PLATFORM_VERSION_KNOWN_CODENAMES)" \ PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \ BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \ diff --git a/core/version_defaults.mk b/core/version_defaults.mk index 4dbc941824..8ee21c89b9 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -79,6 +79,13 @@ PLATFORM_SDK_EXTENSION_VERSION := 1 PLATFORM_BASE_SDK_EXTENSION_VERSION := 1 .KATI_READONLY := PLATFORM_BASE_SDK_EXTENSION_VERSION +# This is are all known codenames starting from Q. +PLATFORM_VERSION_KNOWN_CODENAMES := Q R S Sv2 Tiramisu +# Convert from space separated list to comma separated +PLATFORM_VERSION_KNOWN_CODENAMES := \ + $(call normalize-comma-list,$(PLATFORM_VERSION_KNOWN_CODENAMES)) +.KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES + ifndef PLATFORM_SECURITY_PATCH # Used to indicate the security patch that has been applied to the device. # It must signify that the build includes all security patches issued up through the designated Android Public Security Bulletin. diff --git a/core/version_util.mk b/core/version_util.mk index b7c4e48641..2633640b0d 100644 --- a/core/version_util.mk +++ b/core/version_util.mk @@ -90,6 +90,15 @@ endif PLATFORM_VERSION_CODENAME \ PLATFORM_VERSION_ALL_CODENAMES +ifneq (REL,$(PLATFORM_VERSION_CODENAME)) + codenames := \ + $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES))) + ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),) + $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \ + Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES) + endif +endif + ifndef PLATFORM_VERSION ifeq (REL,$(PLATFORM_VERSION_CODENAME)) PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE) diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh index a349cba0f0..20c96de05f 100755 --- a/tools/buildinfo.sh +++ b/tools/buildinfo.sh @@ -16,6 +16,7 @@ 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.known_codenames=$PLATFORM_VERSION_KNOWN_CODENAMES" 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"