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

Commit 219fe368 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Use DesktopModeWindowDecorViewModel when providing WindowDecorViewModel

Before this CL we create two instances of
DesktopModeWindowDecorViewModel since we provide one
WindowDecorViewModel and one DesktopModeWindowDecorViewModel.
With this CL we reuse the DesktopModeWindowDecorViewModel instance for
the WindowDecorViewModel provider.

Bug: 379672644
Test: NA
Flag: EXEMPT refactoring
Change-Id: I74a7a98e70f7613b86a8bd14075c994d4e3c793c
parent 1d5e054f
Loading
Loading
Loading
Loading
+5 −47
Original line number Diff line number Diff line
@@ -286,57 +286,15 @@ public abstract class WMShellModule {
            @ShellBackgroundThread ShellExecutor bgExecutor,
            ShellInit shellInit,
            IWindowManager windowManager,
            ShellCommandHandler shellCommandHandler,
            ShellTaskOrganizer taskOrganizer,
            @DynamicOverride DesktopRepository desktopRepository,
            DisplayController displayController,
            ShellController shellController,
            DisplayInsetsController displayInsetsController,
            SyncTransactionQueue syncQueue,
            Transitions transitions,
            Optional<DesktopTasksController> desktopTasksController,
            RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer,
            InteractionJankMonitor interactionJankMonitor,
            AppToWebGenericLinksParser genericLinksParser,
            AssistContentRequester assistContentRequester,
            MultiInstanceHelper multiInstanceHelper,
            Optional<DesktopTasksLimiter> desktopTasksLimiter,
            AppHandleEducationController appHandleEducationController,
            AppToWebEducationController appToWebEducationController,
            WindowDecorCaptionHandleRepository windowDecorCaptionHandleRepository,
            Optional<DesktopActivityOrientationChangeHandler> desktopActivityOrientationHandler,
            FocusTransitionObserver focusTransitionObserver,
            DesktopModeEventLogger desktopModeEventLogger) {
        if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
            return new DesktopModeWindowDecorViewModel(
                    context,
                    mainExecutor,
                    mainHandler,
                    mainChoreographer,
                    bgExecutor,
                    shellInit,
                    shellCommandHandler,
                    windowManager,
                    taskOrganizer,
                    desktopRepository,
                    displayController,
                    shellController,
                    displayInsetsController,
                    syncQueue,
                    transitions,
                    desktopTasksController,
                    rootTaskDisplayAreaOrganizer,
                    interactionJankMonitor,
                    genericLinksParser,
                    assistContentRequester,
                    multiInstanceHelper,
                    desktopTasksLimiter,
                    appHandleEducationController,
                    appToWebEducationController,
                    windowDecorCaptionHandleRepository,
                    desktopActivityOrientationHandler,
                    focusTransitionObserver,
                    desktopModeEventLogger);
            Optional<DesktopModeWindowDecorViewModel> desktopModeWindowDecorViewModel) {
        if (desktopModeWindowDecorViewModel.isPresent()) {
            return desktopModeWindowDecorViewModel.get();
        }
        return new CaptionWindowDecorViewModel(
                context,
@@ -908,7 +866,7 @@ public abstract class WMShellModule {
            Context context,
            @ShellMainThread ShellExecutor shellExecutor,
            @ShellMainThread Handler mainHandler,
            Choreographer mainChoreographer,
            @ShellMainThread Choreographer mainChoreographer,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            ShellInit shellInit,
            ShellCommandHandler shellCommandHandler,
@@ -934,7 +892,7 @@ public abstract class WMShellModule {
            FocusTransitionObserver focusTransitionObserver,
            DesktopModeEventLogger desktopModeEventLogger
    ) {
        if (!DesktopModeStatus.canEnterDesktopMode(context)) {
        if (!DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
            return Optional.empty();
        }
        return Optional.of(new DesktopModeWindowDecorViewModel(context, shellExecutor, mainHandler,