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

Commit dafe6347 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Add trace point into onMeasure/onDraw of TextView

Bug: N/A
Test: N/A
Flag: NONE adding tracepoint
Change-Id: I80017ff54890d16779a93d9904fd9cd13ca941d2
parent ec909ff2
Loading
Loading
Loading
Loading
+298 −283
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ import android.os.Parcelable;
import android.os.ParcelableParcel;
import android.os.Process;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.BoringLayout;
@@ -9229,6 +9230,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    @Override
    protected void onDraw(Canvas canvas) {
        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "TextView.onDraw");
        try {
            restartMarqueeIfNeeded();
            // Draw the background for this view
@@ -9397,6 +9400,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            }
            canvas.restore();
        } finally {
            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
        }
    }
    @Override
@@ -11254,6 +11260,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "TextView.onMeasure");
        try {
            int widthMode = MeasureSpec.getMode(widthMeasureSpec);
            int heightMode = MeasureSpec.getMode(heightMeasureSpec);
            int widthSize = MeasureSpec.getSize(widthMeasureSpec);
@@ -11327,7 +11335,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    if (hintDes < 0) {
                        hintBoring = BoringLayout.isBoring(mHint, mTextPaint, mTextDir,
                            isFallbackLineSpacingForBoringLayout(), getResolvedMinimumFontMetrics(),
                                isFallbackLineSpacingForBoringLayout(),
                                getResolvedMinimumFontMetrics(),
                                mHintBoring);
                        if (hintBoring != null) {
                            mHintBoring = hintBoring;
@@ -11384,7 +11393,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                makeNewLayout(want, hintWant, boring, hintBoring,
                        width - getCompoundPaddingLeft() - getCompoundPaddingRight(), false);
            } else {
            final boolean layoutChanged = (mLayout.getWidth() != want) || (hintWidth != hintWant)
                final boolean layoutChanged =
                        (mLayout.getWidth() != want) || (hintWidth != hintWant)
                                || (mLayout.getEllipsizedWidth()
                                != width - getCompoundPaddingLeft() - getCompoundPaddingRight());
@@ -11393,14 +11403,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                        && (mLayout instanceof BoringLayout
                        || (fromexisting && des >= 0 && des <= want));
            final boolean maximumChanged = (mMaxMode != mOldMaxMode) || (mMaximum != mOldMaximum);
                final boolean maximumChanged =
                        (mMaxMode != mOldMaxMode) || (mMaximum != mOldMaximum);
                if (layoutChanged || maximumChanged) {
                    if (!maximumChanged && widthChanged) {
                        mLayout.increaseWidthTo(want);
                    } else {
                        makeNewLayout(want, hintWant, boring, hintBoring,
                            width - getCompoundPaddingLeft() - getCompoundPaddingRight(), false);
                                width - getCompoundPaddingLeft() - getCompoundPaddingRight(),
                                false);
                    }
                } else {
                    // Nothing has changed
@@ -11440,6 +11452,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            }
            setMeasuredDimension(width, height);
        } finally {
            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
        }
    }
    /**