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

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

Merge "Allow starting split from home, selecting second app from overview" into udc-qpr-dev

parents aa4a56aa 1c81f07e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import androidx.annotation.NonNull;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
@@ -113,7 +114,9 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
        setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f,
                config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));

        if (mRecentsView.isSplitSelectionActive()) {
        boolean exitingOverview = !FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()
                || !toState.overviewUi;
        if (mRecentsView.isSplitSelectionActive() && exitingOverview) {
            // TODO (b/238651489): Refactor state management to avoid need for double check
            FloatingTaskView floatingTask = mRecentsView.getFirstFloatingTaskView();
            if (floatingTask != null) {
+5 −4
Original line number Diff line number Diff line
@@ -615,9 +615,10 @@ public class QuickstepLauncher extends Launcher {
        mSplitSelectStateController.findLastActiveTaskAndRunCallback(
                splitSelectSource.itemInfo.getComponentKey(),
                foundTask -> {
                    splitSelectSource.alreadyRunningTaskId = foundTask == null
                            ? INVALID_TASK_ID
                            : foundTask.key.id;
                    boolean taskWasFound = foundTask != null;
                    splitSelectSource.alreadyRunningTaskId = taskWasFound
                            ? foundTask.key.id
                            : INVALID_TASK_ID;
                    if (ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
                        startSplitToHome(splitSelectSource);
                    } else {
@@ -1295,7 +1296,7 @@ public class QuickstepLauncher extends Launcher {
                groupTask.task1.key.id,
                groupTask.task2.key.id,
                SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT,
                /* callback= */ success -> {},
                /* callback= */ success -> mSplitSelectStateController.resetState(),
                /* freezeTaskList= */ true,
                groupTask.mSplitBounds == null
                        ? DEFAULT_SPLIT_RATIO
+17 −0
Original line number Diff line number Diff line
package com.android.quickstep

interface SplitSelectionListener {
    /** Called when the first app has been selected with the intention to launch split screen */
    fun onSplitSelectionActive()

    /** Called when the second app has been selected with the intention to launch split screen */
    fun onSplitSelectionConfirmed()

    /**
     * Called when the user no longer is in the process of selecting apps for split screen.
     * [launchedSplit] will be true if selected apps have launched successfully (either in
     * split screen or fullscreen), false if the user canceled/exited the selection process
     */
    fun onSplitSelectionExit(launchedSplit: Boolean) {
    }
}
 No newline at end of file
+6 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.launcher3.util.SplitConfigurationOptions;
@@ -246,8 +247,12 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
            setOverviewSelectEnabled(false);
        }
        if (finalState != OVERVIEW_SPLIT_SELECT) {
            if (FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
                mSplitSelectStateController.resetState();
            } else {
                resetFromSplitSelectionState();
            }
        }

        if (isOverlayEnabled) {
            runActionOnRemoteHandles(remoteTargetHandle ->
+31 −2
Original line number Diff line number Diff line
@@ -73,16 +73,18 @@ import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.SplitSelectionListener;
import com.android.quickstep.SystemUiProxy;
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.TaskView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

/**
@@ -138,6 +140,8 @@ public class SplitSelectStateController {

    private FloatingTaskView mFirstFloatingTaskView;

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

    public SplitSelectStateController(Context context, Handler handler, StateManager stateManager,
            DepthController depthController, StatsLogManager statsLogManager,
            SystemUiProxy systemUiProxy, RecentsModel recentsModel) {
@@ -247,6 +251,27 @@ public class SplitSelectStateController {
                && task.key.userId == componentKey.user.getIdentifier();
    }

    /**
     * Listener will only get callbacks going forward from the point of registration. No
     * methods will be fired upon registering.
     */
    public void registerSplitListener(@NonNull SplitSelectionListener listener) {
        if (mSplitSelectionListeners.contains(listener)) {
            return;
        }
        mSplitSelectionListeners.add(listener);
    }

    public void unregisterSplitListener(@NonNull SplitSelectionListener listener) {
        mSplitSelectionListeners.remove(listener);
    }

    private void dispatchOnSplitSelectionExit() {
        for (SplitSelectionListener listener : mSplitSelectionListeners) {
            listener.onSplitSelectionExit(false);
        }
    }

    /**
     * To be called when the actual tasks ({@link #mInitialTaskId}, {@link #mSecondTaskId}) are
     * to be launched. Call after launcher side animations are complete.
@@ -790,12 +815,16 @@ public class SplitSelectStateController {
    }

    /**
     * To be called if split select was cancelled
     * To be called whenever we exit split selection state. If
     * {@link FeatureFlags#ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE} is set, this should be the
     * central way split is getting reset, which should then go through the callbacks to reset
     * other state.
     */
    public void resetState() {
        if (FeatureFlags.ENABLE_SPLIT_LAUNCH_DATA_REFACTOR.get()) {
            mSplitSelectDataHolder.resetState();
        }
        dispatchOnSplitSelectionExit();
        mInitialTaskId = INVALID_TASK_ID;
        mInitialTaskIntent = null;
        mSecondTaskId = INVALID_TASK_ID;
Loading