vm create-idsig <apk> <idsig>

It delegates to virtualizationservice to create the idsig file for the
APK.

Bug: 218934597
Test: vm create-idsig apk idsig
Change-Id: Id6354c9e624b2f030d59336f5691f9605b310032
diff --git a/vm/src/main.rs b/vm/src/main.rs
index 2cbae3e..d215d7c 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -14,6 +14,7 @@
 
 //! Android VM control tool.
 
+mod create_idsig;
 mod create_partition;
 mod run;
 mod sync;
@@ -24,6 +25,7 @@
 };
 use android_system_virtualizationservice::binder::{wait_for_interface, ProcessState, Strong};
 use anyhow::{Context, Error};
+use create_idsig::command_create_idsig;
 use create_partition::command_create_partition;
 use run::{command_run, command_run_app};
 use rustutils::system_properties;
@@ -142,6 +144,15 @@
         #[structopt(short="t", long="type", default_value="raw", parse(try_from_str=parse_partition_type))]
         partition_type: PartitionType,
     },
+    /// Creates or update the idsig file by digesting the input APK file.
+    CreateIdsig {
+        /// Path to VM Payload APK
+        #[structopt(parse(from_os_str))]
+        apk: PathBuf,
+        /// Path to idsig of the APK
+        #[structopt(parse(from_os_str))]
+        path: PathBuf,
+    },
 }
 
 fn parse_debug_level(s: &str) -> Result<DebugLevel, String> {
@@ -219,6 +230,7 @@
         Opt::CreatePartition { path, size, partition_type } => {
             command_create_partition(service, &path, size, partition_type)
         }
+        Opt::CreateIdsig { apk, path } => command_create_idsig(service, &apk, &path),
     }
 }