Merge "Make our javalib more self-contained"
diff --git a/javalib/Android.bp b/javalib/Android.bp
index 1df9b51..a6c3b80 100644
--- a/javalib/Android.bp
+++ b/javalib/Android.bp
@@ -2,20 +2,34 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
+// Defines our permissions
+android_app {
+    name: "android.system.virtualmachine.res",
+    installable: true,
+    apex_available: ["com.android.virt"],
+    sdk_version: "current",
+}
+
 java_sdk_library {
     name: "android.system.virtualmachine",
     installable: true,
     compile_dex: true,
 
+    jarjar_rules: "jarjar-rules.txt",
+
     srcs: ["src/**/*.java"],
     static_libs: [
         "android.system.virtualizationservice-java",
+        // For android.sysprop.HypervisorProperties
+        "PlatformProperties",
     ],
 
     apex_available: ["com.android.virt"],
     permitted_packages: [
         "android.system.virtualmachine",
         "android.system.virtualizationservice",
+        // android.sysprop.*, renamed by jarjar
+        "com.android.system.virtualmachine.sysprop",
     ],
 }
 
@@ -23,10 +37,3 @@
     name: "android-virtualization-framework-sdk",
     api_dirs: ["32"],
 }
-
-android_app {
-    name: "android.system.virtualmachine.res",
-    installable: true,
-    apex_available: ["com.android.virt"],
-    sdk_version: "current",
-}
diff --git a/javalib/jarjar-rules.txt b/javalib/jarjar-rules.txt
new file mode 100644
index 0000000..dd8ad2d
--- /dev/null
+++ b/javalib/jarjar-rules.txt
@@ -0,0 +1,9 @@
+# Rules for the android.system.virtualmachine java_sdk_library.
+
+# This is the root of the API, everything we care about should be
+# reachable from here.
+# (This gets rid of all the android.sysprop classes we don't use.)
+keep android.system.virtualmachine.VirtualMachineManager
+
+# We statically link PlatformProperties, rename to avoid clashes.
+rule android.sysprop.** com.android.system.virtualmachine.sysprop.@1