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

Commit 16cde29b authored by Hyangseok Chae's avatar Hyangseok Chae Committed by erosky
Browse files

Cancel animation before destroying of SurfaceControl.

It can occur that access invalid SurfaceControl.
And this makes NullPointerException at runtime.

*** FATAL EXCEPTION IN SYSTEM PROCESS:android.anim.lf
java.lang.NullPointerException: mNativeObject is null.
    Have you called release() already?
  at android.view.SurfaceControl.checkNotReleased

We need to cancel animation before removing SurfaceControl

Bug: 150438558
Test: Existing tests pass.
      Open an app in freeform and maximize/restore it.
      Maximize freeform and press recent concurrently.

Change-Id: I95d319f66e0d571d270ed8295768bec6f1cbb0dd
parent a7a96ad6
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ class SurfaceFreezer {
     */
    void unfreeze(SurfaceControl.Transaction t) {
        if (mSnapshot != null) {
            mSnapshot.destroy(t);
            mSnapshot.cancelAnimation(t, false /* restarting */);
        }
        if (mLeash == null) {
            return;
@@ -212,7 +212,7 @@ class SurfaceFreezer {
         * @param t The transaction to use for all cancelling surface operations.
         * @param restarting Whether we are restarting the animation.
         */
        private void cancelAnimation(SurfaceControl.Transaction t, boolean restarting) {
        void cancelAnimation(SurfaceControl.Transaction t, boolean restarting) {
            final SurfaceControl leash = mSurfaceControl;
            final AnimationAdapter animation = mAnimation;
            final SurfaceAnimator.OnAnimationFinishedCallback animationFinishedCallback =
@@ -229,7 +229,6 @@ class SurfaceFreezer {
                }
            }
            if (!restarting) {
                // TODO: do we need to destroy?
                destroy(t);
            }
        }