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

Commit 8ae46742 authored by Lucas Dupin's avatar Lucas Dupin Committed by Automerger Merge Worker
Browse files

Merge "Do not run background animation without a Looper" into sc-dev am: c359d54b am: 8aea1869

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15474611

Change-Id: I904dd44985a06f214287c4a28fcf714b401d89c2
parents ea6d3dc0 8aea1869
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -49,7 +49,9 @@ import android.graphics.RecordingCanvas;
import android.graphics.Rect;
import android.graphics.Shader;
import android.os.Build;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;

@@ -113,6 +115,7 @@ import java.util.Arrays;
 * @attr ref android.R.styleable#RippleDrawable_color
 */
public class RippleDrawable extends LayerDrawable {
    private static final String TAG = "RippleDrawable";
    /**
     * Radius value that specifies the ripple radius should be computed based
     * on the size of the ripple's container.
@@ -848,6 +851,10 @@ public class RippleDrawable extends LayerDrawable {

    private void startBackgroundAnimation() {
        mRunBackgroundAnimation = false;
        if (Looper.myLooper() == null) {
            Log.w(TAG, "Thread doesn't have a looper. Skipping animation.");
            return;
        }
        mBackgroundAnimation = ValueAnimator.ofFloat(mBackgroundOpacity, mTargetBackgroundOpacity);
        mBackgroundAnimation.setInterpolator(LINEAR_INTERPOLATOR);
        mBackgroundAnimation.setDuration(BACKGROUND_OPACITY_DURATION);