More optimization of dumpsys output.
There are three major classes of changes here:
- Avoid writing lines where their values are often empty, false, or some other typical thing.
- Use partial writes to the PrintWriter to avoid creating temporary strings.
- Use StringBuilder where we need to generate real String objects (and where possible cache the result).
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 1bed706..cb660c7 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -440,9 +440,13 @@
@Override
public String toString() {
- return "PendingIntent{"
- + Integer.toHexString(System.identityHashCode(this))
- + " target " + (mTarget != null ? mTarget.asBinder() : null) + "}";
+ StringBuilder sb = new StringBuilder(128);
+ sb.append("PendingIntent{");
+ sb.append(Integer.toHexString(System.identityHashCode(this)));
+ sb.append(": ");
+ sb.append(mTarget != null ? mTarget.asBinder() : null);
+ sb.append('}');
+ return sb.toString();
}
public int describeContents() {