Emulator cleanup in ClipboardService.java (closePipe)
Bug: 182436079 Test: presubmit Signed-off-by: Roman Kiryanov <rkir@google.com> Change-Id: I08563b24c356e7519ffe6cf6020d301ab086fa70
This commit is contained in:
@@ -106,6 +106,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;
|
||||
}
|
||||
@@ -127,10 +138,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) {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user