Send UID and VM identifier to existing atoms

Bug: 236252851
Test: N/A

Change-Id: I5e4db74f9a5cefd071676b9d248e9c5d91c5bfdd
diff --git a/vm/src/main.rs b/vm/src/main.rs
index c421b04..ee0e2e6 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -40,6 +40,10 @@
 enum Opt {
     /// Run a virtual machine with a config in APK
     RunApp {
+        /// Name of VM
+        #[structopt(long)]
+        name: Option<String>,
+
         /// Path to VM Payload APK
         #[structopt(parse(from_os_str))]
         apk: PathBuf,
@@ -102,6 +106,10 @@
     },
     /// Run a virtual machine
     Run {
+        /// Name of VM
+        #[structopt(long)]
+        name: Option<String>,
+
         /// Path to VM config JSON
         #[structopt(parse(from_os_str))]
         config: PathBuf,
@@ -195,6 +203,7 @@
 
     match opt {
         Opt::RunApp {
+            name,
             apk,
             idsig,
             instance,
@@ -211,6 +220,7 @@
             task_profiles,
             extra_idsigs,
         } => command_run_app(
+            name,
             service.as_ref(),
             &apk,
             &idsig,
@@ -228,8 +238,9 @@
             task_profiles,
             &extra_idsigs,
         ),
-        Opt::Run { config, daemonize, cpus, cpu_affinity, task_profiles, console, log } => {
+        Opt::Run { name, config, daemonize, cpus, cpu_affinity, task_profiles, console, log } => {
             command_run(
+                name,
                 service.as_ref(),
                 &config,
                 daemonize,
diff --git a/vm/src/run.rs b/vm/src/run.rs
index 9bd7863..05a9390 100644
--- a/vm/src/run.rs
+++ b/vm/src/run.rs
@@ -35,6 +35,7 @@
 /// Run a VM from the given APK, idsig, and config.
 #[allow(clippy::too_many_arguments)]
 pub fn command_run_app(
+    name: Option<String>,
     service: &dyn IVirtualizationService,
     apk: &Path,
     idsig: &Path,
@@ -91,6 +92,7 @@
     let extra_idsig_fds = extra_idsig_files?.into_iter().map(ParcelFileDescriptor::new).collect();
 
     let config = VirtualMachineConfig::AppConfig(VirtualMachineAppConfig {
+        name: name.unwrap_or_else(|| String::from("VmRunApp")),
         apk: apk_fd.into(),
         idsig: idsig_fd.into(),
         extraIdsigs: extra_idsig_fds,
@@ -117,6 +119,7 @@
 /// Run a VM from the given configuration file.
 #[allow(clippy::too_many_arguments)]
 pub fn command_run(
+    name: Option<String>,
     service: &dyn IVirtualizationService,
     config_path: &Path,
     daemonize: bool,
@@ -136,6 +139,11 @@
     if let Some(cpus) = cpus {
         config.numCpus = cpus as i32;
     }
+    if let Some(name) = name {
+        config.name = name;
+    } else {
+        config.name = String::from("VmRun");
+    }
     config.cpuAffinity = cpu_affinity;
     config.taskProfiles = task_profiles;
     run(