Implement platform API to assign devices

Clients can specify either device types or sysfs nodes when creating a
VM. The app should have USE_CUSTOM_VIRTUAL_MACHINE permission to do so.

Bug: 287379025
Test: TH
Test: adb root && adb shell /apex/com.android.virt/bin/vm \
      run-microdroid --devices /sys/bus/platform/devices/16d00000.eh \
      --protected
Change-Id: I375d455fa1fa9cbad6e552cdb7b3e9a2138f9278
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index 2dbb6e2..8aea556 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -37,7 +37,7 @@
 use libc::VMADDR_CID_HOST;
 use log::{error, info, warn};
 use rustutils::system_properties;
-use std::collections::{HashMap, HashSet};
+use std::collections::HashMap;
 use std::fs::{canonicalize, create_dir, remove_dir_all, set_permissions, File, Permissions};
 use std::io::{Read, Write};
 use std::os::fd::FromRawFd;
@@ -188,16 +188,7 @@
     fn bindDevicesToVfioDriver(&self, devices: &[String]) -> binder::Result<ParcelFileDescriptor> {
         check_use_custom_virtual_machine()?;
 
-        let mut set = HashSet::new();
-        for device in devices.iter() {
-            if !set.insert(device) {
-                return Err(Status::new_exception_str(
-                    ExceptionCode::ILLEGAL_ARGUMENT,
-                    Some(format!("duplicated device {device}")),
-                ));
-            }
-            bind_device(device)?;
-        }
+        devices.iter().try_for_each(|x| bind_device(x))?;
 
         // TODO(b/278008182): create a file descriptor containing DTBO for devices.
         let (raw_read, raw_write) = pipe2(OFlag::O_CLOEXEC).map_err(|e| {