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

Commit 01b5d5e3 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Reset force-minimized split state when in live tile mode" into sc-dev

parents 82364717 27d9a92a
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -784,8 +784,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T

            private void cleanUp(boolean canceled) {
                if (mRecentsAnimationController != null) {
                    mRecentsAnimationController.finish(false /* toRecents */,
                            null /* onFinishComplete */);
                    finishRecentsAnimation(false /* toRecents */, null /* onFinishComplete */);
                    if (canceled) {
                        mRecentsAnimationController = null;
                    } else {
@@ -2945,6 +2944,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    }

    public void finishRecentsAnimation(boolean toRecents, Runnable onFinishComplete) {
        if (!toRecents && LIVE_TILE.get()) {
            // Reset the minimized state since we force-toggled the minimized state when entering
            // overview, but never actually finished the recents animation.  This is a catch all for
            // cases where we haven't already reset it.
            SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
            if (p != null) {
                p.setSplitScreenMinimized(false);
            }
        }

        if (mRecentsAnimationController == null) {
            if (onFinishComplete != null) {
                onFinishComplete.run();
+48 −45
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import com.android.launcher3.util.TransformingTouchDelegate;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskIconCache;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
@@ -327,47 +328,7 @@ public class TaskView extends FrameLayout implements Reusable {
    public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mActivity = StatefulActivity.fromContext(context);
        setOnClickListener((view) -> {
            if (getTask() == null) {
                return;
            }
            if (LIVE_TILE.get() && isRunningTask()) {
                if (!mIsClickableAsLiveTile) {
                    return;
                }

                mIsClickableAsLiveTile = false;
                RecentsView recentsView = getRecentsView();
                RemoteAnimationTargets targets = recentsView.getLiveTileParams().getTargetSet();
                recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(false);

                AnimatorSet anim = new AnimatorSet();
                TaskViewUtils.composeRecentsLaunchAnimator(
                        anim, this, targets.apps,
                        targets.wallpapers, true /* launcherClosing */,
                        mActivity.getStateManager(), recentsView,
                        recentsView.getDepthController());
                anim.addListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animator) {
                        recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(true);
                        recentsView.finishRecentsAnimation(false, null);
                        mIsClickableAsLiveTile = true;
                    }
                });
                anim.start();
            } else {
                if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
                    // User tapped to select second split screen app
                    getRecentsView().confirmSplitSelect(this);
                } else {
                    launchTaskAnimated();
                }
            }
            mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
                    .log(LAUNCHER_TASK_LAUNCH_TAP);
        });
        setOnClickListener(this::onClick);

        mCurrentFullscreenParams = new FullscreenDrawParams(context);
        mDigitalWellBeingToast = new DigitalWellBeingToast(mActivity, this);
@@ -504,10 +465,52 @@ public class TaskView extends FrameLayout implements Reusable {
        return mIconView;
    }

    public AnimatorPlaybackController createLaunchAnimationForRunningTask() {
        return getRecentsView().createTaskLaunchAnimation(
                this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR)
                .createPlaybackController();
    private void onClick(View view) {
        if (getTask() == null) {
            return;
        }
        if (LIVE_TILE.get() && isRunningTask()) {
            if (!mIsClickableAsLiveTile) {
                return;
            }

            // Reset the minimized state since we force-toggled the minimized state when entering
            // overview, but never actually finished the recents animation
            SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
            if (p != null) {
                p.setSplitScreenMinimized(false);
            }

            mIsClickableAsLiveTile = false;
            RecentsView recentsView = getRecentsView();
            RemoteAnimationTargets targets = recentsView.getLiveTileParams().getTargetSet();
            recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(false);

            AnimatorSet anim = new AnimatorSet();
            TaskViewUtils.composeRecentsLaunchAnimator(
                    anim, this, targets.apps,
                    targets.wallpapers, true /* launcherClosing */,
                    mActivity.getStateManager(), recentsView,
                    recentsView.getDepthController());
            anim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animator) {
                    recentsView.getLiveTileTaskViewSimulator().setDrawsBelowRecents(true);
                    recentsView.finishRecentsAnimation(false, null);
                    mIsClickableAsLiveTile = true;
                }
            });
            anim.start();
        } else {
            if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
                // User tapped to select second split screen app
                getRecentsView().confirmSplitSelect(this);
            } else {
                launchTaskAnimated();
            }
        }
        mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
                .log(LAUNCHER_TASK_LAUNCH_TAP);
    }

    /**