diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-04-20 18:14:05 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-04-22 18:03:21 -0700 |
commit | 1d442e0d990b581357f33f5463c7c5cb49b551e8 (patch) | |
tree | 58963b9ba095e179ba7c63e52dfd525b93cb978e /core/java/android/view | |
parent | a0c9e8526b094e3b4f2c2747622059215d00516f (diff) | |
download | frameworks_base-1d442e0d990b581357f33f5463c7c5cb49b551e8.zip frameworks_base-1d442e0d990b581357f33f5463c7c5cb49b551e8.tar.gz frameworks_base-1d442e0d990b581357f33f5463c7c5cb49b551e8.tar.bz2 |
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).
Diffstat (limited to 'core/java/android/view')
-rw-r--r-- | core/java/android/view/animation/Transformation.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/core/java/android/view/animation/Transformation.java b/core/java/android/view/animation/Transformation.java index f9e85bf..cf210c8 100644 --- a/core/java/android/view/animation/Transformation.java +++ b/core/java/android/view/animation/Transformation.java @@ -18,6 +18,8 @@ package android.view.animation; import android.graphics.Matrix; +import java.io.PrintWriter; + /** * Defines the transformation to be applied at * one point in time of an Animation. @@ -134,14 +136,38 @@ public class Transformation { @Override public String toString() { - return "Transformation{alpha=" + mAlpha + " matrix=" - + mMatrix.toShortString() + "}"; + StringBuilder sb = new StringBuilder(64); + sb.append("Transformation"); + toShortString(sb); + return sb.toString(); } /** * Return a string representation of the transformation in a compact form. */ public String toShortString() { - return "{alpha=" + mAlpha + " matrix=" + mMatrix.toShortString() + "}"; + StringBuilder sb = new StringBuilder(64); + toShortString(sb); + return sb.toString(); + } + + /** + * @hide + */ + public void toShortString(StringBuilder sb) { + sb.append("{alpha="); sb.append(mAlpha); + sb.append(" matrix="); mMatrix.toShortString(sb); + sb.append('}'); + } + + /** + * Print short string, to optimize dumping. + * @hide + */ + public void printShortString(PrintWriter pw) { + pw.print("{alpha="); pw.print(mAlpha); + pw.print(" matrix="); + mMatrix.printShortString(pw); + pw.print('}'); } } |