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

Commit defc01b4 authored by John Reck's avatar John Reck Committed by Automerger Merge Worker
Browse files

Merge "Have RippleDrawable ignore non-attached RenderNodes" into sc-dev am:...

Merge "Have RippleDrawable ignore non-attached RenderNodes" into sc-dev am: a633284e am: e452bd66

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

Change-Id: If142d3f5169f7060fbea9b24842e0f0f6174a3a7
parents 23e4f9d4 e452bd66
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public final class RippleAnimationSession {

    @NonNull RippleAnimationSession enter(Canvas canvas) {
        mStartTime = AnimationUtils.currentAnimationTimeMillis();
        if (isHwAccelerated(canvas)) {
        if (useRTAnimations(canvas)) {
            enterHardware((RecordingCanvas) canvas);
        } else {
            enterSoftware();
@@ -82,7 +82,7 @@ public final class RippleAnimationSession {
    }

    @NonNull RippleAnimationSession exit(Canvas canvas) {
        if (isHwAccelerated(canvas)) exitHardware((RecordingCanvas) canvas);
        if (useRTAnimations(canvas)) exitHardware((RecordingCanvas) canvas);
        else exitSoftware();
        return this;
    }
@@ -102,8 +102,12 @@ public final class RippleAnimationSession {
        return this;
    }

    private boolean isHwAccelerated(Canvas canvas) {
        return canvas.isHardwareAccelerated() && !mForceSoftware;
    private boolean useRTAnimations(Canvas canvas) {
        if (mForceSoftware) return false;
        if (!canvas.isHardwareAccelerated()) return false;
        RecordingCanvas hwCanvas = (RecordingCanvas) canvas;
        if (hwCanvas.mNode == null || !hwCanvas.mNode.isAttached()) return false;
        return true;
    }

    private void exitSoftware() {