Unconditionally install com.android.virt APEX
For devices that enable AVF (i.e. they include
p/m/Virtualization/apex/product_packages.mk) the build system install
the "full" variant of the com.android.virt APEX (i.e. with the crossvm,
virtualization_service, microdroid, et.al.).
On the other hand, for the rest of the devices (a.k.a. devices that
disable AVF) we will install "almost empty" variant of the
com.android.virt APEX (so far it only has the app that defines
permissions, soon it will also include the BCP jar).
Bug: 243512044
Test: build & flash oriole
Test: build & flash redfin
Change-Id: Ic78320b0616ff083b506c91d86f5573b39177e81
diff --git a/apex/Android.bp b/apex/Android.bp
index e0ca9bf..32f88e1 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -15,20 +15,51 @@
"microdroid_vendor_boot",
]
-apex {
- name: "com.android.virt",
+soong_config_module_type {
+ name: "virt_apex",
+ module_type: "apex",
+ config_namespace: "ANDROID",
+ bool_variables: ["avf_enabled"],
+ properties: ["defaults"],
+}
+virt_apex {
+ name: "com.android.virt",
+ soong_config_variables: {
+ avf_enabled: {
+ defaults: ["com.android.virt_avf_enabled"],
+ conditions_default: {
+ defaults: ["com.android.virt_avf_disabled"],
+ },
+ },
+ },
+}
+
+apex_defaults {
+ name: "com.android.virt_common",
// TODO(jiyong): make it updatable
updatable: false,
future_updatable: true,
platform_apis: true,
- system_ext_specific: true,
-
manifest: "manifest.json",
key: "com.android.virt.key",
certificate: ":com.android.virt.certificate",
+
+ apps: [
+ "android.system.virtualmachine.res",
+ ],
+
+ file_contexts: ":com.android.virt-file_contexts",
+ canned_fs_config: "canned_fs_config",
+}
+
+apex_defaults {
+ name: "com.android.virt_avf_enabled",
+
+ defaults: ["com.android.virt_common"],
+
custom_sign_tool: "sign_virt_apex",
// crosvm and virtualizationservice are only enabled for 64-bit targets on device
@@ -58,9 +89,6 @@
jni_libs: [
"libvirtualmachine_jni",
],
- apps: [
- "android.system.virtualmachine.res",
- ],
prebuilts: [
"com.android.virt.init.rc",
"microdroid_initrd_app_debuggable",
@@ -71,13 +99,17 @@
"microdroid_bootloader.avbpubkey",
"microdroid_kernel",
],
- file_contexts: ":com.android.virt-file_contexts",
- canned_fs_config: "canned_fs_config",
host_required: [
"vm_shell",
],
}
+apex_defaults {
+ name: "com.android.virt_avf_disabled",
+
+ defaults: ["com.android.virt_common"],
+}
+
apex_key {
name: "com.android.virt.key",
public_key: "com.android.virt.avbpubkey",
diff --git a/apex/product_packages.mk b/apex/product_packages.mk
index 5bc0044..4293c80 100644
--- a/apex/product_packages.mk
+++ b/apex/product_packages.mk
@@ -21,7 +21,6 @@
PRODUCT_PACKAGES += \
com.android.compos \
- com.android.virt \
# TODO(b/207336449): Figure out how to get these off /system
PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST := \
@@ -33,3 +32,5 @@
PRODUCT_SYSTEM_EXT_PROPERTIES := ro.config.isolated_compilation_enabled=true
PRODUCT_FSVERITY_GENERATE_METADATA := true
+
+PRODUCT_AVF_ENABLED := true