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

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

Merge "Support multiple tasks in recentsaninmation onTaskAppeared" into sc-v2-dev

parents 524d6b83 e4102c6f
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ import com.android.systemui.shared.system.TaskStackChangeListeners;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Arrays;
import java.util.function.Consumer;

/**
@@ -976,12 +977,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    }

    /** @return Whether this was the task we were waiting to appear, and thus handled it. */
    protected boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {
    protected boolean handleTaskAppeared(RemoteAnimationTargetCompat[] appearedTaskTarget) {
        if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
            return false;
        }
        if (mStateCallback.hasStates(STATE_START_NEW_TASK)
                && appearedTaskTarget.taskId == mGestureState.getLastStartedTaskId()) {
        boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTarget).anyMatch(
                targetCompat -> targetCompat.taskId == mGestureState.getLastStartedTaskId());
        if (mStateCallback.hasStates(STATE_START_NEW_TASK) && hasStartedTaskBefore) {
            reset();
            return true;
        }
@@ -1866,9 +1868,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    }

    @Override
    public void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {
    public void onTasksAppeared(RemoteAnimationTargetCompat[] appearedTaskTargets) {
        if (mRecentsAnimationController != null) {
            if (handleTaskAppeared(appearedTaskTarget)) {
            if (handleTaskAppeared(appearedTaskTargets)) {
                mRecentsAnimationController.finish(false /* toRecents */,
                        null /* onFinishComplete */);
                mActivityInterface.onLaunchTaskSuccess();
+3 −2
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class FallbackSwipeHandler extends
    }

    @Override
    protected boolean handleTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {
    protected boolean handleTaskAppeared(RemoteAnimationTargetCompat[] appearedTaskTarget) {
        if (mActiveAnimationFactory != null
                && mActiveAnimationFactory.handleHomeTaskAppeared(appearedTaskTarget)) {
            mActiveAnimationFactory = null;
@@ -260,7 +260,8 @@ public class FallbackSwipeHandler extends
            }
        }

        public boolean handleHomeTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {
        public boolean handleHomeTaskAppeared(RemoteAnimationTargetCompat[] appearedTaskTargets) {
            RemoteAnimationTargetCompat appearedTaskTarget = appearedTaskTargets[0];
            if (appearedTaskTarget.activityType == ACTIVITY_TYPE_HOME) {
                RemoteAnimationTargets targets = new RemoteAnimationTargets(
                        new RemoteAnimationTargetCompat[] {appearedTaskTarget},
+3 −3
Original line number Diff line number Diff line
@@ -136,10 +136,10 @@ public class RecentsAnimationCallbacks implements

    @BinderThread
    @Override
    public void onTaskAppeared(RemoteAnimationTargetCompat app) {
    public void onTasksAppeared(RemoteAnimationTargetCompat[] apps) {
        Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> {
            for (RecentsAnimationListener listener : getListeners()) {
                listener.onTaskAppeared(app);
                listener.onTasksAppeared(apps);
            }
        });
    }
@@ -177,6 +177,6 @@ public class RecentsAnimationCallbacks implements
        /**
         * Callback made when a task started from the recents is ready for an app transition.
         */
        default void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {}
        default void onTasksAppeared(RemoteAnimationTargetCompat[] appearedTaskTarget) {}
    }
}
+10 −2
Original line number Diff line number Diff line
@@ -85,13 +85,21 @@ public class RemoteTargetGluer {

    /**
     * Similar to {@link #assignTargets(RemoteAnimationTargets)}, except this matches the
     * apps in targets.apps to that of the split screened tasks. If split screen is active, then
     * {@link #mRemoteTargetHandles} index 0 will be the left/top task, index one right/bottom
     * apps in targets.apps to that of the _active_ split screened tasks.
     * See {@link #assignTargetsForSplitScreen(RemoteAnimationTargets, int[])}
     */
    public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) {
        int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate()
                .getRunningSplitTaskIds();
        return assignTargetsForSplitScreen(targets, splitIds);
    }

    /**
     * Assigns the provided splitIDs to the {@link #mRemoteTargetHandles}, with index 0 will beint
     * the left/top task, index 1 right/bottom
     */
    public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets,
            int[] splitIds) {
        RemoteAnimationTargetCompat primaryTaskTarget;
        RemoteAnimationTargetCompat secondaryTaskTarget;
        if (mRemoteTargetHandles.length == 1) {
+4 −4
Original line number Diff line number Diff line
@@ -147,16 +147,16 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
            }

            @Override
            public void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {
            public void onTasksAppeared(RemoteAnimationTargetCompat[] appearedTaskTargets) {
                RemoteAnimationTargetCompat appearedTaskTarget = appearedTaskTargets[0];
                BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface();
                if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityInterface.isInLiveTileMode()
                        && activityInterface.getCreatedActivity() != null) {
                    RecentsView recentsView =
                            activityInterface.getCreatedActivity().getOverviewPanel();
                    if (recentsView != null) {
                        RemoteAnimationTargetCompat[] apps = new RemoteAnimationTargetCompat[1];
                        apps[0] = appearedTaskTarget;
                        recentsView.launchSideTaskInLiveTileMode(appearedTaskTarget.taskId, apps,
                        recentsView.launchSideTaskInLiveTileMode(appearedTaskTarget.taskId,
                                appearedTaskTargets,
                                new RemoteAnimationTargetCompat[0] /* wallpaper */,
                                new RemoteAnimationTargetCompat[0] /* nonApps */);
                        return;
Loading