aidl: put @utf8InCpp
String type in AIDL is mapped to String16 in C++, which doesn't work
well with ParcelFileDescriptor. (String16 is not moveable while PFD is
moveable but not copyable.)
Putting @utf8InCpp makes String type in AIDL std::string in C++.
std::string has no such problems.
Besides, there's no good reason to use String16 in C++.
Bug: 192136980
Test: MicrodroidHostTestCases, VirtualizationTestCases
Change-Id: I47ffd5f9083a7bd446fbff6a806f1d31295e6cd3
diff --git a/tests/vsock_test.cc b/tests/vsock_test.cc
index 233c6dd..931e79d 100644
--- a/tests/vsock_test.cc
+++ b/tests/vsock_test.cc
@@ -86,7 +86,7 @@
VirtualMachineConfig config;
config.kernel = ParcelFileDescriptor(unique_fd(open(kVmKernelPath, O_RDONLY | O_CLOEXEC)));
config.initrd = ParcelFileDescriptor(unique_fd(open(kVmInitrdPath, O_RDONLY | O_CLOEXEC)));
- config.params = String16(kVmParams);
+ config.params = kVmParams;
config.protected_vm = protected_vm;
sp<IVirtualMachine> vm;
diff --git a/virtualizationservice/aidl/android/system/virtualizationservice/Partition.aidl b/virtualizationservice/aidl/android/system/virtualizationservice/Partition.aidl
index 782c239..825c3da 100644
--- a/virtualizationservice/aidl/android/system/virtualizationservice/Partition.aidl
+++ b/virtualizationservice/aidl/android/system/virtualizationservice/Partition.aidl
@@ -18,7 +18,7 @@
/** A partition to be assembled into a composite image. */
parcelable Partition {
/** A label for the partition. */
- String label;
+ @utf8InCpp String label;
/** The backing file descriptor of the partition image. */
ParcelFileDescriptor image;
diff --git a/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineConfig.aidl b/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineConfig.aidl
index cb28856..5d59f9d 100644
--- a/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineConfig.aidl
+++ b/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineConfig.aidl
@@ -29,7 +29,7 @@
* Parameters to pass to the kernel. As far as the VMM and boot protocol are concerned this is
* just a string, but typically it will contain multiple parameters separated by spaces.
*/
- @nullable String params;
+ @nullable @utf8InCpp String params;
/**
* The bootloader to use. If this is supplied then the kernel and initrd must not be supplied;
diff --git a/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineDebugInfo.aidl b/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineDebugInfo.aidl
index 18b01ce..d081b8d 100644
--- a/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineDebugInfo.aidl
+++ b/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineDebugInfo.aidl
@@ -21,13 +21,13 @@
int cid;
/** Directory of temporary files used by the VM while it is running. */
- String temporaryDirectory;
+ @utf8InCpp String temporaryDirectory;
/** The UID of the process which requested the VM. */
int requesterUid;
/** The SID of the process which requested the VM. */
- String requesterSid;
+ @utf8InCpp String requesterSid;
/**
* The PID of the process which requested the VM. Note that this process may no longer exist and