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

Commit 81843932 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Improve input device wake heuristics. Bug: 5205674"

parents 4694b7f1 c28306ad
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -2188,6 +2188,7 @@ void CursorInputMapper::sync(nsecs_t when) {
    }
    }
    nsecs_t downTime = mDownTime;
    nsecs_t downTime = mDownTime;
    bool buttonsChanged = currentButtonState != lastButtonState;
    bool buttonsChanged = currentButtonState != lastButtonState;
    bool buttonsPressed = currentButtonState & ~lastButtonState;


    float deltaX = mCursorMotionAccumulator.getRelativeX() * mXScale;
    float deltaX = mCursorMotionAccumulator.getRelativeX() * mXScale;
    float deltaY = mCursorMotionAccumulator.getRelativeY() * mYScale;
    float deltaY = mCursorMotionAccumulator.getRelativeY() * mYScale;
@@ -2249,7 +2250,7 @@ void CursorInputMapper::sync(nsecs_t when) {
    // the device in your pocket.
    // the device in your pocket.
    // TODO: Use the input device configuration to control this behavior more finely.
    // TODO: Use the input device configuration to control this behavior more finely.
    uint32_t policyFlags = 0;
    uint32_t policyFlags = 0;
    if (getDevice()->isExternal()) {
    if ((buttonsPressed || moved || scrolled) && getDevice()->isExternal()) {
        policyFlags |= POLICY_FLAG_WAKE_DROPPED;
        policyFlags |= POLICY_FLAG_WAKE_DROPPED;
    }
    }


@@ -3345,9 +3346,12 @@ void TouchInputMapper::sync(nsecs_t when) {


        // Handle policy on initial down or hover events.
        // Handle policy on initial down or hover events.
        uint32_t policyFlags = 0;
        uint32_t policyFlags = 0;
        if (mLastRawPointerData.pointerCount == 0 && mCurrentRawPointerData.pointerCount != 0) {
        bool initialDown = mLastRawPointerData.pointerCount == 0
            if (mDeviceMode == DEVICE_MODE_DIRECT) {
                && mCurrentRawPointerData.pointerCount != 0;
        bool buttonsPressed = mCurrentButtonState & ~mLastButtonState;
        if (initialDown || buttonsPressed) {
            // If this is a touch screen, hide the pointer on an initial down.
            // If this is a touch screen, hide the pointer on an initial down.
            if (mDeviceMode == DEVICE_MODE_DIRECT) {
                getContext()->fadePointer();
                getContext()->fadePointer();
            }
            }