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

Commit 5328df24 authored by Alina Zaidi's avatar Alina Zaidi
Browse files

[dev_option][More flags 3/n] Update all usages of some flags to use

DesktopModeFlags.

Test: Current tests pass
Bug: 348193756
Flag: com.android.window.flags.show_desktop_windowing_dev_option
Change-Id: I99b30f9893fe5bc06c7043ad98c3e2fe012e2c92
parent 863e0121
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -44,7 +44,9 @@ enum class DesktopModeFlags(
  TASK_STACK_OBSERVER_IN_SHELL(Flags::enableTaskStackObserverInShell, true),
  SIZE_CONSTRAINTS(Flags::enableDesktopWindowingSizeConstraints, true),
  DYNAMIC_INITIAL_BOUNDS(Flags::enableWindowingDynamicInitialBounds, true),
  ENABLE_DESKTOP_WINDOWING_TASK_LIMIT(Flags::enableDesktopWindowingTaskLimit, true);
  ENABLE_DESKTOP_WINDOWING_TASK_LIMIT(Flags::enableDesktopWindowingTaskLimit, true),
  BACK_NAVIGATION(Flags::enableDesktopWindowingBackNavigation, true),
  EDGE_DRAG_RESIZE(Flags::enableWindowingEdgeDragResize, true);

  /**
   * Determines state of flag based on the actual flag and desktop mode developer option overrides.
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ import com.android.internal.jank.Cuj.CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELE
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.internal.protolog.ProtoLog
import com.android.window.flags.Flags
import com.android.wm.shell.RootTaskDisplayAreaOrganizer
import com.android.wm.shell.ShellTaskOrganizer
import com.android.wm.shell.common.DisplayController
@@ -982,7 +981,7 @@ class DesktopTasksController(
        }
        taskRepository.addClosingTask(task.displayId, task.taskId)
        // If a CLOSE or TO_BACK is triggered on a desktop task, remove the task.
        if (Flags.enableDesktopWindowingBackNavigation() &&
        if (DesktopModeFlags.BACK_NAVIGATION.isEnabled(context) &&
            taskRepository.isVisibleTask(task.taskId)) {
            wct.removeTask(task.token)
        }
@@ -1488,7 +1487,8 @@ class DesktopTasksController(
        }

        override fun hideStashedDesktopApps(displayId: Int) {
            ProtoLog.w(WM_SHELL_DESKTOP_MODE, "IDesktopModeImpl: hideStashedDesktopApps is deprecated")
            ProtoLog.w(WM_SHELL_DESKTOP_MODE,
                "IDesktopModeImpl: hideStashedDesktopApps is deprecated")
        }

        override fun getVisibleTaskCount(displayId: Int): Int {
+1 −1
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL

        final Resources res = mResult.mRootView.getResources();
        mDragResizeListener.setGeometry(new DragResizeWindowGeometry(0 /* taskCornerRadius */,
                new Size(mResult.mWidth, mResult.mHeight), getResizeEdgeHandleSize(res),
                new Size(mResult.mWidth, mResult.mHeight), getResizeEdgeHandleSize(mContext, res),
                getFineResizeCornerSize(res), getLargeResizeCornerSize(res)), touchSlop);
    }

+3 −2
Original line number Diff line number Diff line
@@ -490,8 +490,9 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        final Resources res = mResult.mRootView.getResources();
        if (mDragResizeListener.setGeometry(
                new DragResizeWindowGeometry(mRelayoutParams.mCornerRadius,
                        new Size(mResult.mWidth, mResult.mHeight), getResizeEdgeHandleSize(res),
                        getFineResizeCornerSize(res), getLargeResizeCornerSize(res)), touchSlop)
                        new Size(mResult.mWidth, mResult.mHeight),
                        getResizeEdgeHandleSize(mContext, res), getFineResizeCornerSize(res),
                        getLargeResizeCornerSize(res)), touchSlop)
                || !mTaskInfo.positionInParent.equals(mPositionInParent)) {
            updateExclusionRegion();
        }
+10 −7
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ class DragResizeInputListener implements AutoCloseable {
    private final InputChannel mInputChannel;
    private final TaskResizeInputEventReceiver mInputEventReceiver;

    private final Context mContext;
    private final SurfaceControl mInputSinkSurface;
    private final IBinder mSinkClientToken;
    private final InputChannel mSinkInputChannel;
@@ -97,6 +98,7 @@ class DragResizeInputListener implements AutoCloseable {
            Supplier<SurfaceControl.Builder> surfaceControlBuilderSupplier,
            Supplier<SurfaceControl.Transaction> surfaceControlTransactionSupplier,
            DisplayController displayController) {
        mContext = context;
        mSurfaceControlTransactionSupplier = surfaceControlTransactionSupplier;
        mDisplayId = displayId;
        mDecorationSurface = decorationSurface;
@@ -180,7 +182,7 @@ class DragResizeInputListener implements AutoCloseable {

        mTouchRegion.setEmpty();
        // Apply the geometry to the touch region.
        geometry.union(mTouchRegion);
        geometry.union(mContext, mTouchRegion);
        mInputEventReceiver.setGeometry(geometry);
        mInputEventReceiver.setTouchRegion(mTouchRegion);

@@ -354,7 +356,7 @@ class DragResizeInputListener implements AutoCloseable {
         */
        @NonNull Region getCornersRegion() {
            Region region = new Region();
            mDragResizeWindowGeometry.union(region);
            mDragResizeWindowGeometry.union(mContext, region);
            return region;
        }

@@ -395,7 +397,7 @@ class DragResizeInputListener implements AutoCloseable {
            // Touch events are tracked in four corners. Other events are tracked in resize edges.
            switch (e.getActionMasked()) {
                case MotionEvent.ACTION_DOWN: {
                    mShouldHandleEvents = mDragResizeWindowGeometry.shouldHandleEvent(e,
                    mShouldHandleEvents = mDragResizeWindowGeometry.shouldHandleEvent(mContext, e,
                            new Point() /* offset */);
                    if (mShouldHandleEvents) {
                        // Save the id of the pointer for this drag interaction; we will use the
@@ -405,8 +407,9 @@ class DragResizeInputListener implements AutoCloseable {
                        float y = e.getY(0);
                        float rawX = e.getRawX(0);
                        float rawY = e.getRawY(0);
                        final int ctrlType = mDragResizeWindowGeometry.calculateCtrlType(
                                isEventFromTouchscreen(e), isEdgeResizePermitted(e), x, y);
                        final int ctrlType = mDragResizeWindowGeometry.calculateCtrlType(mContext,
                                isEventFromTouchscreen(e), isEdgeResizePermitted(mContext, e), x,
                                y);
                        ProtoLog.d(WM_SHELL_DESKTOP_MODE,
                                "%s: Handling action down, update ctrlType to %d", TAG, ctrlType);
                        mDragStartTaskBounds = mCallback.onDragPositioningStart(ctrlType,
@@ -496,7 +499,7 @@ class DragResizeInputListener implements AutoCloseable {
            // Since we are handling cursor, we know that this is not a touchscreen event, and
            // that edge resizing should always be allowed.
            @DragPositioningCallback.CtrlType int ctrlType =
                    mDragResizeWindowGeometry.calculateCtrlType(/* isTouchscreen= */
                    mDragResizeWindowGeometry.calculateCtrlType(mContext, /* isTouchscreen= */
                            false, /* isEdgeResizePermitted= */ true, x, y);

            int cursorType = PointerIcon.TYPE_DEFAULT;
@@ -537,7 +540,7 @@ class DragResizeInputListener implements AutoCloseable {
        }

        private boolean shouldHandleEvent(MotionEvent e, Point offset) {
            return mDragResizeWindowGeometry.shouldHandleEvent(e, offset);
            return mDragResizeWindowGeometry.shouldHandleEvent(mContext, e, offset);
        }
    }
}
Loading