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

Commit ec52ed9f authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Intercept clicks for non-supported split targets on workspace

* If we're in split selection state we disable the following
- G icon on PSB
- Lens icon on PSB
- Smartspace
- Widgets

Bug: 295467097
Test: Enter split contextual and observe split instructions
view going boing when tapping on unsupported target
Flag: com.android.wm.shell.enable_split_contextual

Change-Id: Ia7783472f3de9359c2784788be5f35596cbc8deb
parent d4b2c8a8
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -28,10 +28,8 @@ import android.util.Log;
import android.util.Pair;
import android.view.View;
import android.widget.RemoteViews;
import android.widget.Toast;
import android.window.SplashScreen;

import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.ItemInfo;
@@ -63,8 +61,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
            // Log metric
            StatsLogManager.StatsLogger logger = mLauncher.getStatsLogManager().logger();
            logger.log(LAUNCHER_SPLIT_WIDGET_ATTEMPT);
            Toast.makeText(hostView.getContext(), R.string.split_widgets_not_supported,
                    Toast.LENGTH_SHORT).show();
            mLauncher.handleIncorrectSplitTargetSelection();
            return true;
        }
        Pair<Intent, ActivityOptions> options = remoteResponse.getLaunchOptions(view);
+12 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
import static com.android.launcher3.config.FeatureFlags.enableSplitContextually;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
@@ -676,7 +677,7 @@ public class QuickstepLauncher extends Launcher {
                    splitSelectSource.alreadyRunningTaskId = taskWasFound
                            ? foundTask.key.id
                            : INVALID_TASK_ID;
                    if (FeatureFlags.enableSplitContextually()) {
                    if (enableSplitContextually()) {
                        startSplitToHome(splitSelectSource);
                    } else {
                        recentsView.initiateSplitSelect(splitSelectSource);
@@ -761,7 +762,7 @@ public class QuickstepLauncher extends Launcher {

        super.onPause();

        if (FeatureFlags.enableSplitContextually()) {
        if (enableSplitContextually()) {
            // If Launcher pauses before both split apps are selected, exit split screen.
            if (!mSplitSelectStateController.isBothSplitAppsConfirmed() &&
                    !mSplitSelectStateController.isLaunchingFirstAppFullscreen()) {
@@ -1352,6 +1353,15 @@ public class QuickstepLauncher extends Launcher {
        return (mTaskbarUIController != null && mTaskbarUIController.hasBubbles());
    }

    @Override
    public boolean handleIncorrectSplitTargetSelection() {
        if (enableSplitContextually() && !mSplitSelectStateController.isSplitSelectActive()) {
            return false;
        }
        mSplitSelectStateController.getSplitInstructionsView().goBoing();
        return true;
    }

    private static final class LauncherTaskViewController extends
            TaskViewTouchController<Launcher> {

+13 −0
Original line number Diff line number Diff line
@@ -154,6 +154,19 @@ public interface ActivityContext {
        return false;
    }

    /**
     * Handle user tapping on unsupported target when in split selection mode.
     * See {@link #isSplitSelectionActive()}
     *
     * @return {@code true} if this method will handle the incorrect target selection,
     *         {@code false} if it could not be handled or if not possible to handle based on
     *         current split state
     */
    default boolean handleIncorrectSplitTargetSelection() {
        // Overridden
        return false;
    }

    /**
     * The root view to support drag-and-drop and popup support.
     */