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

Commit 08a4e68b authored by Jagrut Desai's avatar Jagrut Desai Committed by Android (Google) Code Review
Browse files

Merge "Handle SystemGestureRegion in TaskbarDragLayer" into main

parents de66327e c8a5176b
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -146,6 +146,15 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
        onDestroy(true);
        onDestroy(true);
    }
    }


    @Override
    protected boolean isEventWithinSystemGestureRegion(MotionEvent ev) {
        final float x = ev.getX();
        final float y = ev.getY();

        return x >= mSystemGestureRegion.left && x < getWidth() - mSystemGestureRegion.right
                && y >= mSystemGestureRegion.top;
    }

    @Override
    @Override
    protected boolean canFindActiveController() {
    protected boolean canFindActiveController() {
        // Unlike super class, we want to be able to find controllers when touches occur in the
        // Unlike super class, we want to be able to find controllers when touches occur in the
+5 −4
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
    protected final Rect mHitRect = new Rect();
    protected final Rect mHitRect = new Rect();


    @ViewDebug.ExportedProperty(category = "launcher")
    @ViewDebug.ExportedProperty(category = "launcher")
    private final RectF mSystemGestureRegion = new RectF();
    protected final RectF mSystemGestureRegion = new RectF();
    private int mTouchDispatchState = 0;
    private int mTouchDispatchState = 0;


    protected final T mActivity;
    protected final T mActivity;
@@ -164,7 +164,7 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
        return findActiveController(ev);
        return findActiveController(ev);
    }
    }


    private boolean isEventInLauncher(MotionEvent ev) {
    protected boolean isEventWithinSystemGestureRegion(MotionEvent ev) {
        final float x = ev.getX();
        final float x = ev.getX();
        final float y = ev.getY();
        final float y = ev.getY();


@@ -175,7 +175,8 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
    private TouchController findControllerToHandleTouch(MotionEvent ev) {
    private TouchController findControllerToHandleTouch(MotionEvent ev) {
        AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
        AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
        if (topView != null
        if (topView != null
                && (isEventInLauncher(ev) || topView.canInterceptEventsInSystemGestureRegion())
                && (isEventWithinSystemGestureRegion(ev)
                || topView.canInterceptEventsInSystemGestureRegion())
                && topView.onControllerInterceptTouchEvent(ev)) {
                && topView.onControllerInterceptTouchEvent(ev)) {
            return topView;
            return topView;
        }
        }
@@ -287,7 +288,7 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
                mTouchDispatchState |= TOUCH_DISPATCHING_FROM_VIEW
                mTouchDispatchState |= TOUCH_DISPATCHING_FROM_VIEW
                        | TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS;
                        | TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS;


                if (isEventInLauncher(ev)) {
                if (isEventWithinSystemGestureRegion(ev)) {
                    mTouchDispatchState &= ~TOUCH_DISPATCHING_FROM_VIEW_GESTURE_REGION;
                    mTouchDispatchState &= ~TOUCH_DISPATCHING_FROM_VIEW_GESTURE_REGION;
                } else {
                } else {
                    mTouchDispatchState |= TOUCH_DISPATCHING_FROM_VIEW_GESTURE_REGION;
                    mTouchDispatchState |= TOUCH_DISPATCHING_FROM_VIEW_GESTURE_REGION;