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

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

Merge "Emulator cleanup in ClipboardService.java (closePipe)" am: 43a464cb...

Merge "Emulator cleanup in ClipboardService.java (closePipe)" am: 43a464cb am: 828f4661 am: 5803e055 am: 47bc18bd

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

Change-Id: I318b558bab8fbe2dcde7d618115d5e27694adfab
parents b9ade2a0 47bc18bd
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -121,6 +121,17 @@ class HostClipboardMonitor implements Runnable {
        return false;
    }

    private void closePipe() {
        try {
            final RandomAccessFile pipe = mPipe;
            mPipe = null;
            if (pipe != null) {
                pipe.close();
            }
        } catch (IOException ignore) {
        }
    }

    public HostClipboardMonitor(HostClipboardCallback cb) {
        mHostClipboardCallback = cb;
    }
@@ -142,10 +153,7 @@ class HostClipboardMonitor implements Runnable {
                mHostClipboardCallback.onHostClipboardUpdated(
                    new String(receivedData));
            } catch (IOException e) {
                try {
                    mPipe.close();
                } catch (IOException ee) {}
                mPipe = null;
                closePipe();
            } catch (InterruptedException e) {}
        }
    }