Don't throw an exception if write failed

When passing input/output streams between shell command
and caller via UiAutomation, the stream could be closed
by the instrumentation test. Don't throw an exception
if the write failed (due to race). Just log the error.

Change-Id: I601589c6dc36fe51f5cc57276084a11f0be3d57d
Fixes: 119848628
Test: atest CtsAppTestCases:ActivityManagerProcessStateTest
This commit is contained in:
Amith Yamasani
2018-12-07 09:41:20 -08:00
parent cd2e4b51dc
commit 6283cb89ae

View File

@@ -331,7 +331,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
writeTo.flush();
}
} catch (IOException ioe) {
throw new RuntimeException("Error while reading/writing ", ioe);
Log.w(TAG, "Error while reading/writing to streams");
} finally {
IoUtils.closeQuietly(readFrom);
IoUtils.closeQuietly(writeTo);