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

Commit 6e7d84b7 authored by Candice Lo's avatar Candice Lo
Browse files

fix(window magnification): Do null check before animation

We would like to make sure the view is not null before applying animation to it.

Bug: 317172128
Flag: NA
Test: atest WindowMagnificationControllerTest
Change-Id: I84050c2108c4852b6c2832222c28f492e6d8fbdb
parent 6e728461
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1303,7 +1303,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
        } else if (id == R.id.close_button) {
            setEditMagnifierSizeMode(false);
        } else {
            animateBounceEffect();
            animateBounceEffectIfNeeded();
        }
    }

@@ -1465,7 +1465,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
        mBounceEffectDuration = duration;
    }

    private void animateBounceEffect() {
    private void animateBounceEffectIfNeeded() {
        if (mMirrorView == null) {
            // run the animation only if the mirror view is not null
            return;
        }

        final ObjectAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(mMirrorView,
                PropertyValuesHolder.ofFloat(View.SCALE_X, 1, mBounceEffectAnimationScale, 1),
                PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, mBounceEffectAnimationScale, 1));