Close lid upon suspend and open upon resume
This is a hack to force update the UI when the VM is resumed.
Bug: 348380730
Test: run a VM, go to a UI which is not auto-updated (ex: no cursor).
go out of the VM, and the come back to VM. see the UI is updated.
Change-Id: I7b49f3b68187ab69edb11e53ad82192eeecd6eb8
diff --git a/virtualizationmanager/src/aidl.rs b/virtualizationmanager/src/aidl.rs
index 575af6b..2abf98c 100644
--- a/virtualizationmanager/src/aidl.rs
+++ b/virtualizationmanager/src/aidl.rs
@@ -798,6 +798,9 @@
InputDevice::Mouse(mouse) => InputDeviceOption::Mouse(clone_file(
mouse.pfd.as_ref().ok_or(anyhow!("pfd should have value"))?,
)?),
+ InputDevice::Switches(switches) => InputDeviceOption::Switches(clone_file(
+ switches.pfd.as_ref().ok_or(anyhow!("pfd should have value"))?,
+ )?),
})
}
/// Given the configuration for a disk image, assembles the `DiskFile` to pass to crosvm.
diff --git a/virtualizationmanager/src/crosvm.rs b/virtualizationmanager/src/crosvm.rs
index 102ac51..13c018b 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -208,6 +208,7 @@
SingleTouch { file: File, width: u32, height: u32, name: Option<String> },
Keyboard(File),
Mouse(File),
+ Switches(File),
}
type VfioDevice = Strong<dyn IBoundDevice>;
@@ -1137,6 +1138,9 @@
height,
name.as_ref().map_or("".into(), |n| format!(",name={}", n))
),
+ InputDeviceOption::Switches(file) => {
+ format!("switches[path={}]", add_preserved_fd(&mut preserved_fds, file))
+ }
});
}
}