summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/androidmk.go2
-rw-r--r--java/app.go17
-rw-r--r--java/base.go29
-rw-r--r--java/java.go2
4 files changed, 34 insertions, 16 deletions
diff --git a/java/androidmk.go b/java/androidmk.go
index 35024c1d6..b6bab5332 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -408,7 +408,7 @@ func (a *AutogenRuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEn
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_CERTIFICATE", "presigned") // The apk will be signed by soong
+ entries.SetString("LOCAL_CERTIFICATE", "PRESIGNED") // The apk will be signed by soong
},
},
}}
diff --git a/java/app.go b/java/app.go
index 34884d75c..8739d1c18 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1102,7 +1102,18 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
app.SdkVersion(ctx).Kind != android.SdkCorePlatform && !app.RequiresStableAPIs(ctx)
}
jniLib, prebuiltJniPackages := collectJniDeps(ctx, shouldCollectRecursiveNativeDeps,
- checkNativeSdkVersion, func(dep cc.LinkableInterface) bool { return !dep.IsNdk(ctx.Config()) && !dep.IsStubs() })
+ checkNativeSdkVersion, func(parent, child android.Module) bool {
+ apkInApex := ctx.Module().(android.ApexModule).NotInPlatform()
+ childLinkable, _ := child.(cc.LinkableInterface)
+ parentLinkable, _ := parent.(cc.LinkableInterface)
+ useStubsOfDep := childLinkable.IsStubs()
+ if apkInApex && parentLinkable != nil {
+ // APK-in-APEX
+ // If the parent is a linkable interface, use stubs if the dependency edge crosses an apex boundary.
+ useStubsOfDep = useStubsOfDep || (childLinkable.HasStubsVariants() && cc.ShouldUseStubForApex(ctx, parent, child))
+ }
+ return !childLinkable.IsNdk(ctx.Config()) && !useStubsOfDep
+ })
var certificates []Certificate
@@ -1137,7 +1148,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
func collectJniDeps(ctx android.ModuleContext,
shouldCollectRecursiveNativeDeps bool,
checkNativeSdkVersion bool,
- filter func(cc.LinkableInterface) bool) ([]jniLib, android.Paths) {
+ filter func(parent, child android.Module) bool) ([]jniLib, android.Paths) {
var jniLibs []jniLib
var prebuiltJniPackages android.Paths
seenModulePaths := make(map[string]bool)
@@ -1148,7 +1159,7 @@ func collectJniDeps(ctx android.ModuleContext,
if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) {
if dep, ok := module.(cc.LinkableInterface); ok {
- if filter != nil && !filter(dep) {
+ if filter != nil && !filter(parent, module) {
return false
}
diff --git a/java/base.go b/java/base.go
index 3bf2e23d8..c0ac4ab99 100644
--- a/java/base.go
+++ b/java/base.go
@@ -612,21 +612,24 @@ func (j *Module) IsStubsModule() bool {
return proptools.Bool(j.properties.Is_stubs_module)
}
-func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
- sdkVersion := j.SdkVersion(ctx)
- if sdkVersion.Stable() {
- return nil
- }
- if sdkVersion.Kind == android.SdkCorePlatform {
- if useLegacyCorePlatformApi(ctx, j.BaseModuleName()) {
- return fmt.Errorf("non stable SDK %v - uses legacy core platform", sdkVersion)
- } else {
- // Treat stable core platform as stable.
+func CheckStableSdkVersion(ctx android.BaseModuleContext, module android.ModuleProxy) error {
+ if info, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
+ if info.SdkVersion.Stable() {
return nil
}
- } else {
- return fmt.Errorf("non stable SDK %v", sdkVersion)
+ if info.SdkVersion.Kind == android.SdkCorePlatform {
+ if useLegacyCorePlatformApi(ctx, android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoKey).BaseModuleName) {
+ return fmt.Errorf("non stable SDK %v - uses legacy core platform", info.SdkVersion)
+ } else {
+ // Treat stable core platform as stable.
+ return nil
+ }
+ } else {
+ return fmt.Errorf("non stable SDK %v", info.SdkVersion)
+ }
}
+
+ return nil
}
// checkSdkVersions enforces restrictions around SDK dependencies.
@@ -1300,6 +1303,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
StubsLinkType: j.stubsLinkType,
AconfigIntermediateCacheOutputPaths: deps.aconfigProtoFiles,
+ SdkVersion: j.SdkVersion(ctx),
})
j.outputFile = j.headerJarFile
@@ -1929,6 +1933,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
JacocoReportClassesFile: j.jacocoReportClassesFile,
StubsLinkType: j.stubsLinkType,
AconfigIntermediateCacheOutputPaths: j.aconfigCacheFiles,
+ SdkVersion: j.SdkVersion(ctx),
})
// Save the output file with no relative path so that it doesn't end up in a subdirectory when used as a resource
diff --git a/java/java.go b/java/java.go
index 260d33610..ee112c1da 100644
--- a/java/java.go
+++ b/java/java.go
@@ -326,6 +326,8 @@ type JavaInfo struct {
// AconfigIntermediateCacheOutputPaths is a path to the cache files collected from the
// java_aconfig_library modules that are statically linked to this module.
AconfigIntermediateCacheOutputPaths android.Paths
+
+ SdkVersion android.SdkSpec
}
var JavaInfoProvider = blueprint.NewProvider[*JavaInfo]()