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

Commit 15a2c1e3 authored by Winson Chung's avatar Winson Chung
Browse files

Move DragAndDropController to the handheld WMShellModule

- It's only used by other handheld features (split/bubbles/desktop)
  and lets us remove the config_enableShellDragDrop resource down
  the line

Bug: 320797628
Test: Builds
Test: atest NexusLauncherTests
Change-Id: I7dd4f1d1de10a287c951ad9310c4ab40e239d227
parent fbae6c48
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -259,7 +259,7 @@ public class BubbleController implements ConfigurationChangeListener,
    /** One handed mode controller to register transition listener. */
    private final Optional<OneHandedController> mOneHandedOptional;
    /** Drag and drop controller to register listener for onDragStarted. */
    private final Optional<DragAndDropController> mDragAndDropController;
    private final DragAndDropController mDragAndDropController;
    /** Used to send bubble events to launcher. */
    private Bubbles.BubbleStateListener mBubbleStateListener;

@@ -285,7 +285,7 @@ public class BubbleController implements ConfigurationChangeListener,
            BubblePositioner positioner,
            DisplayController displayController,
            Optional<OneHandedController> oneHandedOptional,
            Optional<DragAndDropController> dragAndDropController,
            DragAndDropController dragAndDropController,
            @ShellMainThread ShellExecutor mainExecutor,
            @ShellMainThread Handler mainHandler,
            @ShellBackgroundThread ShellExecutor bgExecutor,
@@ -463,7 +463,7 @@ public class BubbleController implements ConfigurationChangeListener,
                });

        mOneHandedOptional.ifPresent(this::registerOneHandedState);
        mDragAndDropController.ifPresent(controller -> controller.addListener(this::collapseStack));
        mDragAndDropController.addListener(this::collapseStack);

        // Clear out any persisted bubbles on disk that no longer have a valid user.
        List<UserInfo> users = mUserManager.getAliveUsers();
+3 −4
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ public class TvWMShellModule {
            DisplayController displayController,
            DisplayImeController displayImeController,
            DisplayInsetsController displayInsetsController,
            Optional<DragAndDropController> dragAndDropController,
            Transitions transitions,
            TransactionPool transactionPool,
            IconProvider iconProvider,
@@ -94,8 +93,8 @@ public class TvWMShellModule {
            SystemWindows systemWindows) {
        return new TvSplitScreenController(context, shellInit, shellCommandHandler, shellController,
                shellTaskOrganizer, syncQueue, rootTDAOrganizer, displayController,
                displayImeController, displayInsetsController, dragAndDropController, transitions,
                transactionPool, iconProvider, recentTasks, launchAdjacentController, mainExecutor,
                mainHandler, systemWindows);
                displayImeController, displayInsetsController, transitions, transactionPool,
                iconProvider, recentTasks, launchAdjacentController, mainExecutor, mainHandler,
                systemWindows);
    }
}
+0 −16
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
import com.android.wm.shell.desktopmode.DesktopTasksController;
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
import com.android.wm.shell.displayareahelper.DisplayAreaHelperController;
import com.android.wm.shell.draganddrop.DragAndDropController;
import com.android.wm.shell.freeform.FreeformComponents;
import com.android.wm.shell.fullscreen.FullscreenTaskListener;
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutoutController;
@@ -201,20 +200,6 @@ public abstract class WMShellBaseModule {
                context, shellInit, postureController, displayController, mainExecutor);
    }

    @WMSingleton
    @Provides
    static Optional<DragAndDropController> provideDragAndDropController(Context context,
            ShellInit shellInit,
            ShellController shellController,
            ShellCommandHandler shellCommandHandler,
            DisplayController displayController,
            UiEventLogger uiEventLogger,
            IconProvider iconProvider,
            @ShellMainThread ShellExecutor mainExecutor) {
        return Optional.ofNullable(DragAndDropController.create(context, shellInit, shellController,
                shellCommandHandler, displayController, uiEventLogger, iconProvider, mainExecutor));
    }

    @WMSingleton
    @Provides
    static ShellTaskOrganizer provideShellTaskOrganizer(
@@ -911,7 +896,6 @@ public abstract class WMShellBaseModule {
            DisplayController displayController,
            DisplayImeController displayImeController,
            DisplayInsetsController displayInsetsController,
            Optional<DragAndDropController> dragAndDropControllerOptional,
            ShellTaskOrganizer shellTaskOrganizer,
            Optional<BubbleController> bubblesOptional,
            Optional<SplitScreenController> splitScreenOptional,
+21 −2
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ public abstract class WMShellModule {
            BubblePositioner positioner,
            DisplayController displayController,
            @DynamicOverride Optional<OneHandedController> oneHandedOptional,
            Optional<DragAndDropController> dragAndDropController,
            DragAndDropController dragAndDropController,
            @ShellMainThread ShellExecutor mainExecutor,
            @ShellMainThread Handler mainHandler,
            @ShellBackgroundThread ShellExecutor bgExecutor,
@@ -338,7 +338,7 @@ public abstract class WMShellModule {
            DisplayController displayController,
            DisplayImeController displayImeController,
            DisplayInsetsController displayInsetsController,
            Optional<DragAndDropController> dragAndDropController,
            DragAndDropController dragAndDropController,
            Transitions transitions,
            TransactionPool transactionPool,
            IconProvider iconProvider,
@@ -552,6 +552,24 @@ public abstract class WMShellModule {
        return new DesktopModeTaskRepository();
    }

    //
    // Drag and drop
    //

    @WMSingleton
    @Provides
    static DragAndDropController provideDragAndDropController(Context context,
            ShellInit shellInit,
            ShellController shellController,
            ShellCommandHandler shellCommandHandler,
            DisplayController displayController,
            UiEventLogger uiEventLogger,
            IconProvider iconProvider,
            @ShellMainThread ShellExecutor mainExecutor) {
        return new DragAndDropController(context, shellInit, shellController,
                shellCommandHandler, displayController, uiEventLogger, iconProvider, mainExecutor);
    }

    //
    // Misc
    //
@@ -562,6 +580,7 @@ public abstract class WMShellModule {
    @ShellCreateTriggerOverride
    @Provides
    static Object provideIndependentShellComponentsToCreate(
            DragAndDropController dragAndDropController,
            DefaultMixedHandler defaultMixedHandler) {
        return new Object();
    }
+1 −19
Original line number Diff line number Diff line
@@ -105,25 +105,7 @@ public class DragAndDropController implements RemoteCallable<DragAndDropControll
        void onDragStarted();
    }

    /**
     * Creates {@link DragAndDropController}. Returns {@code null} if the feature is disabled.
     */
    public static DragAndDropController create(Context context,
            ShellInit shellInit,
            ShellController shellController,
            ShellCommandHandler shellCommandHandler,
            DisplayController displayController,
            UiEventLogger uiEventLogger,
            IconProvider iconProvider,
            ShellExecutor mainExecutor) {
        if (!context.getResources().getBoolean(R.bool.config_enableShellDragDrop)) {
            return null;
        }
        return new DragAndDropController(context, shellInit, shellController, shellCommandHandler,
                displayController, uiEventLogger, iconProvider, mainExecutor);
    }

    DragAndDropController(Context context,
    public DragAndDropController(Context context,
            ShellInit shellInit,
            ShellController shellController,
            ShellCommandHandler shellCommandHandler,
Loading