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

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

Merge changes Ic161ec76,I0a8c6897 into main

* changes:
  Enable edge resizing for touch input.
  Refactor drag resize touch regions out of the input listener.
parents ff064c92 c007c87c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -515,8 +515,20 @@
    <!-- The size of the icon shown in the resize veil. -->
    <dimen name="desktop_mode_resize_veil_icon_size">96dp</dimen>

    <!-- The with of the border around the app task for edge resizing, when
         enable_windowing_edge_drag_resize is enabled. -->
    <dimen name="desktop_mode_edge_handle">12dp</dimen>

    <!-- The original width of the border around the app task for edge resizing, when
         enable_windowing_edge_drag_resize is disabled. -->
    <dimen name="freeform_resize_handle">15dp</dimen>

    <!-- The size of the corner region for drag resizing with touch, when a larger touch region is
         appropriate. Applied when enable_windowing_edge_drag_resize is enabled. -->
    <dimen name="desktop_mode_corner_resize_large">48dp</dimen>

    <!-- The original size of the corner region for darg resizing, when
         enable_windowing_edge_drag_resize is disabled. -->
    <dimen name="freeform_resize_corner">44dp</dimen>

    <!-- The width of the area at the sides of the screen where a freeform task will transition to
+10 −7
Original line number Diff line number Diff line
@@ -16,17 +16,23 @@

package com.android.wm.shell.windowdecor;

import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getFineResizeCornerSize;
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getLargeResizeCornerSize;
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getResizeEdgeHandleSize;

import android.annotation.NonNull;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.WindowConfiguration;
import android.app.WindowConfiguration.WindowingMode;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.VectorDrawable;
import android.os.Handler;
import android.util.Size;
import android.view.Choreographer;
import android.view.SurfaceControl;
import android.view.View;
@@ -222,7 +228,6 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
                    mHandler,
                    mChoreographer,
                    mDisplay.getDisplayId(),
                    0 /* taskCornerRadius */,
                    mDecorationContainerSurface,
                    mDragPositioningCallback,
                    mSurfaceControlBuilderSupplier,
@@ -234,12 +239,10 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
                .getScaledTouchSlop();
        mDragDetector.setTouchSlop(touchSlop);

        final int resize_handle = mResult.mRootView.getResources()
                .getDimensionPixelSize(R.dimen.freeform_resize_handle);
        final int resize_corner = mResult.mRootView.getResources()
                .getDimensionPixelSize(R.dimen.freeform_resize_corner);
        mDragResizeListener.setGeometry(
                mResult.mWidth, mResult.mHeight, resize_handle, resize_corner, touchSlop);
        final Resources res = mResult.mRootView.getResources();
        mDragResizeListener.setGeometry(new DragResizeWindowGeometry(0 /* taskCornerRadius */,
                new Size(mResult.mWidth, mResult.mHeight), getResizeEdgeHandleSize(res),
                getFineResizeCornerSize(res), getLargeResizeCornerSize(res)), touchSlop);
    }

    /**
+9 −8
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@ import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;

import static com.android.launcher3.icons.BaseIconFactory.MODE_DEFAULT;
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getFineResizeCornerSize;
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getLargeResizeCornerSize;
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getResizeEdgeHandleSize;

import android.annotation.NonNull;
import android.app.ActivityManager;
@@ -42,6 +45,7 @@ import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.util.Size;
import android.view.Choreographer;
import android.view.MotionEvent;
import android.view.SurfaceControl;
@@ -276,7 +280,6 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                    mHandler,
                    mChoreographer,
                    mDisplay.getDisplayId(),
                    mRelayoutParams.mCornerRadius,
                    mDecorationContainerSurface,
                    mDragPositioningCallback,
                    mSurfaceControlBuilderSupplier,
@@ -288,15 +291,13 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                .getScaledTouchSlop();
        mDragDetector.setTouchSlop(touchSlop);

        final int resize_handle = mResult.mRootView.getResources()
                .getDimensionPixelSize(R.dimen.freeform_resize_handle);
        final int resize_corner = mResult.mRootView.getResources()
                .getDimensionPixelSize(R.dimen.freeform_resize_corner);

        // If either task geometry or position have changed, update this task's
        // exclusion region listener
        final Resources res = mResult.mRootView.getResources();
        if (mDragResizeListener.setGeometry(
                mResult.mWidth, mResult.mHeight, resize_handle, resize_corner, touchSlop)
                new DragResizeWindowGeometry(mRelayoutParams.mCornerRadius,
                        new Size(mResult.mWidth, mResult.mHeight), getResizeEdgeHandleSize(res),
                        getFineResizeCornerSize(res), getLargeResizeCornerSize(res)), touchSlop)
                || !mTaskInfo.positionInParent.equals(mPositionInParent)) {
            updateExclusionRegion();
        }
@@ -427,7 +428,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        return mHandleMenu != null;
    }

    boolean shouldResizeListenerHandleEvent(MotionEvent e, Point offset) {
    boolean shouldResizeListenerHandleEvent(@NonNull MotionEvent e, @NonNull Point offset) {
        return mDragResizeListener != null && mDragResizeListener.shouldHandleEvent(e, offset);
    }

+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@ import android.graphics.Rect;
 * Callback called when receiving drag-resize or drag-move related input events.
 */
public interface DragPositioningCallback {
    /**
     * Indicates the direction of resizing. May be combined together to indicate a diagonal drag.
     */
    @IntDef(flag = true, value = {
            CTRL_TYPE_UNDEFINED, CTRL_TYPE_LEFT, CTRL_TYPE_RIGHT, CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM
    })
+113 −255

File changed.

Preview size limit exceeded, changes collapsed.

Loading