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

Commit e3a50cc3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Cache last valid drag area to check if task needs to be repositioned on...

Merge "Cache last valid drag area to check if task needs to be repositioned on display change" into main
parents dd880773 41173da3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -522,7 +522,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel, FocusT
                            e.getDisplayId(),
                            e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx));
                    DragPositioningCallbackUtility.snapTaskBoundsIfNecessary(newTaskBounds,
                            mWindowDecorByTaskId.get(mTaskId).calculateValidDragArea());
                            mWindowDecorByTaskId.get(mTaskId).getValidDragArea());
                    if (newTaskBounds != taskInfo.configuration.windowConfiguration.getBounds()) {
                        final WindowContainerTransaction wct = new WindowContainerTransaction();
                        wct.setBounds(taskInfo.token, newTaskBounds);
+0 −1
Original line number Diff line number Diff line
@@ -131,7 +131,6 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
        mDragPositioningCallback = dragPositioningCallback;
    }

    @Override
    @NonNull
    Rect calculateValidDragArea() {
        final Context displayContext = mDisplayController.getDisplayContext(mTaskInfo.displayId);
+0 −6
Original line number Diff line number Diff line
@@ -121,12 +121,6 @@ public class CarWindowDecoration extends WindowDecoration<WindowDecorLinearLayou
        }
    }

    @Override
    @NonNull
    Rect calculateValidDragArea() {
        return new Rect();
    }

    @Override
    int getCaptionViewId() {
        return R.id.caption;
+1 −1
Original line number Diff line number Diff line
@@ -672,7 +672,7 @@ public class DesktopModeTouchEventListener
                // Tasks bounds haven't actually been updated (only its leash), so pass to
                // DesktopTasksController to allow secondary transformations (i.e. snap resizing
                // or transforming to fullscreen) before setting new task bounds.
                final Rect validDragArea = decoration.calculateValidDragArea();
                final Rect validDragArea = decoration.getValidDragArea();
                final boolean needDragIndicatorCleanup =
                        mDesktopTasksController.onDragPositioningEnd(
                                taskInfo, decoration.getTaskSurface(), e.getDisplayId(),
+5 −3
Original line number Diff line number Diff line
@@ -494,14 +494,16 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                }

                // Check if display has been rotated between portrait & landscape
                if (displayId == taskInfo.displayId && taskInfo.isFreeform()
                        && (fromRotation % 2 != toRotation % 2)) {
                if (displayId == taskInfo.displayId && (fromRotation % 2 != toRotation % 2)) {
                    final Rect validDragArea = decoration.getValidDragArea();
                    // If not draggable, return
                    if (validDragArea == null) return;
                    // Check if the task bounds on the rotated display will be out of bounds.
                    // If so, then update task bounds to be within reachable area.
                    final Rect taskBounds = new Rect(
                            taskInfo.configuration.windowConfiguration.getBounds());
                    if (DragPositioningCallbackUtility.snapTaskBoundsIfNecessary(
                            taskBounds, decoration.calculateValidDragArea())) {
                            taskBounds, validDragArea)) {
                        t.setBounds(taskInfo.token, taskBounds);
                    }
                }
Loading