Merge "Support trackpad in VM" into main
diff --git a/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java b/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
index c3dc189..7a69c07 100644
--- a/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
+++ b/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
@@ -567,12 +567,17 @@
Log.d(TAG, "file descriptor of ClipboardSharingServer is null");
return false;
}
- try (OutputStream output = new AutoCloseOutputStream(pfd)) {
+ try (OutputStream output = new AutoCloseOutputStream(pfd.dup())) {
output.write(request);
output.flush();
Log.d(TAG, "successfully send request to the VM for reading clipboard");
} catch (IOException e) {
Log.e(TAG, "failed to send request to the VM for read clipboard", e);
+ try {
+ pfd.close();
+ } catch (IOException err) {
+ Log.e(TAG, "failed to close file descriptor", err);
+ }
return false;
}