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

Commit a2fa8d88 authored by Matt Sziklay's avatar Matt Sziklay Committed by Android (Google) Code Review
Browse files

Merge "Update drag resizing to prioritize close button." into main

parents 356a5b9f 97cbdecf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -271,6 +271,9 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
                    if (e.findPointerIndex(mDragPointerId) == -1) {
                        mDragPointerId = e.getPointerId(0);
                    }
                    final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId);
                    // If a decor's resize drag zone is active, don't also try to reposition it.
                    if (decoration.isHandlingDragResize()) break;
                    final int dragPointerIdx = e.findPointerIndex(mDragPointerId);
                    mDragPositioningCallback.onDragPositioningMove(
                            e.getRawX(dragPointerIdx), e.getRawY(dragPointerIdx));
+4 −0
Original line number Diff line number Diff line
@@ -286,6 +286,10 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
        closeBackground.setTintList(buttonTintColor);
    }

    boolean isHandlingDragResize() {
        return mDragResizeListener.isHandlingDragResize();
    }

    private void closeDragResizeListener() {
        if (mDragResizeListener == null) {
            return;
+3 −1
Original line number Diff line number Diff line
@@ -491,8 +491,11 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                    return true;
                }
                case MotionEvent.ACTION_MOVE: {
                    mShouldClick = false;
                    final DesktopModeWindowDecoration decoration =
                            mWindowDecorByTaskId.get(mTaskId);
                    // If a decor's resize drag zone is active, don't also try to reposition it.
                    if (decoration.isHandlingDragResize()) break;
                    decoration.closeMaximizeMenu();
                    if (e.findPointerIndex(mDragPointerId) == -1) {
                        mDragPointerId = e.getPointerId(0);
@@ -505,7 +508,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                            e.getRawX(dragPointerIdx),
                            newTaskBounds));
                    mIsDragging = true;
                    mShouldClick = false;
                    return true;
                }
                case MotionEvent.ACTION_UP:
+4 −0
Original line number Diff line number Diff line
@@ -387,6 +387,10 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        return mHandleMenu != null;
    }

    boolean isHandlingDragResize() {
        return mDragResizeListener.isHandlingDragResize();
    }

    private void loadAppInfo() {
        String packageName = mTaskInfo.realActivity.getPackageName();
        PackageManager pm = mContext.getApplicationContext().getPackageManager();
+10 −1
Original line number Diff line number Diff line
@@ -320,6 +320,10 @@ class DragResizeInputListener implements AutoCloseable {
        }
    }

    boolean isHandlingDragResize() {
        return mInputEventReceiver.isHandlingEvents();
    }

    @Override
    public void close() {
        mInputEventReceiver.dispose();
@@ -386,6 +390,10 @@ class DragResizeInputListener implements AutoCloseable {
            finishInputEvent(inputEvent, handleInputEvent(inputEvent));
        }

        boolean isHandlingEvents() {
            return mShouldHandleEvents;
        }

        private boolean handleInputEvent(InputEvent inputEvent) {
            if (!(inputEvent instanceof MotionEvent)) {
                return false;
@@ -409,7 +417,6 @@ class DragResizeInputListener implements AutoCloseable {
                        mShouldHandleEvents = isInResizeHandleBounds(x, y);
                    }
                    if (mShouldHandleEvents) {
                        mInputManager.pilferPointers(mInputChannel.getToken());
                        mDragPointerId = e.getPointerId(0);
                        float rawX = e.getRawX(0);
                        float rawY = e.getRawY(0);
@@ -427,6 +434,7 @@ class DragResizeInputListener implements AutoCloseable {
                    if (!mShouldHandleEvents) {
                        break;
                    }
                    mInputManager.pilferPointers(mInputChannel.getToken());
                    int dragPointerIndex = e.findPointerIndex(mDragPointerId);
                    float rawX = e.getRawX(dragPointerIndex);
                    float rawY = e.getRawY(dragPointerIndex);
@@ -437,6 +445,7 @@ class DragResizeInputListener implements AutoCloseable {
                }
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_CANCEL: {
                    mInputManager.pilferPointers(mInputChannel.getToken());
                    if (mShouldHandleEvents) {
                        int dragPointerIndex = e.findPointerIndex(mDragPointerId);
                        final Rect taskBounds = mCallback.onDragPositioningEnd(
Loading