Merge "Only dist apex sizes for checkbuild" into rvc-dev
diff --git a/apex/apex.go b/apex/apex.go
index 712afe4..ffdaff1 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2235,7 +2235,8 @@
return true // track transitive dependencies
}
} else if java.IsJniDepTag(depTag) {
- return true
+ // Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
+ return false
} else if java.IsXmlPermissionsFileDepTag(depTag) {
if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
@@ -2328,6 +2329,11 @@
a.linkToSystemLib = false
}
+ // We also don't want the optimization for host APEXes, because it doesn't make sense.
+ if ctx.Host() {
+ a.linkToSystemLib = false
+ }
+
// prepare apex_manifest.json
a.buildManifest(ctx, provideNativeLibs, requireNativeLibs)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e694435..b56909c 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2889,9 +2889,19 @@
cc_library_shared {
name: "libjni",
srcs: ["mylib.cpp"],
+ shared_libs: ["libfoo"],
stl: "none",
system_shared_libs: [],
apex_available: [ "myapex" ],
+ sdk_version: "current",
+ }
+
+ cc_library_shared {
+ name: "libfoo",
+ stl: "none",
+ system_shared_libs: [],
+ apex_available: [ "myapex" ],
+ sdk_version: "current",
}
`)
@@ -2902,16 +2912,19 @@
ensureContains(t, copyCmds, "image.apex/app/AppFoo/AppFoo.apk")
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv/AppFooPriv.apk")
- // JNI libraries are embedded inside APK
- appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Description("zip jni lib")
- libjniOutput := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module).OutputFile()
- ensureListContains(t, appZipRule.Implicits.Strings(), libjniOutput.String())
- // ... uncompressed
+ appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Description("zip jni libs")
+ // JNI libraries are uncompressed
if args := appZipRule.Args["jarArgs"]; !strings.Contains(args, "-L 0") {
- t.Errorf("jni lib is not uncompressed for AppFoo")
+ t.Errorf("jni libs are not uncompressed for AppFoo")
}
- // ... and not directly inside the APEX
- ensureNotContains(t, copyCmds, "image.apex/lib64/libjni.so")
+ // JNI libraries including transitive deps are
+ for _, jni := range []string{"libjni", "libfoo"} {
+ jniOutput := ctx.ModuleForTests(jni, "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module).OutputFile()
+ // ... embedded inside APK (jnilibs.zip)
+ ensureListContains(t, appZipRule.Implicits.Strings(), jniOutput.String())
+ // ... and not directly inside the APEX
+ ensureNotContains(t, copyCmds, "image.apex/lib64/"+jni+".so")
+ }
}
func TestApexWithAppImports(t *testing.T) {
diff --git a/java/config/config.go b/java/config/config.go
index 03588dc..487dc04 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -50,7 +50,7 @@
"updatable-media",
"framework-mediaprovider",
"framework-sdkextensions",
- "ike",
+ "android.net.ipsec.ike",
}
)
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index 6020aba..8f34714 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -159,9 +159,21 @@
tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
tmpDir = android.PathForModuleOut(ctx, "hiddenapi", "unaligned")
}
+
+ enforceHiddenApiFlagsToAllMembers := true
// If frameworks/base doesn't exist we must be building with the 'master-art' manifest.
// Disable assertion that all methods/fields have hidden API flags assigned.
if !ctx.Config().FrameworksBaseDirExists(ctx) {
+ enforceHiddenApiFlagsToAllMembers = false
+ }
+ // b/149353192: when a module is instrumented, jacoco adds synthetic members
+ // $jacocoData and $jacocoInit. Since they don't exist when building the hidden API flags,
+ // don't complain when we don't find hidden API flags for the synthetic members.
+ if j, ok := ctx.Module().(*Library); ok && j.shouldInstrument(ctx) {
+ enforceHiddenApiFlagsToAllMembers = false
+ }
+
+ if !enforceHiddenApiFlagsToAllMembers {
hiddenapiFlags = "--no-force-assign-all"
}
diff --git a/java/java.go b/java/java.go
index c89784a..8d58a90 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1521,6 +1521,14 @@
j.headerJarFile = j.implementationJarFile
}
+ // Force enable the instrumentation for java code that is built for APEXes ...
+ // except for the jacocoagent itself (because instrumenting jacocoagent using jacocoagent
+ // doesn't make sense)
+ isJacocoAgent := ctx.ModuleName() == "jacocoagent"
+ if android.DirectlyInAnyApex(ctx, ctx.ModuleName()) && !isJacocoAgent && !j.IsForPlatform() {
+ j.properties.Instrument = true
+ }
+
if j.shouldInstrument(ctx) {
outputFile = j.instrument(ctx, flags, outputFile, jarName)
}