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

Commit 1aa4bec5 authored by Michael Wright's avatar Michael Wright Committed by Android Git Automerger
Browse files

am 4361e1f4: Remove assist swipe from TOUCH_NAVIGATION devices

* commit '4361e1f4':
  Remove assist swipe from TOUCH_NAVIGATION devices
parents 25f6f4f5 4361e1f4
Loading
Loading
Loading
Loading
+0 −51
Original line number Diff line number Diff line
@@ -2701,12 +2701,6 @@ void TouchInputMapper::dump(String8& dump) {
                mPointerYZoomScale);
        dump.appendFormat(INDENT4 "MaxSwipeWidth: %f\n",
                mPointerGestureMaxSwipeWidth);
    } else if (mDeviceMode == DEVICE_MODE_NAVIGATION) {
        dump.appendFormat(INDENT3 "Navigation Gesture Detector:\n");
        dump.appendFormat(INDENT4 "AssistStartY: %0.3f\n",
                mNavigationAssistStartY);
        dump.appendFormat(INDENT4 "AssistEndY: %0.3f\n",
                mNavigationAssistEndY);
    }
}

@@ -3278,10 +3272,6 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) {

            // Abort current pointer usages because the state has changed.
            abortPointerUsage(when, 0 /*policyFlags*/);
        } else if (mDeviceMode == DEVICE_MODE_NAVIGATION) {
            // Compute navigation parameters.
            mNavigationAssistStartY = mSurfaceHeight * 0.9f;
            mNavigationAssistEndY = mSurfaceHeight * 0.5f;
        }

        // Inform the dispatcher about the changes.
@@ -3621,7 +3611,6 @@ void TouchInputMapper::reset(nsecs_t when) {

    mPointerGesture.reset();
    mPointerSimple.reset();
    mNavigation.reset();

    if (mPointerController != NULL) {
        mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
@@ -3772,8 +3761,6 @@ void TouchInputMapper::sync(nsecs_t when) {
                mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords,
                        mCurrentCookedPointerData.idToIndex,
                        mCurrentCookedPointerData.touchingIdBits);
            } else if (mDeviceMode == DEVICE_MODE_NAVIGATION) {
                dispatchNavigationAssist(when, policyFlags);
            }

            dispatchHoverExit(when, policyFlags);
@@ -5495,44 +5482,6 @@ void TouchInputMapper::abortPointerSimple(nsecs_t when, uint32_t policyFlags) {
    dispatchPointerSimple(when, policyFlags, false, false);
}

void TouchInputMapper::dispatchNavigationAssist(nsecs_t when, uint32_t policyFlags) {
    if (mCurrentCookedPointerData.touchingIdBits.count() == 1) {
        if (mLastCookedPointerData.touchingIdBits.isEmpty()) {
            // First pointer down.
            uint32_t id = mCurrentCookedPointerData.touchingIdBits.firstMarkedBit();
            const PointerCoords& coords = mCurrentCookedPointerData.pointerCoordsForId(id);
            if (coords.getY() >= mNavigationAssistStartY) {
                // Start tracking the possible assist swipe.
                mNavigation.activeAssistId = id;
                return;
            }
        } else if (mNavigation.activeAssistId >= 0
                && mCurrentCookedPointerData.touchingIdBits.hasBit(mNavigation.activeAssistId)) {
            const PointerCoords& coords = mCurrentCookedPointerData.pointerCoordsForId(
                    mNavigation.activeAssistId);
            if (coords.getY() > mNavigationAssistEndY) {
                // Swipe is still in progress.
                return;
            }

            // Detected assist swipe.
            int32_t metaState = mContext->getGlobalMetaState();
            NotifyKeyArgs downArgs(when, getDeviceId(), AINPUT_SOURCE_KEYBOARD,
                    policyFlags | POLICY_FLAG_VIRTUAL,
                    AKEY_EVENT_ACTION_DOWN, 0, AKEYCODE_ASSIST, 0, metaState, when);
            getListener()->notifyKey(&downArgs);

            NotifyKeyArgs upArgs(when, getDeviceId(), AINPUT_SOURCE_KEYBOARD,
                    policyFlags | POLICY_FLAG_VIRTUAL,
                    AKEY_EVENT_ACTION_UP, 0, AKEYCODE_ASSIST, 0, metaState, when);
            getListener()->notifyKey(&upArgs);
        }
    }

    // Cancel the assist swipe.
    mNavigation.activeAssistId = -1;
}

void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,
        int32_t action, int32_t flags, int32_t metaState, int32_t buttonState, int32_t edgeFlags,
        const PointerProperties* properties, const PointerCoords* coords,
+0 −15
Original line number Diff line number Diff line
@@ -1437,10 +1437,6 @@ private:
    // The maximum swipe width.
    float mPointerGestureMaxSwipeWidth;

    // The start and end Y thresholds for invoking the assist navigation swipe.
    float mNavigationAssistStartY;
    float mNavigationAssistEndY;

    struct PointerDistanceHeapElement {
        uint32_t currentPointerIndex : 8;
        uint32_t lastPointerIndex : 8;
@@ -1615,15 +1611,6 @@ private:
        }
    } mPointerSimple;

    struct Navigation {
        // The id of a pointer that is tracking a possible assist swipe.
        int32_t activeAssistId; // -1 if none

        void reset() {
            activeAssistId = -1;
        }
    } mNavigation;

    // The pointer and scroll velocity controls.
    VelocityControl mPointerVelocityControl;
    VelocityControl mWheelXVelocityControl;
@@ -1659,8 +1646,6 @@ private:
            bool down, bool hovering);
    void abortPointerSimple(nsecs_t when, uint32_t policyFlags);

    void dispatchNavigationAssist(nsecs_t when, uint32_t policyFlags);

    // Dispatches a motion event.
    // If the changedId is >= 0 and the action is POINTER_DOWN or POINTER_UP, the
    // method will take care of setting the index and transmuting the action to DOWN or UP