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

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

Merge "Call exitSplitScreen() when user leaves split tasks" into sc-v2-dev

parents 94c673c6 84511f29
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -945,6 +945,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                mStateCallback.setState(STATE_SCALED_CONTROLLER_HOME | STATE_CAPTURE_SCREENSHOT);
                // Notify swipe-to-home (recents animation) is finished
                SystemUiProxy.INSTANCE.get(mContext).notifySwipeToHomeFinished();
                LauncherSplitScreenListener.INSTANCE.getNoCreate().notifySwipingToHome();
                break;
            case RECENTS:
                mStateCallback.setState(STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT
@@ -1805,8 +1806,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                mGestureState.updateLastStartedTaskId(taskId);
                boolean hasTaskPreviouslyAppeared = mGestureState.getPreviouslyAppearedTaskIds()
                        .contains(taskId);
                boolean isOldTaskSplit = LauncherSplitScreenListener.INSTANCE.getNoCreate()
                        .getRunningSplitTaskIds().length > 0;
                nextTask.launchTask(success -> {
                    resultCallback.accept(success);
                    if (isOldTaskSplit) {
                        SystemUiProxy.INSTANCE.getNoCreate().exitSplitScreen(taskId);
                    }
                    if (success) {
                        if (hasTaskPreviouslyAppeared) {
                            onRestartPreviouslyAppearedTask();
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.annotation.UiThread;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.util.RunnableList;
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
import com.android.quickstep.util.LauncherSplitScreenListener;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -157,6 +158,7 @@ public class OverviewCommandHelper {
            }
            if (cmd.type == TYPE_HOME) {
                mService.startActivity(mOverviewComponentObserver.getHomeIntent());
                LauncherSplitScreenListener.INSTANCE.getNoCreate().notifySwipingToHome();
                return true;
            }
        } else {
@@ -175,6 +177,7 @@ public class OverviewCommandHelper {
                    return launchTask(recents, getNextTask(recents), cmd);
                case TYPE_HOME:
                    recents.startHome();
                    LauncherSplitScreenListener.INSTANCE.getNoCreate().notifySwipingToHome();
                    return true;
            }
        }
+9 −2
Original line number Diff line number Diff line
@@ -533,10 +533,17 @@ public class SystemUiProxy implements ISystemUiProxy,
        }
    }

    public void exitSplitScreen() {
    /**
     * To be called whenever the user exits out of split screen apps (either by launching another
     * app or by swiping home)
     * @param topTaskId The taskId of the new app that was launched. System will then move this task
     *                  to the front of what the user sees while removing all other split stages.
     *                  If swiping to home (or there is no task to put at the top), can pass in -1.
     */
    public void exitSplitScreen(int topTaskId) {
        if (mSplitScreen != null) {
            try {
                mSplitScreen.exitSplitScreen();
                mSplitScreen.exitSplitScreen(topTaskId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call exitSplitScreen");
            }
+17 −4
Original line number Diff line number Diff line
@@ -44,8 +44,6 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {
            if (frozen) {
                mPersistentGroupedIds = getRunningSplitTaskIds();
            } else {
                // TODO(b/198310766) Need to also explicitly exit split screen if
                //  we're not currently viewing split screened apps
                mPersistentGroupedIds = EMPTY_ARRAY;
            }
        }
@@ -53,8 +51,11 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {

    /**
     * Gets set to current split taskIDs whenever the task list is frozen, and set to empty array
     * whenever task list unfreezes.
     * When not null, this indicates that we need to load a GroupedTaskView as the most recent
     * whenever task list unfreezes. This also gets set to empty array whenever the user swipes to
     * home - in that case the task list does not unfreeze immediately after the gesture, so it's
     * done via {@link #notifySwipingToHome()}.
     *
     * When not empty, this indicates that we need to load a GroupedTaskView as the most recent
     * page, so user can quickswitch back to a grouped task.
     */
    private int[] mPersistentGroupedIds;
@@ -140,6 +141,18 @@ public class LauncherSplitScreenListener extends ISplitScreenListener.Stub {
        }
    }

    /** Notifies SystemUi to remove any split screen state */
    public void notifySwipingToHome() {
        boolean hasSplitTasks = LauncherSplitScreenListener.INSTANCE.getNoCreate()
                .getPersistentSplitIds().length > 0;
        if (!hasSplitTasks) {
            return;
        }

        SystemUiProxy.INSTANCE.getNoCreate().exitSplitScreen(-1);
        mPersistentGroupedIds = EMPTY_ARRAY;
    }

    private void resetTaskId(StagedSplitTaskPosition taskPosition) {
        taskPosition.taskId = -1;
    }
+0 −3
Original line number Diff line number Diff line
@@ -2034,9 +2034,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    /**
     * Called only when a swipe-up gesture from an app has completed. Only called after
     * {@link #onGestureAnimationStart} and {@link #onGestureAnimationEnd()}.
     *
     * TODO(b/198310766) Need to also explicitly exit split screen if
     *  the swipe up was to home
     */
    public void onSwipeUpAnimationSuccess() {
        animateUpTaskIconScale();
Loading