Merge "Add __ANDROID_SDK_VERSION__=<ver> macro" into rvc-dev
diff --git a/android/apex.go b/android/apex.go
index 5c3256a..205ec95 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -21,13 +21,14 @@
"sync"
)
+const (
+ SdkVersion_Android10 = 29
+)
+
type ApexInfo struct {
// Name of the apex variant that this module is mutated into
ApexName string
- // Whether this apex variant needs to target Android 10
- LegacyAndroid10Support bool
-
MinSdkVersion int
}
@@ -203,7 +204,7 @@
}
func (m *ApexModuleBase) ShouldSupportAndroid10() bool {
- return !m.IsForPlatform() && (m.ApexProperties.Info.MinSdkVersion <= 29 || m.ApexProperties.Info.LegacyAndroid10Support)
+ return !m.IsForPlatform() && (m.ApexProperties.Info.MinSdkVersion <= SdkVersion_Android10)
}
func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
diff --git a/apex/apex.go b/apex/apex.go
index 987a118..b833634 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1043,11 +1043,9 @@
var apexBundles []android.ApexInfo
var directDep bool
if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
- minSdkVersion := a.minSdkVersion(mctx)
apexBundles = []android.ApexInfo{android.ApexInfo{
- ApexName: mctx.ModuleName(),
- LegacyAndroid10Support: proptools.Bool(a.properties.Legacy_android10_support),
- MinSdkVersion: minSdkVersion,
+ ApexName: mctx.ModuleName(),
+ MinSdkVersion: a.minSdkVersion(mctx),
}}
directDep = true
} else if am, ok := mctx.Module().(android.ApexModule); ok {
@@ -1295,10 +1293,6 @@
// Should be only used in tests#.
Test_only_no_hashtree *bool
- // Whether this APEX should support Android10. Default is false. If this is set true, then apex_manifest.json is bundled as well
- // because Android10 requires legacy apex_manifest.json instead of apex_manifest.pb
- Legacy_android10_support *bool
-
IsCoverageVariant bool `blueprint:"mutated"`
// Whether this APEX is considered updatable or not. When set to true, this will enforce additional
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 77d3bee..e92c278 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -1856,13 +1856,17 @@
var surplus []string
filesMatched := make(map[string]bool)
for _, file := range getFiles(t, ctx, moduleName, variant) {
+ mactchFound := false
for _, expected := range files {
if matched, _ := path.Match(expected, file.path); matched {
filesMatched[expected] = true
- return
+ mactchFound = true
+ break
}
}
- surplus = append(surplus, file.path)
+ if !mactchFound {
+ surplus = append(surplus, file.path)
+ }
}
if len(surplus) > 0 {
@@ -1929,8 +1933,10 @@
ensureExactContents(t, ctx, "myapex", "android_common_image", []string{
"lib/libvndk.so",
"lib/libvndksp.so",
+ "lib/libc++.so",
"lib64/libvndk.so",
"lib64/libvndksp.so",
+ "lib64/libc++.so",
"etc/llndk.libraries.VER.txt",
"etc/vndkcore.libraries.VER.txt",
"etc/vndksp.libraries.VER.txt",
@@ -1990,6 +1996,8 @@
"lib/libvndk.so",
"lib/libvndk.arm.so",
"lib64/libvndk.so",
+ "lib/libc++.so",
+ "lib64/libc++.so",
"etc/*",
})
}
@@ -2201,6 +2209,8 @@
ensureExactContents(t, ctx, "myapex", "android_common_image", []string{
"lib/libvndk.so",
"lib64/libvndk.so",
+ "lib/libc++.so",
+ "lib64/libc++.so",
"etc/*",
})
}
@@ -3648,7 +3658,7 @@
name: "myapex",
key: "myapex.key",
native_shared_libs: ["mylib"],
- legacy_android10_support: true,
+ min_sdk_version: "29",
}
apex_key {
diff --git a/apex/builder.go b/apex/builder.go
index 5f4bcd2..54557bb 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -20,6 +20,7 @@
"path/filepath"
"runtime"
"sort"
+ "strconv"
"strings"
"android/soong/android"
@@ -195,7 +196,7 @@
},
})
- if proptools.Bool(a.properties.Legacy_android10_support) {
+ if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
// b/143654022 Q apexd can't understand newly added keys in apex_manifest.json
// prepare stripped-down version so that APEX modules built from R+ can be installed to Q
a.manifestJsonOut = android.PathForModuleOut(ctx, "apex_manifest.json")
@@ -344,7 +345,7 @@
var emitCommands []string
imageContentFile := android.PathForModuleOut(ctx, "content.txt")
emitCommands = append(emitCommands, "echo ./apex_manifest.pb >> "+imageContentFile.String())
- if proptools.Bool(a.properties.Legacy_android10_support) {
+ if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
emitCommands = append(emitCommands, "echo ./apex_manifest.json >> "+imageContentFile.String())
}
for _, fi := range a.filesInfo {
@@ -443,10 +444,9 @@
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
minSdkVersion := ctx.Config().DefaultAppTargetSdk()
- // TODO: this should be based on min_sdk_version property of an APEX.
- if proptools.Bool(a.properties.Legacy_android10_support) {
- targetSdkVersion = "29"
- minSdkVersion = "29"
+ if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
+ minSdkVersion = strconv.Itoa(a.minSdkVersion(ctx))
+ targetSdkVersion = strconv.Itoa(a.minSdkVersion(ctx))
}
if java.UseApiFingerprint(ctx) {
@@ -475,7 +475,7 @@
ctx.PropertyErrorf("test_only_no_hashtree", "not available")
return
}
- if !proptools.Bool(a.properties.Legacy_android10_support) || a.testOnlyShouldSkipHashtreeGeneration() {
+ if a.minSdkVersion(ctx) > android.SdkVersion_Android10 || a.testOnlyShouldSkipHashtreeGeneration() {
// Apexes which are supposed to be installed in builtin dirs(/system, etc)
// don't need hashtree for activation. Therefore, by removing hashtree from
// apex bundle (filesystem image in it, to be specific), we can save storage.
@@ -488,7 +488,7 @@
optFlags = append(optFlags, "--do_not_check_keyname")
}
- if proptools.Bool(a.properties.Legacy_android10_support) {
+ if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
implicitInputs = append(implicitInputs, a.manifestJsonOut)
optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String())
}