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

Commit f9328198 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Rotate touch events for land/seascape navbars

Previous change removed checking for navbar
location to transpose touch event.

fixes: 150700927
Test: Quickstep TAPL test passes.
Change-Id: I47683f8a75f24c8bfc46437e0eef9172c23cc452
parent 475d1607
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.model.PagedViewOrientedState;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.touch.PagedOrientationHandler;
@@ -146,8 +147,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
        VibratorWrapper.INSTANCE.get(mContext).vibrate(OVERVIEW_HAPTIC);
    }

    public Consumer<MotionEvent> getRecentsViewDispatcher() {
        return mRecentsView != null ? mRecentsView.getEventDispatcher() : null;
    public Consumer<MotionEvent> getRecentsViewDispatcher(RotationMode navBarRotationMode) {
        return mRecentsView != null ? mRecentsView.getEventDispatcher(navBarRotationMode) : null;
    }

    @UiThread
+2 −1
Original line number Diff line number Diff line
@@ -176,7 +176,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
        // Proxy events to recents view
        if (mPassedWindowMoveSlop && mInteractionHandler != null
                && !mRecentsViewDispatcher.hasConsumer()) {
            mRecentsViewDispatcher.setConsumer(mInteractionHandler.getRecentsViewDispatcher());
            mRecentsViewDispatcher.setConsumer(mInteractionHandler
                .getRecentsViewDispatcher(mNavBarPosition.getRotationMode()));
        }
        int edgeFlags = ev.getEdgeFlags();
        ev.setEdgeFlags(edgeFlags | EDGE_NAV_BAR);
+8 −2
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import com.android.launcher3.anim.SpringObjectAnimator;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -1946,8 +1947,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        return offsetX;
    }

    public Consumer<MotionEvent> getEventDispatcher() {
        int degreesRotated = RotationHelper.getDegreesFromRotation(mLayoutRotation);
    public Consumer<MotionEvent> getEventDispatcher(RotationMode navBarRotationMode) {
        float degreesRotated;
        if (navBarRotationMode == RotationMode.NORMAL) {
            degreesRotated = RotationHelper.getDegreesFromRotation(mLayoutRotation);
        } else {
            degreesRotated = -navBarRotationMode.surfaceRotation;
        }
        if (degreesRotated == 0) {
            return super::onTouchEvent;
        }
+1 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.launcher3.states;

import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LOCKED;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.util.DisplayMetrics.DENSITY_DEVICE_STABLE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
@@ -277,7 +276,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
     * Creates a matrix to transform the given motion event specified by degrees.
     * If {@param inverse} is {@code true}, the inverse of that matrix will be applied
     */
    public static void transformEvent(int degrees, MotionEvent ev, boolean inverse) {
    public static void transformEvent(float degrees, MotionEvent ev, boolean inverse) {
        Matrix transform = new Matrix();
        transform.setRotate(degrees);
        if (inverse) {