vendor apex: label apex_manifest as vendor_apex_metadata_file
Since vendor APEXes are installed in vendor partition, there shouldn't
be system_file according to Treble. Instead, we can force-label / and
/apex_manifest.pb as vendor_apex_metadata_file so that apexd (and other
system components) can still read them.
Bug: 285075529
Test: m nothing (soong test)
Change-Id: Idb36b8c4c68b29e2235dbda38ee323d4b781e1d5
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 38e24e8..3844b8b 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -786,18 +786,16 @@
}
func TestFileContexts(t *testing.T) {
- for _, useFileContextsAsIs := range []bool{true, false} {
+ for _, vendor := range []bool{true, false} {
prop := ""
- if useFileContextsAsIs {
- prop = "use_file_contexts_as_is: true,\n"
+ if vendor {
+ prop = "vendor: true,\n"
}
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
- file_contexts: "file_contexts",
updatable: false,
- vendor: true,
`+prop+`
}
@@ -806,18 +804,17 @@
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
- `, withFiles(map[string][]byte{
- "file_contexts": nil,
- }))
+ `)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("file_contexts")
- forceLabellingCommand := "apex_manifest\\\\.pb u:object_r:system_file:s0"
- if useFileContextsAsIs {
- android.AssertStringDoesNotContain(t, "should force-label",
- rule.RuleParams.Command, forceLabellingCommand)
+ if vendor {
+ android.AssertStringDoesContain(t, "should force-label as vendor_apex_metadata_file",
+ rule.RuleParams.Command,
+ "apex_manifest\\\\.pb u:object_r:vendor_apex_metadata_file:s0")
} else {
- android.AssertStringDoesContain(t, "shouldn't force-label",
- rule.RuleParams.Command, forceLabellingCommand)
+ android.AssertStringDoesContain(t, "should force-label as system_file",
+ rule.RuleParams.Command,
+ "apex_manifest\\\\.pb u:object_r:system_file:s0")
}
}
}