Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 921af43b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Emulator cleanup in ClipboardService.java" am: f97ab8c4 am: 3b0eafc2

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1634486

Change-Id: I5cefa2f982c530cbccd5d234b3c2ab4323da0b0a
parents 1968fecd 3b0eafc2
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -65,6 +65,7 @@ import com.android.server.wm.WindowManagerInternal;


import java.io.IOException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.RandomAccessFile;
import java.util.Arrays;
import java.util.HashSet;
import java.util.HashSet;
import java.util.List;
import java.util.List;


@@ -80,21 +81,20 @@ class HostClipboardMonitor implements Runnable {
    private static final String PIPE_NAME = "pipe:clipboard";
    private static final String PIPE_NAME = "pipe:clipboard";
    private static final String PIPE_DEVICE = "/dev/qemu_pipe";
    private static final String PIPE_DEVICE = "/dev/qemu_pipe";


    private void openPipe() {
    private static byte[] createOpenHandshake() {
        try {
        // String.getBytes doesn't include the null terminator,
        // String.getBytes doesn't include the null terminator,
        // but the QEMU pipe device requires the pipe service name
        // but the QEMU pipe device requires the pipe service name
        // to be null-terminated.
        // to be null-terminated.
            byte[] b = new byte[PIPE_NAME.length() + 1];

            b[PIPE_NAME.length()] = 0;
        final byte[] bits = Arrays.copyOf(PIPE_NAME.getBytes(), PIPE_NAME.length() + 1);
            System.arraycopy(
        bits[PIPE_NAME.length()] = 0;
                PIPE_NAME.getBytes(),
        return bits;
                0,
    }
                b,

                0,
    private void openPipe() {
                PIPE_NAME.length());
        try {
            mPipe = new RandomAccessFile(PIPE_DEVICE, "rw");
            mPipe = new RandomAccessFile(PIPE_DEVICE, "rw");
            mPipe.write(b);
            mPipe.write(createOpenHandshake());
        } catch (IOException e) {
        } catch (IOException e) {
            try {
            try {
                if (mPipe != null) mPipe.close();
                if (mPipe != null) mPipe.close();