summaryrefslogtreecommitdiff
path: root/apex
diff options
context:
space:
mode:
Diffstat (limited to 'apex')
-rw-r--r--apex/apex.go28
-rw-r--r--apex/apex_test.go55
2 files changed, 69 insertions, 14 deletions
diff --git a/apex/apex.go b/apex/apex.go
index cf18ec31d..50c9957b0 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1828,6 +1828,7 @@ type androidApp interface {
Certificate() java.Certificate
BaseModuleName() string
LintDepSets() java.LintDepSets
+ PrivAppAllowlist() android.OptionalPath
}
var _ androidApp = (*java.AndroidApp)(nil)
@@ -1848,7 +1849,7 @@ func sanitizedBuildIdForPath(ctx android.BaseModuleContext) string {
return buildId
}
-func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp androidApp) apexFile {
+func apexFilesForAndroidApp(ctx android.BaseModuleContext, aapp androidApp) []apexFile {
appDir := "app"
if aapp.Privileged() {
appDir = "priv-app"
@@ -1870,7 +1871,15 @@ func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp androidApp) apexF
}); ok {
af.overriddenPackageName = app.OverriddenManifestPackageName()
}
- return af
+ apexFiles := []apexFile{af}
+
+ if allowlist := aapp.PrivAppAllowlist(); allowlist.Valid() {
+ dirInApex := filepath.Join("etc", "permissions")
+ privAppAllowlist := newApexFile(ctx, allowlist.Path(), aapp.BaseModuleName()+"privapp", dirInApex, etc, aapp)
+ apexFiles = append(apexFiles, privAppAllowlist)
+ }
+
+ return apexFiles
}
func apexFileForRuntimeResourceOverlay(ctx android.BaseModuleContext, rro java.RuntimeResourceOverlayModule) apexFile {
@@ -2315,12 +2324,12 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
case androidAppTag:
switch ap := child.(type) {
case *java.AndroidApp:
- vctx.filesInfo = append(vctx.filesInfo, apexFileForAndroidApp(ctx, ap))
+ vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, ap)...)
return true // track transitive dependencies
case *java.AndroidAppImport:
- vctx.filesInfo = append(vctx.filesInfo, apexFileForAndroidApp(ctx, ap))
+ vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, ap)...)
case *java.AndroidTestHelperApp:
- vctx.filesInfo = append(vctx.filesInfo, apexFileForAndroidApp(ctx, ap))
+ vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, ap)...)
case *java.AndroidAppSet:
appDir := "app"
if ap.Privileged() {
@@ -3423,15 +3432,6 @@ func makeApexAvailableBaseline() map[string][]string {
// Module separator
//
m[android.AvailableToAnyApex] = []string{
- // TODO(b/156996905) Set apex_available/min_sdk_version for androidx/extras support libraries
- "androidx",
- "androidx-constraintlayout_constraintlayout",
- "androidx-constraintlayout_constraintlayout-nodeps",
- "androidx-constraintlayout_constraintlayout-solver",
- "androidx-constraintlayout_constraintlayout-solver-nodeps",
- "com.google.android.material_material",
- "com.google.android.material_material-nodeps",
-
"libclang_rt",
"libprofile-clang-extras",
"libprofile-clang-extras_ndk",
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 3ba4d8d55..e4b0323e3 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -33,6 +33,7 @@ import (
"android/soong/cc"
"android/soong/dexpreopt"
prebuilt_etc "android/soong/etc"
+ "android/soong/filesystem"
"android/soong/java"
"android/soong/rust"
"android/soong/sh"
@@ -6045,6 +6046,8 @@ func TestApexWithApps(t *testing.T) {
sdk_version: "current",
system_modules: "none",
privileged: true,
+ privapp_allowlist: "perms.xml",
+ package_name: "com.android.AppFooPriv",
stl: "none",
apex_available: [ "myapex" ],
}
@@ -6074,6 +6077,7 @@ func TestApexWithApps(t *testing.T) {
ensureContains(t, copyCmds, "image.apex/app/AppFoo@TEST.BUILD_ID/AppFoo.apk")
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv@TEST.BUILD_ID/AppFooPriv.apk")
+ ensureContains(t, copyCmds, "image.apex/etc/permissions/privapp_allowlist_com.android.AppFooPriv.xml")
appZipRule := ctx.ModuleForTests("AppFoo", "android_common_apex10000").Description("zip jni libs")
// JNI libraries are uncompressed
@@ -10375,3 +10379,54 @@ func TestStubLibrariesMultipleApexViolation(t *testing.T) {
}
}
}
+
+func TestFileSystemShouldSkipApexLibraries(t *testing.T) {
+ context := android.GroupFixturePreparers(
+ android.PrepareForIntegrationTestWithAndroid,
+ cc.PrepareForIntegrationTestWithCc,
+ PrepareForTestWithApexBuildComponents,
+ prepareForTestWithMyapex,
+ filesystem.PrepareForTestWithFilesystemBuildComponents,
+ )
+ result := context.RunTestWithBp(t, `
+ android_system_image {
+ name: "myfilesystem",
+ deps: [
+ "libfoo",
+ ],
+ linker_config_src: "linker.config.json",
+ }
+
+ cc_library {
+ name: "libfoo",
+ shared_libs: [
+ "libbar",
+ ],
+ stl: "none",
+ }
+
+ cc_library {
+ name: "libbar",
+ stl: "none",
+ apex_available: ["myapex"],
+ }
+
+ apex {
+ name: "myapex",
+ native_shared_libs: ["libbar"],
+ key: "myapex.key",
+ updatable: false,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+
+ inputs := result.ModuleForTests("myfilesystem", "android_common").Output("deps.zip").Implicits
+ android.AssertStringListDoesNotContain(t, "filesystem should not have libbar",
+ inputs.Strings(),
+ "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so")
+}