From 6283cb89aea04956592356fb3e672f467f07cdfe Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Fri, 7 Dec 2018 09:41:20 -0800 Subject: [PATCH] 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 --- core/java/android/app/UiAutomationConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/app/UiAutomationConnection.java b/core/java/android/app/UiAutomationConnection.java index dc2f9838785c0..31521a369a4c8 100644 --- a/core/java/android/app/UiAutomationConnection.java +++ b/core/java/android/app/UiAutomationConnection.java @@ -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);