Merge "Handle dep's required prop in test_package" into main am: 0b09af15f2 am: b2692fccc3

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

Change-Id: I4cebc58325ef299cd5af97785f05bed98fdaf006
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index 33e04a4..a15fe86 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -31,9 +31,6 @@
     pluginFor: ["soong_build"],
 }
 
-// All FlaggedApi flags associated with platform API.
-// By default this uses the platform APIs associated with android.jar
-// but other verticals/platforms can override via soong config setting.
 all_aconfig_declarations {
     name: "all_aconfig_declarations",
     visibility: [
diff --git a/android/config.go b/android/config.go
index 696e772..ded4529 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1002,6 +1002,10 @@
 	return uncheckedFinalApiLevel(*c.productVariables.Platform_sdk_version)
 }
 
+func (c *config) PlatformSdkVersionFull() string {
+	return proptools.StringDefault(c.productVariables.Platform_sdk_version_full, "")
+}
+
 func (c *config) RawPlatformSdkVersion() *int {
 	return c.productVariables.Platform_sdk_version
 }
diff --git a/android/variable.go b/android/variable.go
index af8e594..a655717 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -216,7 +216,7 @@
 	Platform_display_version_name          *string  `json:",omitempty"`
 	Platform_version_name                  *string  `json:",omitempty"`
 	Platform_sdk_version                   *int     `json:",omitempty"`
-	Platform_sdk_minor_version             *int     `json:",omitempty"`
+	Platform_sdk_version_full              *string  `json:",omitempty"`
 	Platform_sdk_codename                  *string  `json:",omitempty"`
 	Platform_sdk_version_or_codename       *string  `json:",omitempty"`
 	Platform_sdk_final                     *bool    `json:",omitempty"`
diff --git a/java/droidstubs.go b/java/droidstubs.go
index caad688..40d6f18 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -564,8 +564,18 @@
 		})
 	}
 	if apiVersions != nil {
-		cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String())
-		cmd.FlagWithArg("--current-codename ", ctx.Config().PlatformSdkCodename())
+		// We are migrating from a single API level to major.minor
+		// versions and PlatformSdkVersionFull is not yet set in all
+		// release configs. If it is not set, fall back on the single
+		// API level.
+		if fullSdkVersion := ctx.Config().PlatformSdkVersionFull(); len(fullSdkVersion) > 0 {
+			cmd.FlagWithArg("--current-version ", fullSdkVersion)
+		} else {
+			cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String())
+		}
+		if ctx.Config().PlatformSdkVersion().String() != "36" || ctx.Config().PlatformSdkCodename() != "Baklava" {
+			cmd.FlagWithArg("--current-codename ", ctx.Config().PlatformSdkCodename())
+		}
 		cmd.FlagWithInput("--apply-api-levels ", apiVersions)
 	}
 }
diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py
index a0d2546..cef7241 100644
--- a/scripts/gen_build_prop.py
+++ b/scripts/gen_build_prop.py
@@ -165,7 +165,7 @@
   print(f"ro.{partition}.build.version.release={config['Platform_version_last_stable']}")
   print(f"ro.{partition}.build.version.release_or_codename={config['Platform_version_name']}")
   print(f"ro.{partition}.build.version.sdk={config['Platform_sdk_version']}")
-  print(f"ro.{partition}.build.version.sdk_minor={build_flags['RELEASE_PLATFORM_SDK_MINOR_VERSION']}")
+  print(f"ro.{partition}.build.version.sdk_full={config['Platform_sdk_version_full']}")
 
 def generate_build_info(args):
   print()
@@ -198,7 +198,7 @@
     print(f"ro.build.display.id?={config['BuildDesc']}")
   print(f"ro.build.version.incremental={config['BuildNumber']}")
   print(f"ro.build.version.sdk={config['Platform_sdk_version']}")
-  print(f"ro.build.version.sdk_minor={build_flags['RELEASE_PLATFORM_SDK_MINOR_VERSION']}")
+  print(f"ro.build.version.sdk_full={config['Platform_sdk_version_full']}")
   print(f"ro.build.version.preview_sdk={config['Platform_preview_sdk_version']}")
   print(f"ro.build.version.preview_sdk_fingerprint={config['PlatformPreviewSdkFingerprint']}")
   print(f"ro.build.version.codename={config['Platform_sdk_codename']}")