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

Commit 5a6cf3ac authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Work on issue #29042642: Watchdog going off" into nyc-dev

parents c4f1bc40 9b78db41
Loading
Loading
Loading
Loading
+38 −13
Original line number Diff line number Diff line
package com.android.internal.util;

import android.util.Log;
import android.util.Printer;

import java.io.IOException;
@@ -328,6 +329,7 @@ public class FastPrintWriter extends PrintWriter {
    }

    private void flushBytesLocked() throws IOException {
        if (!mIoError) {
            int position;
            if ((position = mBytes.position()) > 0) {
                mBytes.flip();
@@ -335,6 +337,7 @@ public class FastPrintWriter extends PrintWriter {
                mBytes.clear();
            }
        }
    }

    private void flushLocked() throws IOException {
        //Log.i("PackageManager", "flush mPos=" + mPos);
@@ -352,11 +355,15 @@ public class FastPrintWriter extends PrintWriter {
                    }
                    break;
                }
                if (!mIoError) {
                    flushBytesLocked();
                    mOutputStream.flush();
                }
            } else if (mWriter != null) {
                if (!mIoError) {
                    mWriter.write(mText, 0, mPos);
                    mWriter.flush();
                }
            } else {
                int nonEolOff = 0;
                final int sepLen = mSeparator.length();
@@ -385,12 +392,15 @@ public class FastPrintWriter extends PrintWriter {
        synchronized (lock) {
            try {
                flushLocked();
                if (!mIoError) {
                    if (mOutputStream != null) {
                        mOutputStream.flush();
                    } else if (mWriter != null) {
                        mWriter.flush();
                    }
                }
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
@@ -407,6 +417,7 @@ public class FastPrintWriter extends PrintWriter {
                    mWriter.close();
                }
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
@@ -425,6 +436,8 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked(charArray, 0, charArray.length);
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
    }
@@ -442,6 +455,8 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked(ch);
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
    }
@@ -465,6 +480,7 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked(str, 0, str.length());
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
@@ -500,6 +516,7 @@ public class FastPrintWriter extends PrintWriter {
                    flushLocked();
                }
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
@@ -564,6 +581,8 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked(buf, offset, count);
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
    }
@@ -584,6 +603,8 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked((char) oneChar);
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
    }
@@ -600,6 +621,8 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked(str, 0, str.length());
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
    }
@@ -624,6 +647,8 @@ public class FastPrintWriter extends PrintWriter {
            try {
                appendLocked(str, offset, count);
            } catch (IOException e) {
                Log.w("FastPrintWriter", "Write failure", e);
                setError();
            }
        }
    }