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

Commit f5945a0c authored by John Reck's avatar John Reck
Browse files

Disable RT-anim for AnimatorSet

 Bug: 17317184

 Unfortunately this will disable *all* RT animations in a scene,
 but we don't have more selective targetting currently

Change-Id: I57e1c0ae43957f45229473bdcdaf34c05825fab7
parent c237555c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -504,6 +504,10 @@ public final class AnimatorSet extends Animator {
        mStarted = true;
        mPaused = false;

        for (Node node : mNodes) {
            node.animation.setAllowRunningAsynchronously(false);
        }

        if (mDuration >= 0) {
            // If the duration was set on this AnimatorSet, pass it along to all child animations
            for (Node node : mNodes) {
+7 −0
Original line number Diff line number Diff line
@@ -453,6 +453,12 @@ public class RenderNodeAnimator extends Animator {
        throw new IllegalStateException("Cannot clone this animator");
    }

    @Override
    public void setAllowRunningAsynchronously(boolean mayRunAsync) {
        checkMutable();
        nSetAllowRunningAsync(mNativePtr.get(), mayRunAsync);
    }

    private static native long nCreateAnimator(int property, float finalValue);
    private static native long nCreateCanvasPropertyFloatAnimator(
            long canvasProperty, float finalValue);
@@ -466,6 +472,7 @@ public class RenderNodeAnimator extends Animator {
    private static native long nGetDuration(long nativePtr);
    private static native void nSetStartDelay(long nativePtr, long startDelay);
    private static native void nSetInterpolator(long animPtr, long interpolatorPtr);
    private static native void nSetAllowRunningAsync(long animPtr, boolean mayRunAsync);

    private static native void nStart(long animPtr, RenderNodeAnimator finishListener);
    private static native void nEnd(long animPtr);
+6 −0
Original line number Diff line number Diff line
@@ -159,6 +159,11 @@ static void setInterpolator(JNIEnv* env, jobject clazz, jlong animatorPtr, jlong
    animator->setInterpolator(interpolator);
}

static void setAllowRunningAsync(JNIEnv* env, jobject clazz, jlong animatorPtr, jboolean mayRunAsync) {
    BaseRenderNodeAnimator* animator = reinterpret_cast<BaseRenderNodeAnimator*>(animatorPtr);
    animator->setAllowRunningAsync(mayRunAsync);
}

static void start(JNIEnv* env, jobject clazz, jlong animatorPtr, jobject finishListener) {
    BaseRenderNodeAnimator* animator = reinterpret_cast<BaseRenderNodeAnimator*>(animatorPtr);
    if (finishListener) {
@@ -191,6 +196,7 @@ static JNINativeMethod gMethods[] = {
    { "nGetDuration", "(J)J", (void*) getDuration },
    { "nSetStartDelay", "(JJ)V", (void*) setStartDelay },
    { "nSetInterpolator", "(JJ)V", (void*) setInterpolator },
    { "nSetAllowRunningAsync", "(JZ)V", (void*) setAllowRunningAsync },
    { "nStart", "(JLandroid/view/RenderNodeAnimator;)V", (void*) start },
    { "nEnd", "(J)V", (void*) end },
#endif
+5 −0
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@ public:
        mListener = listener;
    }
    AnimationListener* listener() { return mListener.get(); }
    ANDROID_API void setAllowRunningAsync(bool mayRunAsync) {
        mMayRunAsync = mayRunAsync;
    }
    bool mayRunAsync() { return mMayRunAsync; }
    ANDROID_API void start() { mStagingPlayState = RUNNING; onStagingPlayStateChanged(); }
    ANDROID_API void end() { mStagingPlayState = FINISHED; onStagingPlayStateChanged(); }

@@ -101,6 +105,7 @@ protected:
    nsecs_t mStartTime;
    nsecs_t mDuration;
    nsecs_t mStartDelay;
    bool mMayRunAsync;

    sp<AnimationListener> mListener;

+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ public:
            if (animator->isRunning()) {
                mInfo.out.hasAnimations = true;
            }
            if (CC_UNLIKELY(!animator->mayRunAsync())) {
                mInfo.out.requiresUiRedraw = true;
            }
        }
        return remove;
    }
Loading