Extract version variables out to release configs.

Bug: 306702353
Test: lunch <device>-next-userdebug && m -j98
Change-Id: I6897b0fe06f317d65e4fe70776724003a91ef9ef
Ignore-AOSP-First: Changes in internal projects first.
Merged-In: I6897b0fe06f317d65e4fe70776724003a91ef9ef
diff --git a/build_config/next.bzl b/build_config/next.bzl
index a2e85e8..f75b690 100644
--- a/build_config/next.bzl
+++ b/build_config/next.bzl
@@ -23,6 +23,19 @@
 
 load("//build/make/core/release_config.bzl", "value")
 
+# Platform version variables
+platform_version_flags = [
+    value("RELEASE_PLATFORM_VERSION", "UP1A"),
+    value("RELEASE_PLATFORM_SDK_VERSION", "34"),
+    value("RELEASE_PLATFORM_SDK_EXTENSION_VERSION", "10"),
+    value("RELEASE_PLATFORM_SECURITY_PATCH", "2023-12-05"),
+    value("RELEASE_PLATFORM_VERSION_CODENAME", "REL"),
+    value("RELEASE_PLATFORM_VERSION_ALL_CODENAMES", "REL"),
+    value("RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES", "REL,VanillaIceCream"),
+    value("RELEASE_PLATFORM_VERSION_LAST_STABLE", "14"),
+    value("RELEASE_PLATFORM_VNDK_VERSION", "35"),
+]
+
 # Flags should be alphabetical by flag name to reduce merge conflifcts
 values = [
     value("RELEASE_ACONFIG_FLAG_DEFAULT_PERMISSION", "READ_ONLY"),
@@ -30,7 +43,4 @@
     value("RELEASE_AIDL_USE_UNFROZEN", False),
     value("RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE", False),
     value("RELEASE_EXPOSE_FLAGGED_API", True),
-    value("RELEASE_PLATFORM_VERSION", "UP1A"),
-    value("RELEASE_PLATFORM_VERSION_CODENAME_REL", "true"),
-    value("RELEASE_PLATFORM_VNDK_VERSION", "35"),
-]
+] + platform_version_flags
diff --git a/build_config/trunk.bzl b/build_config/trunk.bzl
index f289cba..4c6dec8 100644
--- a/build_config/trunk.bzl
+++ b/build_config/trunk.bzl
@@ -22,8 +22,9 @@
 #
 
 load("//build/make/core/release_config.bzl", "value")
+load("//build/release/build_config/trunk_versions.bzl", "platform_version_flags")
 
 # Flags should be alphabetical by flag name to reduce merge conflifcts
 values = [
     value("RELEASE_ACONFIG_VALUE_SETS", "//build/release/aconfig/trunk:aconfig_value_set-aosp-trunk"),
-]
+] + platform_version_flags
diff --git a/build_config/trunk_food.bzl b/build_config/trunk_food.bzl
index 8f89115..7b4e2d9 100644
--- a/build_config/trunk_food.bzl
+++ b/build_config/trunk_food.bzl
@@ -22,8 +22,9 @@
 #
 
 load("//build/make/core/release_config.bzl", "value")
+load("//build/release/build_config/trunk_versions.bzl", "platform_version_flags")
 
 # Flags should be alphabetical by flag name to reduce merge conflifcts
 values = [
     value("RELEASE_ACONFIG_VALUE_SETS", "//build/release/aconfig/trunk_food:aconfig_value_set-aosp-trunk_food"),
-]
+] + platform_version_flags
diff --git a/build_config/trunk_staging.bzl b/build_config/trunk_staging.bzl
index 468fa02..1c65fdb 100644
--- a/build_config/trunk_staging.bzl
+++ b/build_config/trunk_staging.bzl
@@ -22,6 +22,7 @@
 #
 
 load("//build/make/core/release_config.bzl", "value")
+load("//build/release/build_config/trunk_versions.bzl", "platform_version_flags")
 
 # Flags should be alphabetical by flag name to reduce merge conflifcts
 values = [
@@ -34,4 +35,5 @@
     value("RELEASE_AVF_ENABLE_REMOTE_ATTESTATION", True),
     value("RELEASE_AVF_ENABLE_VENDOR_MODULES", True),
     value("RELEASE_DEPRECATE_VNDK", True),
-]
+    value("RELEASE_BINDER_DEATH_RECIPIENT_WEAK_FROM_JNI", True),
+] + platform_version_flags
diff --git a/build_config/trunk_versions.bzl b/build_config/trunk_versions.bzl
new file mode 100644
index 0000000..40eb2f8
--- /dev/null
+++ b/build_config/trunk_versions.bzl
@@ -0,0 +1,30 @@
+"""
+Common version flags used by all trunk based release configs.
+"""
+# Copyright (C) 2023 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("//build/make/core/release_config.bzl", "value")
+
+platform_version_flags = [
+    value("RELEASE_PLATFORM_VERSION", "ZP1A"),
+    value("RELEASE_PLATFORM_SDK_VERSION", "34"),
+    value("RELEASE_PLATFORM_SDK_EXTENSION_VERSION", "10"),
+    value("RELEASE_PLATFORM_SECURITY_PATCH", "2023-12-05"),
+    value("RELEASE_PLATFORM_VERSION_CODENAME", "VanillaIceCream"),
+    value("RELEASE_PLATFORM_VERSION_ALL_CODENAMES", "UpsideDownCake,VanillaIceCream"),
+    value("RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES", "UpsideDownCake,VanillaIceCream"),
+    value("RELEASE_PLATFORM_VERSION_LAST_STABLE", "14"),
+    value("RELEASE_PLATFORM_VNDK_VERSION", "35"),
+]
diff --git a/build_flags.bzl b/build_flags.bzl
index d31212b..f556c93 100644
--- a/build_flags.bzl
+++ b/build_flags.bzl
@@ -85,13 +85,45 @@
     # This flag will control the rollout of new versions of the SoundPicker app.
     flag("RELEASE_PACKAGE_SOUND_PICKER", ALL, "SoundPicker"),
 
+    # The name of the virtual camera package to add to the system partition.
+    flag("RELEASE_PACKAGE_VIRTUAL_CAMERA", SYSTEM, ""),
+
     # The platform version.
     # TODO(joeo): Remove the default here. Maybe for platform builds not having
     # a version should be an error and should be allowed for unbundled builds.
+    # The platform version. This is the 4 letter code, e.g. UD1A, UPB1, ZP1A, etc.
     flag("RELEASE_PLATFORM_VERSION", ALL, "VP1A"),
 
-    # Set to true when the current platform version should be marked as REL.
-    flag("RELEASE_PLATFORM_VERSION_CODENAME_REL", ALL, ""),
+    #  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.
+    #  It must be of the form "YYYY-MM-DD" on production devices.
+    #  It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
+    #  If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
+    flag("RELEASE_PLATFORM_SECURITY_PATCH", ALL, "2023-12-05"),
+
+    # The SDK version of the platform, e.g. 34 for UDC. This should only be increased
+    # when the API is finalized and the codename is set to rel, not during development.
+    flag("RELEASE_PLATFORM_SDK_VERSION", ALL, "34"),
+
+    # The sdk extension version of this release configuration.
+    flag("RELEASE_PLATFORM_SDK_EXTENSION_VERSION", ALL, "10"),
+
+    # Set to REL for production platform builds, otherwise the codename string,
+    # e.g. UpsideDownCake or VanillaIceCream
+    flag("RELEASE_PLATFORM_VERSION_CODENAME", ALL, "VanillaIceCream"),
+
+    # A comma separated list of all codenames that are in preview.
+    # This variable is sort of a lie for historical reasons and only
+    # includes codenames up to and including the currently active codename
+    flag("RELEASE_PLATFORM_VERSION_ALL_CODENAMES", ALL, "VanillaIceCream"),
+
+    # A comma separated list of all preview codenames the platform will accept apps built against
+    flag("RELEASE_PLATFORM_VERSION_ALL_PREVIEW_CODENAMES", ALL, "VanillaIceCream"),
+
+    # 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.
+    flag("RELEASE_PLATFORM_VERSION_LAST_STABLE", ALL, "14"),
 
     # The PLATFORM_VNDK_VERSION will be set to this version when the
     # PLATFORM_VERSION_CODENAME is REL. This VNDK version flag will be removed