Support trackpad in VM

It handles single touch and tap event for now.

Bug: 347253952
Test: add trackpad, and then check if it works
Change-Id: Ifec4219036b4baa66c84faffa9d3b22f99fdddd4
diff --git a/virtualizationmanager/src/aidl.rs b/virtualizationmanager/src/aidl.rs
index 671a012..425beed 100644
--- a/virtualizationmanager/src/aidl.rs
+++ b/virtualizationmanager/src/aidl.rs
@@ -808,6 +808,12 @@
         InputDevice::Switches(switches) => InputDeviceOption::Switches(clone_file(
             switches.pfd.as_ref().ok_or(anyhow!("pfd should have value"))?,
         )?),
+        InputDevice::Trackpad(trackpad) => InputDeviceOption::MultiTouchTrackpad {
+            file: clone_file(trackpad.pfd.as_ref().ok_or(anyhow!("pfd should have value"))?)?,
+            height: u32::try_from(trackpad.height)?,
+            width: u32::try_from(trackpad.width)?,
+            name: if !trackpad.name.is_empty() { Some(trackpad.name.clone()) } else { None },
+        },
     })
 }
 /// 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 a9a91fe..1998ef7 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -222,6 +222,7 @@
     Keyboard(File),
     Mouse(File),
     Switches(File),
+    MultiTouchTrackpad { file: File, width: u32, height: u32, name: Option<String> },
 }
 
 type VfioDevice = Strong<dyn IBoundDevice>;
@@ -1154,6 +1155,13 @@
                 InputDeviceOption::Switches(file) => {
                     format!("switches[path={}]", add_preserved_fd(&mut preserved_fds, file))
                 }
+                InputDeviceOption::MultiTouchTrackpad { file, width, height, name } => format!(
+                    "multi-touch-trackpad[path={},width={},height={}{}]",
+                    add_preserved_fd(&mut preserved_fds, file),
+                    width,
+                    height,
+                    name.as_ref().map_or("".into(), |n| format!(",name={}", n))
+                ),
             });
         }
     }