Flag guard vfio_handler

Guard the following on the value of the
RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT flag:

* vfio_handler binary & vfio_handler.rc in com.android.virt APEX;
* --devices flag in the vm shell binary
* Usage of the CustomConfig.devices field in the
  VirtualMachineAppConfig;

Test: atest MicrodroidTests
Change-Id: I40611b0cd93d17aacd68acf74f442e479a80d488
diff --git a/apex/Android.bp b/apex/Android.bp
index b7fd67e..96540aa 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -71,8 +71,14 @@
     name: "avf_flag_aware_apex_defaults",
     module_type: "apex_defaults",
     config_namespace: "ANDROID",
-    bool_variables: ["release_avf_enable_vendor_modules"],
-    properties: ["prebuilts"],
+    bool_variables: [
+        "release_avf_enable_device_assignment",
+        "release_avf_enable_vendor_modules",
+    ],
+    properties: [
+        "arch",
+        "prebuilts",
+    ],
 }
 
 avf_flag_aware_apex_defaults {
@@ -87,7 +93,6 @@
         arm64: {
             binaries: [
                 "crosvm",
-                "vfio_handler",
                 "virtmgr",
                 "virtualizationservice",
             ],
@@ -96,7 +101,6 @@
         x86_64: {
             binaries: [
                 "crosvm",
-                "vfio_handler",
                 "virtmgr",
                 "virtualizationservice",
             ],
@@ -124,6 +128,19 @@
         "EmptyPayloadApp",
     ],
     soong_config_variables: {
+        release_avf_enable_device_assignment: {
+            prebuilts: [
+                "com.android.virt.vfio_handler.rc",
+            ],
+            arch: {
+                arm64: {
+                    binaries: ["vfio_handler"],
+                },
+                x86_64: {
+                    binaries: ["vfio_handler"],
+                },
+            },
+        },
         release_avf_enable_vendor_modules: {
             prebuilts: [
                 "microdroid_gki_initrd_debuggable",
@@ -158,6 +175,13 @@
     installable: false,
 }
 
+prebuilt_etc {
+    name: "com.android.virt.vfio_handler.rc",
+    src: "vfio_handler.rc",
+    filename: "vfio_handler.rc",
+    installable: false,
+}
+
 sh_binary_host {
     name: "prepare_device_vfio",
     src: "prepare_device_vfio.sh",