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

Commit 257bb964 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Move splitInstructionsView reference out of RecentsView

* Consolidate it to be same object as workspace
SplitInstructionsView

Bug: 276361926
Test: Created split from home and overview, disapears
on exit or success as expected

Change-Id: I837a7c37fb4d1a39c13fe0d66b2e3ecefedef2df
parent 7d19aecf
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -60,8 +60,6 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
        )
    }

    var splitInstructionsView: SplitInstructionsView? = null

    /**
     * Returns different elements to animate for the initial split selection animation
     * depending on the state of the surface from which the split was initiated
@@ -235,7 +233,8 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
        animatorSet.addListener(object : AnimatorListenerAdapter() {
            override fun onAnimationEnd(animation: Animator) {
                splitSelectStateController.resetState()
                safeRemoveViewFromDragLayer(launcher, splitInstructionsView)
                safeRemoveViewFromDragLayer(launcher,
                        splitSelectStateController.splitInstructionsView)
            }
        })
        return animatorSet
@@ -246,8 +245,9 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
     * app for splitscreen
     */
    fun getShowSplitInstructionsAnim(launcher: StatefulActivity<*>) : PendingAnimation {
        safeRemoveViewFromDragLayer(launcher, splitInstructionsView)
        splitInstructionsView = SplitInstructionsView.getSplitInstructionsView(launcher)
        safeRemoveViewFromDragLayer(launcher, splitSelectStateController.splitInstructionsView)
        val splitInstructionsView = SplitInstructionsView.getSplitInstructionsView(launcher)
        splitSelectStateController.splitInstructionsView = splitInstructionsView
        val timings = AnimUtils.getDeviceOverviewToSplitTimings(launcher.deviceProfile.isTablet)
        val anim = PendingAnimation(100 /*duration */)
        anim.setViewAlpha(splitInstructionsView, 1f,
@@ -267,7 +267,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC

    /** Removes the split instructions view from [launcher] drag layer. */
    fun removeSplitInstructionsView(launcher: StatefulActivity<*>) {
        safeRemoveViewFromDragLayer(launcher, splitInstructionsView)
        safeRemoveViewFromDragLayer(launcher, splitSelectStateController.splitInstructionsView)
    }

    private fun safeRemoveViewFromDragLayer(launcher: StatefulActivity<*>, view: View?) {
+12 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.quickstep.TaskAnimationManager;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.views.FloatingTaskView;
import com.android.quickstep.views.GroupedTaskView;
import com.android.quickstep.views.SplitInstructionsView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;

@@ -112,6 +113,7 @@ public class SplitSelectStateController {
    private GroupedTaskView mLaunchingTaskView;

    private FloatingTaskView mFirstFloatingTaskView;
    private SplitInstructionsView mSplitInstructionsView;

    private final List<SplitSelectionListener> mSplitSelectionListeners = new ArrayList<>();

@@ -612,6 +614,7 @@ public class SplitSelectStateController {
        mAnimateCurrentTaskDismissal = false;
        mDismissingFromSplitPair = false;
        mFirstFloatingTaskView = null;
        mSplitInstructionsView = null;
    }

    /**
@@ -642,11 +645,20 @@ public class SplitSelectStateController {
        mFirstFloatingTaskView = floatingTaskView;
    }

    public void setSplitInstructionsView(SplitInstructionsView splitInstructionsView) {
        mSplitInstructionsView = splitInstructionsView;
    }

    @Nullable
    public FloatingTaskView getFirstFloatingTaskView() {
        return mFirstFloatingTaskView;
    }

    @Nullable
    public SplitInstructionsView getSplitInstructionsView() {
        return mSplitInstructionsView;
    }

    public AppPairsController getAppPairsController() {
        return mAppPairsController;
    }
+15 −16
Original line number Diff line number Diff line
@@ -683,8 +683,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    private final Toast mSplitUnsupportedToast = Toast.makeText(getContext(),
            R.string.toast_split_app_unsupported, Toast.LENGTH_SHORT);

    private SplitInstructionsView mSplitInstructionsView;

    @Nullable
    private SplitSelectSource mSplitSelectSource;

@@ -3252,19 +3250,21 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        firstFloatingTaskView.setOnClickListener(this::animateToFullscreen);

        // SplitInstructionsView: animate in
        safeRemoveDragLayerView(mSplitInstructionsView);
        mSplitInstructionsView = SplitInstructionsView.getSplitInstructionsView(mActivity);
        mSplitInstructionsView.setAlpha(0);
        anim.setViewAlpha(mSplitInstructionsView, 1, clampToProgress(LINEAR,
        safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView());
        SplitInstructionsView splitInstructionsView =
                SplitInstructionsView.getSplitInstructionsView(mActivity);
        splitInstructionsView.setAlpha(0);
        anim.setViewAlpha(splitInstructionsView, 1, clampToProgress(LINEAR,
                timings.getInstructionsContainerFadeInStartOffset(),
                timings.getInstructionsContainerFadeInEndOffset()));
        anim.setViewAlpha(mSplitInstructionsView.getTextView(), 1, clampToProgress(LINEAR,
        anim.setViewAlpha(splitInstructionsView.getTextView(), 1, clampToProgress(LINEAR,
                timings.getInstructionsTextFadeInStartOffset(),
                timings.getInstructionsTextFadeInEndOffset()));
        anim.addFloat(mSplitInstructionsView, mSplitInstructionsView.UNFOLD, 0.1f, 1,
        anim.addFloat(splitInstructionsView, splitInstructionsView.UNFOLD, 0.1f, 1,
                clampToProgress(EMPHASIZED_DECELERATE,
                        timings.getInstructionsUnfoldStartOffset(),
                        timings.getInstructionsUnfoldEndOffset()));
        mSplitSelectStateController.setSplitInstructionsView(splitInstructionsView);

        InteractionJankMonitorWrapper.begin(this,
                InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER, "First tile selected");
@@ -4781,8 +4781,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mSecondFloatingTaskView.addConfirmAnimation(pendingAnimation, secondTaskStartingBounds,
                secondTaskEndingBounds, true /* fadeWithThumbnail */, false /* isStagedTask */);

        pendingAnimation.setViewAlpha(mSplitInstructionsView, 0, clampToProgress(LINEAR,
                timings.getInstructionsFadeStartOffset(),
        pendingAnimation.setViewAlpha(mSplitSelectStateController.getSplitInstructionsView(), 0,
                clampToProgress(LINEAR, timings.getInstructionsFadeStartOffset(),
                        timings.getInstructionsFadeEndOffset()));

        pendingAnimation.addEndListener(aBoolean -> {
@@ -4819,9 +4819,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
            safeRemoveDragLayerView(mSplitSelectStateController.getFirstFloatingTaskView());
            safeRemoveDragLayerView(mSecondFloatingTaskView);
            safeRemoveDragLayerView(mSplitInstructionsView);
            safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView());
            mSecondFloatingTaskView = null;
            mSplitInstructionsView = null;
            mSplitSelectSource = null;
            mSplitSelectStateController.getSplitAnimationController()
                    .removeSplitInstructionsView(mActivity);
@@ -4921,8 +4920,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        taskViewsFloat.first.set(this, getSplitSelectTranslation());
        taskViewsFloat.second.set(this, 0f);

        if (mSplitInstructionsView != null) {
            mSplitInstructionsView.ensureProperRotation();
        if (mSplitSelectStateController.getSplitInstructionsView() != null) {
            mSplitSelectStateController.getSplitInstructionsView().ensureProperRotation();
        }
    }

@@ -6039,7 +6038,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T

    @Nullable
    public SplitInstructionsView getSplitInstructionsView() {
        return mSplitInstructionsView;
        return mSplitSelectStateController.getSplitInstructionsView();
    }

    /** Update the current activity locus id to show the enabled state of Overview */