diff options
| -rw-r--r-- | core/java/com/android/internal/widget/ImageFloatingTextView.java | 63 |
1 files changed, 5 insertions, 58 deletions
diff --git a/core/java/com/android/internal/widget/ImageFloatingTextView.java b/core/java/com/android/internal/widget/ImageFloatingTextView.java index ae8f0255a192..0704cb8094d7 100644 --- a/core/java/com/android/internal/widget/ImageFloatingTextView.java +++ b/core/java/com/android/internal/widget/ImageFloatingTextView.java @@ -18,11 +18,9 @@ package com.android.internal.widget; import android.annotation.Nullable; import android.content.Context; -import android.os.Build; import android.os.Trace; import android.text.BoringLayout; import android.text.Layout; -import android.text.PrecomputedText; import android.text.StaticLayout; import android.text.TextUtils; import android.text.method.TransformationMethod; @@ -50,10 +48,6 @@ public class ImageFloatingTextView extends TextView { private int mLayoutMaxLines = -1; private int mImageEndMargin; - private int mStaticLayoutCreationCountInOnMeasure = 0; - - private static final boolean TRACE_ONMEASURE = Build.isDebuggable(); - public ImageFloatingTextView(Context context) { this(context, null); } @@ -77,10 +71,7 @@ public class ImageFloatingTextView extends TextView { protected Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth, Layout.Alignment alignment, boolean shouldEllipsize, TextUtils.TruncateAt effectiveEllipsize, boolean useSaved) { - if (TRACE_ONMEASURE) { - Trace.beginSection("ImageFloatingTextView#makeSingleLayout"); - mStaticLayoutCreationCountInOnMeasure++; - } + Trace.beginSection("ImageFloatingTextView#makeSingleLayout"); TransformationMethod transformationMethod = getTransformationMethod(); CharSequence text = getText(); if (transformationMethod != null) { @@ -88,7 +79,7 @@ public class ImageFloatingTextView extends TextView { } text = text == null ? "" : text; StaticLayout.Builder builder = StaticLayout.Builder.obtain(text, 0, text.length(), - getPaint(), wantWidth) + getPaint(), wantWidth) .setAlignment(alignment) .setTextDirection(getTextDirectionHeuristic()) .setLineSpacing(getLineSpacingExtra(), getLineSpacingMultiplier()) @@ -124,10 +115,7 @@ public class ImageFloatingTextView extends TextView { } final StaticLayout result = builder.build(); - if (TRACE_ONMEASURE) { - trackMaxLines(); - Trace.endSection(); - } + Trace.endSection(); return result; } @@ -153,10 +141,7 @@ public class ImageFloatingTextView extends TextView { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - if (TRACE_ONMEASURE) { - Trace.beginSection("ImageFloatingTextView#onMeasure"); - } - mStaticLayoutCreationCountInOnMeasure = 0; + Trace.beginSection("ImageFloatingTextView#onMeasure"); int availableHeight = MeasureSpec.getSize(heightMeasureSpec) - mPaddingTop - mPaddingBottom; if (getLayout() != null && getLayout().getHeight() != availableHeight) { // We've been measured before and the new size is different than before, lets make sure @@ -183,12 +168,7 @@ public class ImageFloatingTextView extends TextView { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } - - - if (TRACE_ONMEASURE) { - trackParameters(); - Trace.endSection(); - } + Trace.endSection(); } @Override @@ -236,37 +216,4 @@ public class ImageFloatingTextView extends TextView { requestLayout(); } } - - private void trackParameters() { - if (!TRACE_ONMEASURE) { - return; - } - Trace.setCounter("ImageFloatingView#staticLayoutCreationCount", - mStaticLayoutCreationCountInOnMeasure); - Trace.setCounter("ImageFloatingView#isPrecomputedText", - isTextAPrecomputedText()); - } - /** - * @return 1 if {@link TextView#getText()} is PrecomputedText, else 0 - */ - private int isTextAPrecomputedText() { - final CharSequence text = getText(); - if (text == null || text.isEmpty()) { - return 0; - } - - if (text instanceof PrecomputedText) { - return 1; - } - - return 0; - } - - private void trackMaxLines() { - if (!TRACE_ONMEASURE) { - return; - } - - Trace.setCounter("ImageFloatingView#layoutMaxLines", mLayoutMaxLines); - } } |