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

Commit 2f0a5140 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Trace ImageFloatingTextView and NotificationToplineView

There are binder calls in BigText style perfetto traces. They can be getLayoutDirection calls.
In order to surface this and measure onMeasure perf of ImageFloatingTextView,this CL add traces for both onMeasure and getLayoutDirection.
In addition to that, this CL adds tracing to onMeasure or NotificationTopLineView

Bug: 288578300
Test: perfetto
Change-Id: I08a2fa35d7e9c5bfe554b31b152a7d9835a66974
parent 4300398b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.os.Trace;
import android.util.AttributeSet;
import android.widget.RemoteViews;

@@ -106,6 +107,7 @@ public class NotificationTopLineView extends ViewGroup {

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        Trace.beginSection("NotificationTopLineView#onMeasure");
        final int givenWidth = MeasureSpec.getSize(widthMeasureSpec);
        final int givenHeight = MeasureSpec.getSize(heightMeasureSpec);
        final boolean wrapHeight = MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST;
@@ -161,6 +163,7 @@ public class NotificationTopLineView extends ViewGroup {
                    .finish();
        }
        setMeasuredDimension(givenWidth, wrapHeight ? maxChildHeight : givenHeight);
        Trace.endSection();
    }

    @Override
+7 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.widget;

import android.annotation.Nullable;
import android.content.Context;
import android.os.Trace;
import android.text.BoringLayout;
import android.text.Layout;
import android.text.StaticLayout;
@@ -68,6 +69,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) {
        Trace.beginSection("ImageFloatingTextView#makeSingleLayout");
        TransformationMethod transformationMethod = getTransformationMethod();
        CharSequence text = getText();
        if (transformationMethod != null) {
@@ -110,7 +112,9 @@ public class ImageFloatingTextView extends TextView {
            builder.setIndents(null, margins);
        }

        return builder.build();
        final StaticLayout result = builder.build();
        Trace.endSection();
        return result;
    }

    /**
@@ -135,6 +139,7 @@ public class ImageFloatingTextView extends TextView {

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        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
@@ -161,6 +166,7 @@ public class ImageFloatingTextView extends TextView {
                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            }
        }
        Trace.endSection();
    }

    @Override