summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-06-24 13:46:13 -0700
committerDianne Hackborn <hackbod@google.com>2013-06-24 18:16:48 -0700
commit8c84109b9fbbf473b225707a38261ff5f99d95fb (patch)
tree9796143a5fb2980d58612a247a737448a428f742 /core/java/android/os
parent3af16b226b8467100091b4e02fc3e70a002d567e (diff)
downloadframeworks_base-8c84109b9fbbf473b225707a38261ff5f99d95fb.zip
frameworks_base-8c84109b9fbbf473b225707a38261ff5f99d95fb.tar.gz
frameworks_base-8c84109b9fbbf473b225707a38261ff5f99d95fb.tar.bz2
Use FastPrintWriter... everywhere.
One problem this turned up is, because FastPrintWriter does its own buffering, a lot of code that used to use PrintWriter would fail -- if it pointed to a StringWriter, there was no buffering, so it could just immediately get the result. Now you need to first flush the FastPrintWriter. Also added some new constructors to specify the size of buffer that FastPrintWriter should use. Change-Id: If48cd28d7be0b6b3278bbb69a8357e6ce88cf54a
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/Debug.java5
-rw-r--r--core/java/android/os/StrictMode.java5
2 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 362ae29..c5f473e 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -16,6 +16,7 @@
package android.os;
+import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.TypedProperties;
import android.util.Log;
@@ -476,7 +477,7 @@ public final class Debug
PrintWriter outStream = null;
try {
FileOutputStream fos = new FileOutputStream(SYSFS_QEMU_TRACE_STATE);
- outStream = new PrintWriter(new OutputStreamWriter(fos));
+ outStream = new FastPrintWriter(fos);
outStream.println("1");
} catch (Exception e) {
} finally {
@@ -504,7 +505,7 @@ public final class Debug
PrintWriter outStream = null;
try {
FileOutputStream fos = new FileOutputStream(SYSFS_QEMU_TRACE_STATE);
- outStream = new PrintWriter(new OutputStreamWriter(fos));
+ outStream = new FastPrintWriter(fos);
outStream.println("0");
} catch (Exception e) {
// We could print an error message here but we probably want
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index a9abdc5..d794ca6 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -32,6 +32,7 @@ import android.view.IWindowManager;
import com.android.internal.os.RuntimeInit;
+import com.android.internal.util.FastPrintWriter;
import dalvik.system.BlockGuard;
import dalvik.system.CloseGuard;
import dalvik.system.VMDebug;
@@ -1700,7 +1701,9 @@ public final class StrictMode {
/* package */ static void readAndHandleBinderCallViolations(Parcel p) {
// Our own stack trace to append
StringWriter sw = new StringWriter();
- new LogStackTrace().printStackTrace(new PrintWriter(sw));
+ PrintWriter pw = new FastPrintWriter(sw, false, 256);
+ new LogStackTrace().printStackTrace(pw);
+ pw.flush();
String ourStack = sw.toString();
int policyMask = getThreadPolicyMask();