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

Commit d8a07fa0 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias
Browse files

Fix NPE from getting swipe pip to home animator finish transation after the...

Fix NPE from getting swipe pip to home animator finish transation after the surface has been released

Fixes: 243154747
Test: programmatically added delay to finish transation later
Change-Id: Ia667372678f2224406147f5659c5fc6f61f270ad
parent 788f8e09
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -323,6 +323,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    // May be set to false when mIsTransientTaskbar is true.
    private boolean mCanSlowSwipeGoHome = true;

    @Nullable
    private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null;

    public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
            TaskAnimationManager taskAnimationManager, GestureState gestureState,
            long touchTimeMs, boolean continuingLastGesture,
@@ -867,6 +870,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(mContext, targets);
        mRecentsAnimationController = controller;
        mRecentsAnimationTargets = targets;
        mSwipePipToHomeReleaseCheck = new RemoteAnimationTargets.ReleaseCheck();
        mSwipePipToHomeReleaseCheck.setCanRelease(true);
        mRecentsAnimationTargets.addReleaseCheck(mSwipePipToHomeReleaseCheck);

        // Only initialize the device profile, if it has not been initialized before, as in some
        // configurations targets.homeContentInsets may not be correct.
@@ -1416,9 +1422,16 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                mSwipePipToHomeAnimator = createWindowAnimationToPip(
                        homeAnimFactory, runningTaskTarget, start);
                mSwipePipToHomeAnimators[0] = mSwipePipToHomeAnimator;
                if (mSwipePipToHomeReleaseCheck != null) {
                    mSwipePipToHomeReleaseCheck.setCanRelease(false);
                }
                windowAnim = mSwipePipToHomeAnimators;
            } else {
                mSwipePipToHomeAnimator = null;
                if (mSwipePipToHomeReleaseCheck != null) {
                    mSwipePipToHomeReleaseCheck.setCanRelease(true);
                    mSwipePipToHomeReleaseCheck = null;
                }
                windowAnim = createWindowAnimationToHome(start, homeAnimFactory);

                windowAnim[0].addAnimatorListener(new AnimationSuccessListener() {
@@ -1940,6 +1953,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            finishRecentsControllerToHome(
                    () -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
        }
        if (mSwipePipToHomeReleaseCheck != null) {
            mSwipePipToHomeReleaseCheck.setCanRelease(true);
            mSwipePipToHomeReleaseCheck = null;
        }
        doLogGesture(HOME, mRecentsView == null ? null : mRecentsView.getCurrentPageTaskView());
    }