diff options
author | 2025-02-27 14:30:01 +0900 | |
---|---|---|
committer | 2025-02-27 14:34:43 +0900 | |
commit | 13e919154dcb65a4cb06b6bf434744d08e7fdd28 (patch) | |
tree | eb72982e3f548dd8e7a554e00c9842d08ef677fd | |
parent | 5499b7a8b8f87faeb7b968d98d5330cdb7bce4dd (diff) |
apex: disallow VINTF fragments in updatable APEX
Since libvintf doesn't support forward compatibility, updatable APEXes
shouldn't have VINTF fragments.
Bug: 399527905
Test: m nothing --no-skip-soong-tests
Change-Id: Ie0f1b4599f27d9aa478aac689dd167e77b3733b8
-rw-r--r-- | apex/apex.go | 15 | ||||
-rw-r--r-- | apex/apex_test.go | 27 |
2 files changed, 42 insertions, 0 deletions
diff --git a/apex/apex.go b/apex/apex.go index 4dd3d4cc0..38381aeed 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -18,6 +18,7 @@ package apex import ( "fmt" + "path" "path/filepath" "regexp" "slices" @@ -2258,6 +2259,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.enforcePartitionTagOnApexSystemServerJar(ctx) a.verifyNativeImplementationLibs(ctx) + a.enforceNoVintfInUpdatable(ctx) android.SetProvider(ctx, android.ApexBundleDepsDataProvider, android.ApexBundleDepsData{ FlatListPath: a.FlatListPath(), @@ -2916,3 +2918,16 @@ func (a *apexBundle) verifyNativeImplementationLibs(ctx android.ModuleContext) { } } } + +// TODO(b/399527905) libvintf is not forward compatible. +func (a *apexBundle) enforceNoVintfInUpdatable(ctx android.ModuleContext) { + if !a.Updatable() { + return + } + for _, fi := range a.filesInfo { + if match, _ := path.Match("etc/vintf/*", fi.path()); match { + ctx.ModuleErrorf("VINTF fragment (%s) is not supported in updatable APEX.", fi.path()) + break + } + } +} diff --git a/apex/apex_test.go b/apex/apex_test.go index 9eaf814d0..a0a42a149 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -12216,3 +12216,30 @@ func TestVintfFragmentInApex(t *testing.T) { // Ensure that vintf fragment file is being installed ensureContains(t, cmd, "/etc/vintf/my_vintf_fragment.xml ") } + +func TestNoVintfFragmentInUpdatableApex(t *testing.T) { + t.Parallel() + testApexError(t, `VINTF fragment .* is not supported in updatable APEX`, apex_default_bp+` + apex { + name: "myapex", + manifest: ":myapex.manifest", + key: "myapex.key", + binaries: [ "mybin" ], + updatable: true, + min_sdk_version: "29", + } + + cc_binary { + name: "mybin", + srcs: ["mybin.cpp"], + vintf_fragment_modules: ["my_vintf_fragment.xml"], + apex_available: [ "myapex" ], + min_sdk_version: "29", + } + + vintf_fragment { + name: "my_vintf_fragment.xml", + src: "my_vintf_fragment.xml", + } + `) +} |