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

Commit 59b095df authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Give animators more useful names in systrace"

parents 19cdeaf8 fdd3ad70
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -123,9 +123,37 @@ public final class ObjectAnimator extends ValueAnimator {
     * in a call to the function <code>setFoo()</code> on the target object. If either
     * <code>valueFrom</code> or <code>valueTo</code> is null, then a getter function will
     * also be derived and called.
     *
     * <p>If this animator was created with a {@link Property} object instead of the
     * string name of a property, then this method will return the {@link
     * Property#getName() name} of that Property object instead. If this animator was
     * created with one or more {@link PropertyValuesHolder} objects, then this method
     * will return the {@link PropertyValuesHolder#getPropertyName() name} of that
     * object (if there was just one) or a comma-separated list of all of the
     * names (if there are more than one).</p>
     */
    public String getPropertyName() {
        return mPropertyName;
        String propertyName = null;
        if (mPropertyName != null) {
            propertyName = mPropertyName;
        } else if (mProperty != null) {
            propertyName = mProperty.getName();
        } else if (mValues != null && mValues.length > 0) {
            for (int i = 0; i < mValues.length; ++i) {
                if (i == 0) {
                    propertyName = "";
                } else {
                    propertyName += ",";
                }
                propertyName += mValues[i].getPropertyName();
            }
        }
        return propertyName;
    }

    @Override
    String getNameForTrace() {
        return "animator:" + getPropertyName();
    }

    /**
+11 −3
Original line number Diff line number Diff line
@@ -869,7 +869,7 @@ public class ValueAnimator extends Animator {
     *
     * <p>If this ValueAnimator has only one set of values being animated between, this evaluator
     * will be used for that set. If there are several sets of values being animated, which is
     * the case if PropertyValuesHOlder objects were set on the ValueAnimator, then the evaluator
     * the case if PropertyValuesHolder objects were set on the ValueAnimator, then the evaluator
     * is assigned just to the first PropertyValuesHolder object.</p>
     *
     * @param value the evaluator to be used this animation
@@ -1024,7 +1024,7 @@ public class ValueAnimator extends Animator {
        mStarted = false;
        mStartListenersCalled = false;
        mPlayingBackwards = false;
        Trace.asyncTraceEnd(Trace.TRACE_TAG_VIEW, "animator",
        Trace.asyncTraceEnd(Trace.TRACE_TAG_VIEW, getNameForTrace(),
                System.identityHashCode(this));
    }

@@ -1033,7 +1033,7 @@ public class ValueAnimator extends Animator {
     * called on the UI thread.
     */
    private void startAnimation(AnimationHandler handler) {
        Trace.asyncTraceBegin(Trace.TRACE_TAG_VIEW, "animator",
        Trace.asyncTraceBegin(Trace.TRACE_TAG_VIEW, getNameForTrace(),
                System.identityHashCode(this));
        initAnimation();
        handler.mAnimations.add(this);
@@ -1044,6 +1044,14 @@ public class ValueAnimator extends Animator {
        }
    }

    /**
     * Returns the name of this animator for debugging purposes.
     */
    String getNameForTrace() {
        return "animator";
    }


    /**
     * Internal function called to process an animation frame on an animation that is currently
     * sleeping through its <code>startDelay</code> phase. The return value indicates whether it