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

Commit a3169790 authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Don't hide DesktopTaskView in split select" into main

parents e7d52f52 8b50c8f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ public class FallbackRecentsView<CONTAINER_TYPE extends Context & RecentsViewCon
    }

    @Override
    protected boolean canLaunchFullscreenTask() {
    public boolean canLaunchFullscreenTask() {
        return !mContainer.isInState(OVERVIEW_SPLIT_SELECT);
    }

+18 −16
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
            this,
            R.layout.task_thumbnail_deprecated,
            VIEW_POOL_MAX_SIZE,
            VIEW_POOL_INITIAL_SIZE
            VIEW_POOL_INITIAL_SIZE,
        )
    private val tempPointF = PointF()
    private val tempRect = Rect()
@@ -80,7 +80,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
                            setTint(
                                resources.getColor(
                                    android.R.color.system_neutral2_300,
                                    context.theme
                                    context.theme,
                                )
                            )
                        }
@@ -92,8 +92,8 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
                    ResourcesCompat.getDrawable(
                        context.resources,
                        R.drawable.ic_desktop_with_bg,
                        context.theme
                    )
                        context.theme,
                    ),
                )
                setText(resources.getText(R.string.recent_task_desktop))
            }
@@ -104,7 +104,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
    fun bind(
        tasks: List<Task>,
        orientedState: RecentsOrientedState,
        taskOverlayFactory: TaskOverlayFactory
        taskOverlayFactory: TaskOverlayFactory,
    ) {
        if (DEBUG) {
            val sb = StringBuilder()
@@ -126,7 +126,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
                    snapshotView,
                    // Add snapshotView to the front after initial views e.g. icon and
                    // background.
                    childCountAtInflation
                    childCountAtInflation,
                )
                TaskContainer(
                    this,
@@ -137,7 +137,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
                    SplitConfigurationOptions.STAGE_POSITION_UNDEFINED,
                    digitalWellBeingToast = null,
                    showWindowsView = null,
                    taskOverlayFactory
                    taskOverlayFactory,
                )
            }
        taskContainers.forEach { it.bind() }
@@ -159,12 +159,12 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
    override fun updateTaskSize(
        lastComputedTaskSize: Rect,
        lastComputedGridTaskSize: Rect,
        lastComputedCarouselTaskSize: Rect
        lastComputedCarouselTaskSize: Rect,
    ) {
        super.updateTaskSize(
            lastComputedTaskSize,
            lastComputedGridTaskSize,
            lastComputedCarouselTaskSize
            lastComputedCarouselTaskSize,
        )
        if (taskContainers.isEmpty()) {
            return
@@ -186,7 +186,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
            Log.d(
                TAG,
                "onMeasure: container=[$containerWidth,$containerHeight]" +
                    "window=[$windowWidth,$windowHeight] scale=[$scaleWidth,$scaleHeight]"
                    "window=[$windowWidth,$windowHeight] scale=[$scaleWidth,$scaleHeight]",
            )
        }

@@ -218,7 +218,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
                    Log.d(
                        TAG,
                        "onMeasure: task=${it.task.key} size=[$width,$height]" +
                            " margin=[$leftMargin,$topMargin]"
                            " margin=[$leftMargin,$topMargin]",
                    )
                }
            }
@@ -252,7 +252,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
        TestLogging.recordEvent(
            TestProtocol.SEQUENCE_MAIN,
            "launchDesktopFromRecents",
            taskIds.contentToString()
            taskIds.contentToString(),
        )
        val endCallback = RunnableList()
        val desktopController = recentsView.desktopRecentsController
@@ -262,7 +262,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
        }
        Log.d(
            TAG,
            "launchTaskWithDesktopController: ${taskIds.contentToString()}, withRemoteTransition: $animated"
            "launchTaskWithDesktopController: ${taskIds.contentToString()}, withRemoteTransition: $animated",
        )

        // Callbacks get run from recentsView for case when recents animation already running
@@ -274,11 +274,13 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu

    override fun launchWithoutAnimation(
        isQuickSwitch: Boolean,
        callback: (launched: Boolean) -> Unit
        callback: (launched: Boolean) -> Unit,
    ) = launchTaskWithDesktopController(animated = false)?.add { callback(true) } ?: callback(false)

    // Desktop tile can't be in split screen
    override fun confirmSecondSplitSelectApp(): Boolean = false
    // Return true when Task cannot be launched as fullscreen (i.e. in split select state) to skip
    // putting DesktopTaskView to split as it's not supported.
    override fun confirmSecondSplitSelectApp(): Boolean =
        recentsView?.canLaunchFullscreenTask() != true

    // TODO(b/330685808) support overlay for Screenshot action
    override fun setOverlayEnabled(overlayEnabled: Boolean) {}
+1 −1
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
    }

    @Override
    protected boolean canLaunchFullscreenTask() {
    public boolean canLaunchFullscreenTask() {
        if (FeatureFlags.enableSplitContextually()) {
            return !mSplitSelectStateController.isSplitSelectActive();
        } else {
+3 −20
Original line number Diff line number Diff line
@@ -235,6 +235,8 @@ import com.android.wm.shell.common.pip.IPipAnimationListener;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource;

import kotlin.Unit;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -248,8 +250,6 @@ import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import kotlin.Unit;

/**
 * A list of recent tasks.
 *
@@ -798,12 +798,6 @@ public abstract class RecentsView<
    @Nullable
    private DesktopRecentsTransitionController mDesktopRecentsTransitionController;

    /**
     * Keeps track of the desktop task. Optional and only present when the feature flag is enabled.
     */
    @Nullable
    private DesktopTaskView mDesktopTaskView;

    private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
            new MultiWindowModeChangedListener() {
                @Override
@@ -1177,7 +1171,7 @@ public abstract class RecentsView<
     *
     * @return {@code true} if child TaskViews can be launched when user taps on them
     */
    protected boolean canLaunchFullscreenTask() {
    public boolean canLaunchFullscreenTask() {
        return true;
    }

@@ -1870,7 +1864,6 @@ public abstract class RecentsView<
        mFilterState.updateInstanceCountMap(taskGroups);

        // Clear out desktop view if it is set
        mDesktopTaskView = null;

        // Move Desktop Tasks to the end of the list
        if (enableLargeDesktopWindowingTile()) {
@@ -1909,7 +1902,6 @@ public abstract class RecentsView<
                                .toList();
                ((DesktopTaskView) taskView).bind(nonMinimizedTasks, mOrientationState,
                        mTaskOverlayFactory);
                mDesktopTaskView = (DesktopTaskView) taskView;
            } else {
                Task task = groupTask.task1.key.id == stagedTaskIdToBeRemoved ? groupTask.task2
                        : groupTask.task1;
@@ -4970,7 +4962,6 @@ public abstract class RecentsView<
        mSplitSelectStateController.setAnimateCurrentTaskDismissal(
                true /*animateCurrentTaskDismissal*/);
        mSplitHiddenTaskViewIndex = indexOfChild(taskView);
        updateDesktopTaskVisibility(false /* visible */);
    }

    /**
@@ -4992,13 +4983,6 @@ public abstract class RecentsView<
        mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent,
                splitSelectSource.position.stagePosition, splitSelectSource.getItemInfo(),
                splitSelectSource.splitEvent, splitSelectSource.alreadyRunningTaskId);
        updateDesktopTaskVisibility(false /* visible */);
    }

    private void updateDesktopTaskVisibility(boolean visible) {
        if (mDesktopTaskView != null) {
            mDesktopTaskView.setVisibility(visible ? VISIBLE : GONE);
        }
    }

    /**
@@ -5208,7 +5192,6 @@ public abstract class RecentsView<
            mSplitHiddenTaskView.setThumbnailVisibility(VISIBLE, INVALID_TASK_ID);
            mSplitHiddenTaskView = null;
        }
        updateDesktopTaskVisibility(true /* visible */);
    }

    private void safeRemoveDragLayerView(@Nullable View viewToRemove) {