Fix tests on aosp_cf_x86_64_only_phone

Our nested virtualization check failed on this target. Move to a
prefix check to support this device and any other ones that appear.

Also extract the code to do the check to a library, rather than
changing in two places.

Bug: 236922543
Test: Presubmit
Change-Id: Id1d424f5f107e2098d89ca2ea8089ba956f212ca
diff --git a/libs/nested_virt/Android.bp b/libs/nested_virt/Android.bp
new file mode 100644
index 0000000..e364a2d
--- /dev/null
+++ b/libs/nested_virt/Android.bp
@@ -0,0 +1,18 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+rust_library {
+    name: "libnested_virt",
+    crate_name: "nested_virt",
+    srcs: ["src/lib.rs"],
+    edition: "2018",
+    rustlibs: [
+        "libanyhow",
+        "librustutils",
+    ],
+    apex_available: [
+        "com.android.compos",
+        "com.android.virt",
+    ],
+}