Rename VirtManager to VirtualizationService.

Bug: 188042280
Test: atest VirtualizationTestCases
Change-Id: I15f3f91e464f52d1b1fd47b1290846b1d21fa665
diff --git a/vm/Android.bp b/vm/Android.bp
index d0f341d..e7148ca 100644
--- a/vm/Android.bp
+++ b/vm/Android.bp
@@ -8,7 +8,7 @@
     srcs: ["src/main.rs"],
     edition: "2018",
     rustlibs: [
-        "android.system.virtmanager-rust",
+        "android.system.virtualizationservice-rust",
         "libanyhow",
         "libenv_logger",
         "liblibc",
diff --git a/vm/src/config.rs b/vm/src/config.rs
index a6f48ce..cbdd0bf 100644
--- a/vm/src/config.rs
+++ b/vm/src/config.rs
@@ -14,9 +14,9 @@
 
 //! Struct for VM configuration.
 
-use android_system_virtmanager::{
-    aidl::android::system::virtmanager::DiskImage::DiskImage as AidlDiskImage,
-    aidl::android::system::virtmanager::VirtualMachineConfig::VirtualMachineConfig,
+use android_system_virtualizationservice::{
+    aidl::android::system::virtualizationservice::DiskImage::DiskImage as AidlDiskImage,
+    aidl::android::system::virtualizationservice::VirtualMachineConfig::VirtualMachineConfig,
     binder::ParcelFileDescriptor,
 };
 use anyhow::{bail, Context, Error};
diff --git a/vm/src/main.rs b/vm/src/main.rs
index 2f5d9e6..56a0c92 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -18,15 +18,15 @@
 mod run;
 mod sync;
 
-use android_system_virtmanager::aidl::android::system::virtmanager::IVirtManager::IVirtManager;
-use android_system_virtmanager::binder::{get_interface, ProcessState, Strong};
+use android_system_virtualizationservice::aidl::android::system::virtualizationservice::IVirtualizationService::IVirtualizationService;
+use android_system_virtualizationservice::binder::{get_interface, ProcessState, Strong};
 use anyhow::{Context, Error};
 use run::command_run;
 use std::path::PathBuf;
 use structopt::clap::AppSettings;
 use structopt::StructOpt;
 
-const VIRT_MANAGER_BINDER_SERVICE_IDENTIFIER: &str = "android.system.virtmanager";
+const VIRT_MANAGER_BINDER_SERVICE_IDENTIFIER: &str = "android.system.virtualizationservice";
 
 #[derive(StructOpt)]
 #[structopt(no_version, global_settings = &[AppSettings::DisableVersion])]
@@ -58,7 +58,7 @@
     ProcessState::start_thread_pool();
 
     let virt_manager = get_interface(VIRT_MANAGER_BINDER_SERVICE_IDENTIFIER)
-        .context("Failed to find Virt Manager service")?;
+        .context("Failed to find VirtualizationService")?;
 
     match opt {
         Opt::Run { config, daemonize } => command_run(virt_manager, &config, daemonize),
@@ -68,16 +68,16 @@
 }
 
 /// Retrieve reference to a previously daemonized VM and stop it.
-fn command_stop(virt_manager: Strong<dyn IVirtManager>, cid: u32) -> Result<(), Error> {
+fn command_stop(virt_manager: Strong<dyn IVirtualizationService>, cid: u32) -> Result<(), Error> {
     virt_manager
         .debugDropVmRef(cid as i32)
-        .context("Failed to get VM from Virt Manager")?
+        .context("Failed to get VM from VirtualizationService")?
         .context("CID does not correspond to a running background VM")?;
     Ok(())
 }
 
 /// List the VMs currently running.
-fn command_list(virt_manager: Strong<dyn IVirtManager>) -> Result<(), Error> {
+fn command_list(virt_manager: Strong<dyn IVirtualizationService>) -> Result<(), Error> {
     let vms = virt_manager.debugListVms().context("Failed to get list of VMs")?;
     println!("Running VMs: {:#?}", vms);
     Ok(())
diff --git a/vm/src/run.rs b/vm/src/run.rs
index de9b720..6ac66f1 100644
--- a/vm/src/run.rs
+++ b/vm/src/run.rs
@@ -16,15 +16,15 @@
 
 use crate::config::VmConfig;
 use crate::sync::AtomicFlag;
-use android_system_virtmanager::aidl::android::system::virtmanager::IVirtManager::IVirtManager;
-use android_system_virtmanager::aidl::android::system::virtmanager::IVirtualMachine::IVirtualMachine;
-use android_system_virtmanager::aidl::android::system::virtmanager::IVirtualMachineCallback::{
+use android_system_virtualizationservice::aidl::android::system::virtualizationservice::IVirtualizationService::IVirtualizationService;
+use android_system_virtualizationservice::aidl::android::system::virtualizationservice::IVirtualMachine::IVirtualMachine;
+use android_system_virtualizationservice::aidl::android::system::virtualizationservice::IVirtualMachineCallback::{
     BnVirtualMachineCallback, IVirtualMachineCallback,
 };
-use android_system_virtmanager::binder::{
+use android_system_virtualizationservice::binder::{
     BinderFeatures, DeathRecipient, IBinder, ParcelFileDescriptor, Strong,
 };
-use android_system_virtmanager::binder::{Interface, Result as BinderResult};
+use android_system_virtualizationservice::binder::{Interface, Result as BinderResult};
 use anyhow::{Context, Error};
 use std::fs::File;
 use std::io;
@@ -33,7 +33,7 @@
 
 /// Run a VM from the given configuration file.
 pub fn command_run(
-    virt_manager: Strong<dyn IVirtManager>,
+    virt_manager: Strong<dyn IVirtualizationService>,
     config_path: &Path,
     daemonize: bool,
 ) -> Result<(), Error> {
@@ -48,16 +48,17 @@
     println!("Started VM from {:?} with CID {}.", config_path, cid);
 
     if daemonize {
-        // Pass the VM reference back to Virt Manager and have it hold it in the background.
-        virt_manager.debugHoldVmRef(&vm).context("Failed to pass VM to Virt Manager")
+        // Pass the VM reference back to VirtualizationService and have it hold it in the
+        // background.
+        virt_manager.debugHoldVmRef(&vm).context("Failed to pass VM to VirtualizationService")
     } else {
-        // Wait until the VM or VirtManager dies. If we just returned immediately then the
+        // Wait until the VM or VirtualizationService dies. If we just returned immediately then the
         // IVirtualMachine Binder object would be dropped and the VM would be killed.
         wait_for_vm(vm)
     }
 }
 
-/// Wait until the given VM or the VirtManager itself dies.
+/// Wait until the given VM or the VirtualizationService itself dies.
 fn wait_for_vm(vm: Strong<dyn IVirtualMachine>) -> Result<(), Error> {
     let dead = AtomicFlag::default();
     let callback = BnVirtualMachineCallback::new_binder(
@@ -78,7 +79,7 @@
 /// If the returned DeathRecipient is dropped then this will no longer do anything.
 fn wait_for_death(binder: &mut impl IBinder, dead: AtomicFlag) -> Result<DeathRecipient, Error> {
     let mut death_recipient = DeathRecipient::new(move || {
-        println!("VirtManager died");
+        println!("VirtualizationService died");
         dead.raise();
     });
     binder.link_to_death(&mut death_recipient)?;