Merge "Clean up rust tests."
diff --git a/android/apex.go b/android/apex.go
index 9bf6fc7..839a03a 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -32,6 +32,7 @@
ApexName string
MinSdkVersion int
+ Updatable bool
}
// Extracted from ApexModule to make it easier to define custom subsets of the
@@ -104,6 +105,9 @@
// For example, with maxSdkVersion is 10 and versionList is [9,11]
// it returns 9 as string
ChooseSdkVersion(versionList []string, maxSdkVersion int) (string, error)
+
+ // Tests if the module comes from an updatable APEX.
+ Updatable() bool
}
type ApexProperties struct {
@@ -229,6 +233,10 @@
}
}
+func (m *ApexModuleBase) Updatable() bool {
+ return m.ApexProperties.Info.Updatable
+}
+
type byApexName []ApexInfo
func (a byApexName) Len() int { return len(a) }
diff --git a/apex/apex.go b/apex/apex.go
index 8463ac1..3b17886 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -562,7 +562,6 @@
"libnativebridge_lazy",
"libnativeloader_lazy",
"libnativewindow_headers",
- "libopus",
"libpdx_headers",
"libprocessgroup",
"libprocessgroup_headers",
@@ -845,6 +844,7 @@
apexBundles = []android.ApexInfo{{
ApexName: mctx.ModuleName(),
MinSdkVersion: a.minSdkVersion(mctx),
+ Updatable: proptools.Bool(a.properties.Updatable),
}}
directDep = true
} else if am, ok := mctx.Module().(android.ApexModule); ok {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 9f55728..eabbdac 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3428,6 +3428,7 @@
dex_preopt: {
enabled: false,
},
+ apex_available: ["myapex"],
}
android_app_import {
@@ -3439,6 +3440,7 @@
enabled: false,
},
filename: "AwesomePrebuiltAppFooPriv.apk",
+ apex_available: ["myapex"],
}
`)
@@ -3480,6 +3482,7 @@
filename: "AppFooPrebuilt.apk",
presigned: true,
prefer: true,
+ apex_available: ["myapex"],
}
`, withFiles(map[string][]byte{
"AppFooPrebuilt.apk": nil,
@@ -4276,6 +4279,13 @@
"system/sepolicy/apex/some-updatable-apex-file_contexts",
],
}
+
+ filegroup {
+ name: "some-non-updatable-apex-file_contexts",
+ srcs: [
+ "system/sepolicy/apex/some-non-updatable-apex-file_contexts",
+ ],
+ }
`
bp += cc.GatherRequiredDepsForTest(android.Android)
bp += java.GatherRequiredDepsForTest()
@@ -4288,6 +4298,7 @@
"apex_manifest.json": nil,
"AndroidManifest.xml": nil,
"system/sepolicy/apex/some-updatable-apex-file_contexts": nil,
+ "system/sepolicy/apex/some-non-updatable-apex-file_contexts": nil,
"system/sepolicy/apex/com.android.art.something-file_contexts": nil,
"framework/aidl/a.aidl": nil,
}
@@ -4342,6 +4353,14 @@
}
java_library {
+ name: "some-non-updatable-apex-lib",
+ srcs: ["a.java"],
+ apex_available: [
+ "some-non-updatable-apex",
+ ],
+ }
+
+ java_library {
name: "some-platform-lib",
srcs: ["a.java"],
installable: true,
@@ -4360,16 +4379,28 @@
name: "some-updatable-apex",
key: "some-updatable-apex.key",
java_libs: ["some-updatable-apex-lib"],
+ updatable: true,
+ }
+
+ apex {
+ name: "some-non-updatable-apex",
+ key: "some-non-updatable-apex.key",
+ java_libs: ["some-non-updatable-apex-lib"],
}
apex_key {
name: "some-updatable-apex.key",
}
+ apex_key {
+ name: "some-non-updatable-apex.key",
+ }
+
apex {
name: "com.android.art.something",
key: "com.android.art.something.key",
java_libs: ["some-art-lib"],
+ updatable: true,
}
apex_key {
@@ -4400,6 +4431,13 @@
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
+ // non-updatable jar from some other apex in the ART boot image => error
+ error = "module 'some-non-updatable-apex-lib' is not allowed in the ART boot image"
+ transform = func(config *dexpreopt.GlobalConfig) {
+ config.ArtApexJars = []string{"some-non-updatable-apex-lib"}
+ }
+ testNoUpdatableJarsInBootImage(t, error, bp, transform)
+
// updatable jar from some other apex in the framework boot image => error
error = "module 'some-updatable-apex-lib' from updatable apex 'some-updatable-apex' is not allowed in the framework boot image"
transform = func(config *dexpreopt.GlobalConfig) {
@@ -4407,6 +4445,12 @@
}
testNoUpdatableJarsInBootImage(t, error, bp, transform)
+ // non-updatable jar from some other apex in the framework boot image => ok
+ transform = func(config *dexpreopt.GlobalConfig) {
+ config.BootJars = []string{"some-non-updatable-apex-lib"}
+ }
+ testNoUpdatableJarsInBootImage(t, "", bp, transform)
+
// nonexistent jar in the ART boot image => error
error = "failed to find a dex jar path for module 'nonexistent'"
transform = func(config *dexpreopt.GlobalConfig) {
@@ -4422,7 +4466,7 @@
testNoUpdatableJarsInBootImage(t, error, bp, transform)
// platform jar in the ART boot image => error
- error = "module 'some-platform-lib' is part of the platform and not allowed in the ART boot image"
+ error = "module 'some-platform-lib' is not allowed in the ART boot image"
transform = func(config *dexpreopt.GlobalConfig) {
config.ArtApexJars = []string{"some-platform-lib"}
}
diff --git a/java/androidmk.go b/java/androidmk.go
index 7d57525..68da23e 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -626,6 +626,11 @@
}
func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
+ if !a.IsForPlatform() {
+ // The non-platform variant is placed inside APEX. No reason to
+ // make it available to Make.
+ return nil
+ }
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "APPS",
OutputFile: android.OptionalPathForPath(a.outputFile),
diff --git a/java/app.go b/java/app.go
index 7d509ee..afc4a60 100755
--- a/java/app.go
+++ b/java/app.go
@@ -986,6 +986,7 @@
type AndroidAppImport struct {
android.ModuleBase
android.DefaultableModuleBase
+ android.ApexModuleBase
prebuilt android.Prebuilt
properties AndroidAppImportProperties
@@ -1223,7 +1224,9 @@
// TODO: Optionally compress the output apk.
- a.installPath = ctx.InstallFile(installDir, apkFilename, a.outputFile)
+ if a.IsForPlatform() {
+ a.installPath = ctx.InstallFile(installDir, apkFilename, a.outputFile)
+ }
// TODO: androidmk converter jni libs
}
@@ -1274,6 +1277,13 @@
return Bool(a.properties.Privileged)
}
+func (a *AndroidAppImport) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
+ // android_app_import might have extra dependencies via uses_libs property.
+ // Don't track the dependency as we don't automatically add those libraries
+ // to the classpath. It should be explicitly added to java_libs property of APEX
+ return false
+}
+
func createVariantGroupType(variants []string, variantGroupName string) reflect.Type {
props := reflect.TypeOf((*AndroidAppImportProperties)(nil))
@@ -1320,6 +1330,7 @@
module.processVariants(ctx)
})
+ android.InitApexModule(module)
InitJavaModule(module, android.DeviceSupported)
android.InitSingleSourcePrebuiltModule(module, &module.properties, "Apk")
@@ -1357,6 +1368,7 @@
module.processVariants(ctx)
})
+ android.InitApexModule(module)
InitJavaModule(module, android.DeviceSupported)
android.InitSingleSourcePrebuiltModule(module, &module.properties, "Apk")
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 543b233..c3825cb 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -268,27 +268,28 @@
// Check that this module satisfies constraints for a particular boot image.
apex, isApexModule := module.(android.ApexModule)
+ fromUpdatableApex := isApexModule && apex.Updatable()
if image.name == artBootImageName {
if isApexModule && strings.HasPrefix(apex.ApexName(), "com.android.art.") {
- // ok, found the jar in the ART apex
- } else if isApexModule && !apex.IsForPlatform() {
- // this jar is part of an updatable apex other than ART, fail immediately
- ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexName())
+ // ok: found the jar in the ART apex
} else if isApexModule && apex.IsForPlatform() && Bool(module.(*Library).deviceProperties.Hostdex) {
- // this is a special "hostdex" variant, skip it and resume search
+ // exception (skip and continue): special "hostdex" platform variant
return -1, nil
} else if name == "jacocoagent" && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
- // this is Jacoco platform variant for a coverage build, skip it and resume search
+ // exception (skip and continue): Jacoco platform variant for a coverage build
return -1, nil
+ } else if fromUpdatableApex {
+ // error: this jar is part of an updatable apex other than ART
+ ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexName())
} else {
- // this (installable) jar is part of the platform, fail immediately
- ctx.Errorf("module '%s' is part of the platform and not allowed in the ART boot image", name)
+ // error: this jar is part of the platform or a non-updatable apex
+ ctx.Errorf("module '%s' is not allowed in the ART boot image", name)
}
} else if image.name == frameworkBootImageName {
- if !isApexModule || apex.IsForPlatform() {
- // ok, this jar is part of the platform
+ if !fromUpdatableApex {
+ // ok: this jar is part of the platform or a non-updatable apex
} else {
- // this jar is part of an updatable apex, fail immediately
+ // error: this jar is part of an updatable apex
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the framework boot image", name, apex.ApexName())
}
} else {
diff --git a/rust/config/global.go b/rust/config/global.go
index 690d83e..c0bd0f2 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -24,7 +24,7 @@
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
- RustDefaultVersion = "1.40.0"
+ RustDefaultVersion = "1.42.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{
diff --git a/scripts/build-mainline-modules.sh b/scripts/build-mainline-modules.sh
index 79e40dd..fc91c3d 100755
--- a/scripts/build-mainline-modules.sh
+++ b/scripts/build-mainline-modules.sh
@@ -18,6 +18,7 @@
art-module-test-exports
conscrypt-module-sdk
conscrypt-module-test-exports
+ conscrypt-module-host-exports
)
# We want to create apex modules for all supported architectures.