DO NOT MERGE: Make min_sdk overridable in override_apex

It makes sense to make min_sdk overridable because the override_apex is
a variant of the original apex, and this variant might be
created/introduced in the newer Android release compared with the base
apex. Despite the fact that the source of the variant apex is the same
as the original one, the variant may not support the older version, like
Go modules, trimmed modules. If we consider the variant as a "new"
module, then it makes sense to have a new min_sdk to make it only
available for the newer Android released version only. Will make change in AOSP separately.

Bug: 266945903
Test: Build locally, and check if the override works
Change-Id: I816ed020f51dae37666a0c7612dc9c11afd63b83
diff --git a/apex/apex.go b/apex/apex.go
index d5e2a3d..132b2b2 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -120,10 +120,6 @@
 	// List of filesystem images that are embedded inside this APEX bundle.
 	Filesystems []string
 
-	// The minimum SDK version that this APEX must support at minimum. This is usually set to
-	// the SDK version that the APEX was first introduced.
-	Min_sdk_version *string
-
 	// Whether this APEX is considered updatable or not. When set to true, this will enforce
 	// additional rules for making sure that the APEX is truly updatable. To be updatable,
 	// min_sdk_version should be set as well. This will also disable the size optimizations like
@@ -386,6 +382,10 @@
 	// conditions, e.g., target device needs to support APEX compression, are also fulfilled.
 	// Default: false.
 	Compressible *bool
+
+	// The minimum SDK version that this APEX must support at minimum. This is usually set to
+	// the SDK version that the APEX was first introduced.
+	Min_sdk_version *string
 }
 
 type apexBundle struct {
@@ -2550,14 +2550,14 @@
 	// min_sdk_version value is lower than the one to override with.
 	overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
 	overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
-	originalMinApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
-	isMinSdkSet := a.properties.Min_sdk_version != nil
+	originalMinApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.overridableProperties.Min_sdk_version))
+	isMinSdkSet := a.overridableProperties.Min_sdk_version != nil
 	isOverrideValueHigher := overrideApiLevel.CompareTo(originalMinApiLevel) > 0
 	if overrideMinSdkValue != "" && isMinSdkSet && isOverrideValueHigher {
 		return overrideMinSdkValue
 	}
 
-	return proptools.String(a.properties.Min_sdk_version)
+	return proptools.String(a.overridableProperties.Min_sdk_version)
 }
 
 // Returns apex's min_sdk_version SdkSpec, honoring overrides
@@ -3255,8 +3255,8 @@
 	// TODO(b/219503907) this would need to be set to a.MinSdkVersionValue(ctx) but
 	// given it's coming via config, we probably don't want to put it in here.
 	var minSdkVersion *string
-	if a.properties.Min_sdk_version != nil {
-		minSdkVersion = a.properties.Min_sdk_version
+	if a.overridableProperties.Min_sdk_version != nil {
+		minSdkVersion = a.overridableProperties.Min_sdk_version
 	}
 
 	var keyLabelAttribute bazel.LabelAttribute