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

Commit bcfc67ff authored by Jorge Gil's avatar Jorge Gil
Browse files

Add DesktopModeTouchEventListener tests

Flag: EXEMPT adding tests
Bug: 418225224
Test: atest DesktopModeTouchEventListenerTest
Change-Id: Iabea04a2655815f352253f4609d398f5f370ed23
parent a84663e3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ import com.android.wm.shell.windowdecor.WindowDecorViewModel;
import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer;
import com.android.wm.shell.windowdecor.common.AppHandleAndHeaderVisibilityHelper;
import com.android.wm.shell.windowdecor.common.WindowDecorTaskResourceLoader;
import com.android.wm.shell.windowdecor.common.WindowDecorTaskResourceLoaderImpl;
import com.android.wm.shell.windowdecor.common.viewhost.DefaultWindowDecorViewHostSupplier;
import com.android.wm.shell.windowdecor.common.viewhost.PooledWindowDecorViewHostSupplier;
import com.android.wm.shell.windowdecor.common.viewhost.WindowDecorViewHost;
@@ -1339,8 +1340,9 @@ public abstract class WMShellModule {
            @ShellBackgroundThread MainCoroutineDispatcher bgDispatcher,
            @NonNull ShellCommandHandler shellCommandHandler,
            @NonNull UserProfileContexts userProfileContexts) {
        return new WindowDecorTaskResourceLoader(context, shellInit, shellController, mainHandler,
                mainScope, mainDispatcher, bgDispatcher, shellCommandHandler, userProfileContexts);
        return new WindowDecorTaskResourceLoaderImpl(context, shellInit, shellController,
                mainHandler, mainScope, mainDispatcher, bgDispatcher, shellCommandHandler,
                userProfileContexts);
    }

    @WMSingleton
+847 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −778

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ import com.android.wm.shell.freeform.FreeformTaskTransitionStarter;
/**
 * Utility class to handle task operations performed on a window decoration.
 */
class TaskOperations {
public class TaskOperations {
    private static final String TAG = "TaskOperations";

    private final FreeformTaskTransitionStarter mTransitionStarter;
+17 −2
Original line number Diff line number Diff line
@@ -40,10 +40,12 @@ import android.window.DesktopExperienceFlags
import android.window.TaskConstants
import android.window.WindowContainerTransaction
import com.android.app.tracing.traceSection
import com.android.internal.protolog.ProtoLog
import com.android.wm.shell.ShellTaskOrganizer
import com.android.wm.shell.common.BoxShadowHelper
import com.android.wm.shell.common.DisplayController
import com.android.wm.shell.common.DisplayController.OnDisplaysChangedListener
import com.android.wm.shell.protolog.ShellProtoLogGroup
import com.android.wm.shell.shared.annotations.ShellMainThread
import com.android.wm.shell.windowdecor.caption.CaptionController
import com.android.wm.shell.windowdecor.extension.getDimensionPixelSize
@@ -163,6 +165,7 @@ abstract class WindowDecoration2<T>(
            traceTag = Trace.TRACE_TAG_WINDOW_MANAGER,
            name = "WindowDecoration2#relayout",
        ) {
            logD("relayout(task=%d) startT=%d finishT=%d", taskInfo.taskId, startT.id, finishT.id)
            taskInfo = params.runningTaskInfo
            hasGlobalFocus = params.hasGlobalFocus
            exclusionRegion.set(params.displayExclusionRegion)
@@ -186,6 +189,7 @@ abstract class WindowDecoration2<T>(
                if (params.setTaskVisibilityPositionAndCrop) {
                    finishT.hide(taskSurface)
                }
                logD("relayout(task=%d) invisible task, skipping", taskInfo.taskId)
                return null
            }

@@ -193,7 +197,10 @@ abstract class WindowDecoration2<T>(

            // If display has not yet appeared, return. Relayout will run again once display is
            // registered
            display ?: return null
            if (display == null) {
                logD("relayout(task=%d) null display, skipping", taskInfo.taskId)
                return null
            }

            val taskBounds = taskInfo.getConfiguration().windowConfiguration.bounds
            val taskWidth = taskBounds.width()
@@ -246,7 +253,11 @@ abstract class WindowDecoration2<T>(
                )
            }

            val controller = getOrCreateCaptionController(params.captionType) ?: return null
            val controller = getOrCreateCaptionController(params.captionType)
            if (controller == null) {
                logD("relayout(task=%d) null caption controller, skipping", taskInfo.taskId)
                return null
            }
            val captionResult =
                controller.relayout(
                    params = params,
@@ -420,6 +431,10 @@ abstract class WindowDecoration2<T>(
        startT.setWindowCrop(containerSurface, taskWidth, taskHeight).show(containerSurface)
    }

    private fun logD(msg: String, vararg arguments: Any?) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_WINDOW_DECORATION, "%s: $msg", TAG, *arguments)
    }

    private fun releaseViewsIfNeeded(params: RelayoutParams, wct: WindowContainerTransaction) =
        traceSection(
            traceTag = Trace.TRACE_TAG_WINDOW_MANAGER,
Loading