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

Commit 5bb6cfd7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topics "pc-enum", "pointer_controller" am: 87099b04

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1356005

Change-Id: Ic488bb0dff329b12afe882371be98406add26f6e
parents 086a996b 87099b04
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -59,11 +59,11 @@ public:
    /* Gets the absolute location of the pointer. */
    virtual void getPosition(float* outX, float* outY) const = 0;

    enum Transition {
    enum class Transition {
        // Fade/unfade immediately.
        TRANSITION_IMMEDIATE,
        IMMEDIATE,
        // Fade/unfade gradually.
        TRANSITION_GRADUAL,
        GRADUAL,
    };

    /* Fades the pointer out now. */
@@ -75,11 +75,11 @@ public:
     * wants to ensure that the pointer becomes visible again. */
    virtual void unfade(Transition transition) = 0;

    enum Presentation {
    enum class Presentation {
        // Show the mouse pointer.
        PRESENTATION_POINTER,
        POINTER,
        // Show spots and a spot anchor in place of the mouse pointer.
        PRESENTATION_SPOT,
        SPOT,
    };

    /* Sets the mode of the pointer controller. */
+5 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include "CursorButtonAccumulator.h"
#include "CursorScrollAccumulator.h"
#include "PointerControllerInterface.h"
#include "TouchCursorInputMapperCommon.h"

namespace android {
@@ -153,7 +154,7 @@ void CursorInputMapper::configure(nsecs_t when, const InputReaderConfiguration*
                mParameters.mode = Parameters::MODE_POINTER_RELATIVE;
                mSource = AINPUT_SOURCE_MOUSE_RELATIVE;
                // Keep PointerController around in order to preserve the pointer position.
                mPointerController->fade(PointerControllerInterface::TRANSITION_IMMEDIATE);
                mPointerController->fade(PointerControllerInterface::Transition::IMMEDIATE);
            } else {
                ALOGE("Cannot request pointer capture, device is not in MODE_POINTER");
            }
@@ -335,7 +336,7 @@ void CursorInputMapper::sync(nsecs_t when) {
    int32_t displayId;
    if (mSource == AINPUT_SOURCE_MOUSE) {
        if (moved || scrolled || buttonsChanged) {
            mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);
            mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);

            if (moved) {
                mPointerController->move(deltaX, deltaY);
@@ -345,7 +346,7 @@ void CursorInputMapper::sync(nsecs_t when) {
                mPointerController->setButtonState(currentButtonState);
            }

            mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
            mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
        }

        float x, y;
@@ -480,7 +481,7 @@ int32_t CursorInputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCod

void CursorInputMapper::fadePointer() {
    if (mPointerController != nullptr) {
        mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
        mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
    }
}

+14 −14
Original line number Diff line number Diff line
@@ -1394,7 +1394,7 @@ void TouchInputMapper::reset(nsecs_t when) {
    resetExternalStylus();

    if (mPointerController != nullptr) {
        mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
        mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
        mPointerController->clearSpots();
    }

@@ -1614,8 +1614,8 @@ void TouchInputMapper::cookAndDispatch(nsecs_t when) {
    } else {
        if (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches &&
            mPointerController != nullptr) {
            mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT);
            mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
            mPointerController->setPresentation(PointerControllerInterface::Presentation::SPOT);
            mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);

            mPointerController->setButtonState(mCurrentRawState.buttonState);
            mPointerController->setSpots(mCurrentCookedState.cookedPointerData.pointerCoords,
@@ -2366,7 +2366,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag

    // Update the pointer presentation and spots.
    if (mParameters.gestureMode == Parameters::GESTURE_MODE_MULTI_TOUCH) {
        mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);
        mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);
        if (finishPreviousGesture || cancelPreviousGesture) {
            mPointerController->clearSpots();
        }
@@ -2378,7 +2378,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag
                                         mPointerController->getDisplayId());
        }
    } else {
        mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);
        mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);
    }

    // Show or hide the pointer if needed.
@@ -2388,7 +2388,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag
            if (mParameters.gestureMode == Parameters::GESTURE_MODE_MULTI_TOUCH &&
                mPointerGesture.lastGestureMode == PointerGesture::FREEFORM) {
                // Remind the user of where the pointer is after finishing a gesture with spots.
                mPointerController->unfade(PointerControllerInterface::TRANSITION_GRADUAL);
                mPointerController->unfade(PointerControllerInterface::Transition::GRADUAL);
            }
            break;
        case PointerGesture::TAP:
@@ -2399,15 +2399,15 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag
        case PointerGesture::SWIPE:
            // Unfade the pointer when the current gesture manipulates the
            // area directly under the pointer.
            mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
            mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
            break;
        case PointerGesture::FREEFORM:
            // Fade the pointer when the current gesture manipulates a different
            // area and there are spots to guide the user experience.
            if (mParameters.gestureMode == Parameters::GESTURE_MODE_MULTI_TOUCH) {
                mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
                mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
            } else {
                mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
                mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
            }
            break;
    }
@@ -2578,7 +2578,7 @@ void TouchInputMapper::abortPointerGestures(nsecs_t when, uint32_t policyFlags)

    // Remove any current spots.
    if (mPointerController != nullptr) {
        mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
        mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
        mPointerController->clearSpots();
    }
}
@@ -3438,12 +3438,12 @@ void TouchInputMapper::dispatchPointerSimple(nsecs_t when, uint32_t policyFlags,

    if (mPointerController != nullptr) {
        if (down || hovering) {
            mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);
            mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER);
            mPointerController->clearSpots();
            mPointerController->setButtonState(mCurrentRawState.buttonState);
            mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
            mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
        } else if (!down && !hovering && (mPointerSimple.down || mPointerSimple.hovering)) {
            mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
            mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
        }
        displayId = mPointerController->getDisplayId();
    }
@@ -3652,7 +3652,7 @@ bool TouchInputMapper::updateMovedPointers(const PointerProperties* inProperties

void TouchInputMapper::fadePointer() {
    if (mPointerController != nullptr) {
        mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
        mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
    }
}