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

Commit 6682d58d authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Move splitInstructionsView reference out of RecentsView" into udc-qpr-dev

parents b0f32ea8 257bb964
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;

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

    private FloatingTaskView mFirstFloatingTaskView;
    private SplitInstructionsView mSplitInstructionsView;

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

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

    /**
@@ -660,11 +663,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 */