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

Commit 6da7b560 authored by Pragya Bajoria's avatar Pragya Bajoria
Browse files

Rename DesktopModeTaskRepository to DesktopRepository.

Flag: EXEMPT (refactoring)
Bug: 367267846
Change-Id: I051d8fe68bfac03efa297caf4bbe9f0336c1b2ae
parent b6924395
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ import com.android.wm.shell.compatui.impl.DefaultCompatUIHandler;
import com.android.wm.shell.compatui.impl.DefaultCompatUIRepository;
import com.android.wm.shell.compatui.impl.DefaultComponentIdGenerator;
import com.android.wm.shell.desktopmode.DesktopMode;
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
import com.android.wm.shell.desktopmode.DesktopRepository;
import com.android.wm.shell.desktopmode.DesktopTasksController;
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
import com.android.wm.shell.displayareahelper.DisplayAreaHelperController;
@@ -267,7 +267,7 @@ public abstract class WMShellBaseModule {
            Lazy<CompatUIShellCommandHandler> compatUIShellCommandHandler,
            Lazy<AccessibilityManager> accessibilityManager,
            CompatUIRepository compatUIRepository,
            Optional<DesktopModeTaskRepository> desktopModeTaskRepository,
            Optional<DesktopRepository> desktopRepository,
            @NonNull CompatUIState compatUIState,
            @NonNull CompatUIComponentIdGenerator componentIdGenerator,
            @NonNull CompatUIComponentFactory compatUIComponentFactory,
@@ -281,7 +281,7 @@ public abstract class WMShellBaseModule {
                            componentIdGenerator, compatUIComponentFactory, mainExecutor));
        }
        final IntPredicate inDesktopModePredicate =
                desktopModeTaskRepository.<IntPredicate>map(modeTaskRepository -> displayId ->
                desktopRepository.<IntPredicate>map(modeTaskRepository -> displayId ->
                        modeTaskRepository.getVisibleTaskCount(displayId) > 0)
                            .orElseGet(() -> displayId -> false);
        return Optional.of(
@@ -707,14 +707,14 @@ public abstract class WMShellBaseModule {
            ShellCommandHandler shellCommandHandler,
            TaskStackListenerImpl taskStackListener,
            ActivityTaskManager activityTaskManager,
            Optional<DesktopModeTaskRepository> desktopModeTaskRepository,
            Optional<DesktopRepository> desktopRepository,
            TaskStackTransitionObserver taskStackTransitionObserver,
            @ShellMainThread ShellExecutor mainExecutor
    ) {
        return Optional.ofNullable(
                RecentTasksController.create(context, shellInit, shellController,
                        shellCommandHandler, taskStackListener, activityTaskManager,
                        desktopModeTaskRepository, taskStackTransitionObserver, mainExecutor));
                        desktopRepository, taskStackTransitionObserver, mainExecutor));
    }

    @BindsOptionalOf
@@ -1003,16 +1003,16 @@ public abstract class WMShellBaseModule {

    @BindsOptionalOf
    @DynamicOverride
    abstract DesktopModeTaskRepository optionalDesktopModeTaskRepository();
    abstract DesktopRepository optionalDesktopRepository();

    @WMSingleton
    @Provides
    static Optional<DesktopModeTaskRepository> provideDesktopTaskRepository(Context context,
            @DynamicOverride Optional<Lazy<DesktopModeTaskRepository>> desktopModeTaskRepository) {
    static Optional<DesktopRepository> provideDesktopRepository(Context context,
            @DynamicOverride Optional<Lazy<DesktopRepository>> desktopRepository) {
        // Use optional-of-lazy for the dependency that this provider relies on.
        // Lazy ensures that this provider will not be the cause the dependency is created
        // when it will not be returned due to the condition below.
        return desktopModeTaskRepository.flatMap((lazy) -> {
        return desktopRepository.flatMap((lazy) -> {
            if (DesktopModeStatus.canEnterDesktopMode(context)) {
                return Optional.of(lazy.get());
            }
+17 −16
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ import com.android.wm.shell.desktopmode.DesktopMixedTransitionHandler;
import com.android.wm.shell.desktopmode.DesktopModeDragAndDropTransitionHandler;
import com.android.wm.shell.desktopmode.DesktopModeEventLogger;
import com.android.wm.shell.desktopmode.DesktopModeLoggerTransitionObserver;
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
import com.android.wm.shell.desktopmode.DesktopRepository;
import com.android.wm.shell.desktopmode.DesktopTasksController;
import com.android.wm.shell.desktopmode.DesktopTasksLimiter;
import com.android.wm.shell.desktopmode.DesktopTasksTransitionObserver;
@@ -245,7 +245,7 @@ public abstract class WMShellModule {
            IWindowManager windowManager,
            ShellCommandHandler shellCommandHandler,
            ShellTaskOrganizer taskOrganizer,
            @DynamicOverride DesktopModeTaskRepository desktopRepository,
            @DynamicOverride DesktopRepository desktopRepository,
            DisplayController displayController,
            ShellController shellController,
            DisplayInsetsController displayInsetsController,
@@ -352,7 +352,7 @@ public abstract class WMShellModule {
            Context context,
            ShellInit shellInit,
            ShellTaskOrganizer shellTaskOrganizer,
            Optional<DesktopModeTaskRepository> desktopModeTaskRepository,
            Optional<DesktopRepository> desktopRepository,
            LaunchAdjacentController launchAdjacentController,
            WindowDecorViewModel windowDecorViewModel) {
        // TODO(b/238217847): Temporarily add this check here until we can remove the dynamic
@@ -361,7 +361,7 @@ public abstract class WMShellModule {
                ? shellInit
                : null;
        return new FreeformTaskListener(context, init, shellTaskOrganizer,
                desktopModeTaskRepository, launchAdjacentController, windowDecorViewModel);
                desktopRepository, launchAdjacentController, windowDecorViewModel);
    }

    @WMSingleton
@@ -620,7 +620,7 @@ public abstract class WMShellModule {
            DesktopModeDragAndDropTransitionHandler desktopModeDragAndDropTransitionHandler,
            ToggleResizeDesktopTaskTransitionHandler toggleResizeDesktopTaskTransitionHandler,
            DragToDesktopTransitionHandler dragToDesktopTransitionHandler,
            @DynamicOverride DesktopModeTaskRepository desktopModeTaskRepository,
            @DynamicOverride DesktopRepository desktopRepository,
            DesktopModeLoggerTransitionObserver desktopModeLoggerTransitionObserver,
            LaunchAdjacentController launchAdjacentController,
            RecentsTransitionHandler recentsTransitionHandler,
@@ -636,7 +636,7 @@ public abstract class WMShellModule {
                returnToDragStartAnimator, enterDesktopTransitionHandler,
                exitDesktopTransitionHandler, desktopModeDragAndDropTransitionHandler,
                toggleResizeDesktopTaskTransitionHandler,
                dragToDesktopTransitionHandler, desktopModeTaskRepository,
                dragToDesktopTransitionHandler, desktopRepository,
                desktopModeLoggerTransitionObserver, launchAdjacentController,
                recentsTransitionHandler, multiInstanceHelper, mainExecutor, desktopTasksLimiter,
                recentTasksController.orElse(null), interactionJankMonitor, mainHandler);
@@ -647,7 +647,7 @@ public abstract class WMShellModule {
    static Optional<DesktopTasksLimiter> provideDesktopTasksLimiter(
            Context context,
            Transitions transitions,
            @DynamicOverride DesktopModeTaskRepository desktopModeTaskRepository,
            @DynamicOverride DesktopRepository desktopRepository,
            ShellTaskOrganizer shellTaskOrganizer,
            InteractionJankMonitor interactionJankMonitor,
            @ShellMainThread Handler handler) {
@@ -660,7 +660,7 @@ public abstract class WMShellModule {
        return Optional.of(
                new DesktopTasksLimiter(
                        transitions,
                        desktopModeTaskRepository,
                        desktopRepository,
                        shellTaskOrganizer,
                        maxTaskLimit,
                        interactionJankMonitor,
@@ -739,13 +739,14 @@ public abstract class WMShellModule {
    @WMSingleton
    @Provides
    @DynamicOverride
    static DesktopModeTaskRepository provideDesktopModeTaskRepository(

    static DesktopRepository provideDesktopRepository(
            Context context,
            ShellInit shellInit,
            DesktopPersistentRepository desktopPersistentRepository,
            @ShellMainThread CoroutineScope mainScope
    ) {
        return new DesktopModeTaskRepository(context, shellInit, desktopPersistentRepository,
        return new DesktopRepository(context, shellInit, desktopPersistentRepository,
                mainScope);
    }

@@ -757,12 +758,12 @@ public abstract class WMShellModule {
            ShellTaskOrganizer shellTaskOrganizer,
            TaskStackListenerImpl taskStackListener,
            ToggleResizeDesktopTaskTransitionHandler toggleResizeDesktopTaskTransitionHandler,
            @DynamicOverride DesktopModeTaskRepository desktopModeTaskRepository
            @DynamicOverride DesktopRepository desktopRepository
    ) {
        if (DesktopModeStatus.canEnterDesktopMode(context)) {
            return Optional.of(new DesktopActivityOrientationChangeHandler(
                    context, shellInit, shellTaskOrganizer, taskStackListener,
                    toggleResizeDesktopTaskTransitionHandler, desktopModeTaskRepository));
                    toggleResizeDesktopTaskTransitionHandler, desktopRepository));
        }
        return Optional.empty();
    }
@@ -771,12 +772,12 @@ public abstract class WMShellModule {
    @Provides
    static Optional<DesktopTasksTransitionObserver> provideDesktopTasksTransitionObserver(
            Context context,
            Optional<DesktopModeTaskRepository> desktopModeTaskRepository,
            Optional<DesktopRepository> desktopRepository,
            Transitions transitions,
            ShellTaskOrganizer shellTaskOrganizer,
            ShellInit shellInit
    ) {
        return desktopModeTaskRepository.flatMap(repository ->
        return desktopRepository.flatMap(repository ->
                Optional.of(new DesktopTasksTransitionObserver(
                        context, repository, transitions, shellTaskOrganizer, shellInit))
        );
@@ -787,7 +788,7 @@ public abstract class WMShellModule {
    static Optional<DesktopMixedTransitionHandler> provideDesktopMixedTransitionHandler(
            Context context,
            Transitions transitions,
            @DynamicOverride DesktopModeTaskRepository desktopModeTaskRepository,
            @DynamicOverride DesktopRepository desktopRepository,
            FreeformTaskTransitionHandler freeformTaskTransitionHandler,
            CloseDesktopTaskTransitionHandler closeDesktopTaskTransitionHandler,
            InteractionJankMonitor interactionJankMonitor,
@@ -801,7 +802,7 @@ public abstract class WMShellModule {
                new DesktopMixedTransitionHandler(
                        context,
                        transitions,
                        desktopModeTaskRepository,
                        desktopRepository,
                        freeformTaskTransitionHandler,
                        closeDesktopTaskTransitionHandler,
                        interactionJankMonitor,
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class DesktopActivityOrientationChangeHandler(
    private val shellTaskOrganizer: ShellTaskOrganizer,
    private val taskStackListener: TaskStackListenerImpl,
    private val resizeHandler: ToggleResizeDesktopTaskTransitionHandler,
    private val taskRepository: DesktopModeTaskRepository,
    private val taskRepository: DesktopRepository,
) {

    init {
+2 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ import com.android.wm.shell.transition.Transitions
class DesktopMixedTransitionHandler(
    private val context: Context,
    private val transitions: Transitions,
    private val desktopTaskRepository: DesktopModeTaskRepository,
    private val desktopRepository: DesktopRepository,
    private val freeformTaskTransitionHandler: FreeformTaskTransitionHandler,
    private val closeDesktopTaskTransitionHandler: CloseDesktopTaskTransitionHandler,
    private val interactionJankMonitor: InteractionJankMonitor,
@@ -138,7 +138,7 @@ class DesktopMixedTransitionHandler(

    private fun isLastDesktopTask(change: TransitionInfo.Change): Boolean =
        change.taskInfo?.let {
            desktopTaskRepository.getActiveNonMinimizedTaskCount(it.displayId) == 1
            desktopRepository.getActiveNonMinimizedTaskCount(it.displayId) == 1
        } ?: false

    private fun findCloseDesktopTaskChange(info: TransitionInfo): TransitionInfo.Change? {
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public interface DesktopMode {
     * @param listener the listener to add.
     * @param callbackExecutor the executor to call the listener on.
     */
    void addVisibleTasksListener(DesktopModeTaskRepository.VisibleTasksListener listener,
    void addVisibleTasksListener(DesktopRepository.VisibleTasksListener listener,
            Executor callbackExecutor);

    /**
Loading