Merge "Fixes the system server hang forever issue caused by the monkey not read completed the sync pipe."

This commit is contained in:
Treehugger Robot
2016-07-06 17:43:51 +00:00
committed by Gerrit Code Review

View File

@@ -433,8 +433,18 @@ public class Monkey {
String s;
while ((s = inBuffer.readLine()) != null) {
if (mRequestBugreport) {
logOutput.write(s);
logOutput.write("\n");
try {
// When no space left on the device the write will
// occurs an I/O exception, so we needed to catch it
// and continue to read the data of the sync pipe to
// aviod the bugreport hang forever.
logOutput.write(s);
logOutput.write("\n");
} catch (IOException e) {
while(inBuffer.readLine() != null) {}
System.err.println(e.toString());
break;
}
} else {
System.err.println(s);
}