Merge "Cancel touches as well as pointer gestures." into mnc-dev
This commit is contained in:
commit
fd54957888
@ -3860,6 +3860,7 @@ void TouchInputMapper::reset(nsecs_t when) {
|
|||||||
mPointerUsage = POINTER_USAGE_NONE;
|
mPointerUsage = POINTER_USAGE_NONE;
|
||||||
mSentHoverEnter = false;
|
mSentHoverEnter = false;
|
||||||
mHavePointerIds = false;
|
mHavePointerIds = false;
|
||||||
|
mCurrentMotionAborted = false;
|
||||||
mDownTime = 0;
|
mDownTime = 0;
|
||||||
|
|
||||||
mCurrentVirtualKey.down = false;
|
mCurrentVirtualKey.down = false;
|
||||||
@ -4087,6 +4088,7 @@ void TouchInputMapper::cookAndDispatch(nsecs_t when) {
|
|||||||
mCurrentCookedState.cookedPointerData.touchingIdBits);
|
mCurrentCookedState.cookedPointerData.touchingIdBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mCurrentMotionAborted) {
|
||||||
dispatchButtonRelease(when, policyFlags);
|
dispatchButtonRelease(when, policyFlags);
|
||||||
dispatchHoverExit(when, policyFlags);
|
dispatchHoverExit(when, policyFlags);
|
||||||
dispatchTouches(when, policyFlags);
|
dispatchTouches(when, policyFlags);
|
||||||
@ -4094,6 +4096,11 @@ void TouchInputMapper::cookAndDispatch(nsecs_t when) {
|
|||||||
dispatchButtonPress(when, policyFlags);
|
dispatchButtonPress(when, policyFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mCurrentCookedState.cookedPointerData.pointerCount == 0) {
|
||||||
|
mCurrentMotionAborted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Synthesize key up from raw buttons if needed.
|
// Synthesize key up from raw buttons if needed.
|
||||||
synthesizeButtonKeys(getContext(), AKEY_EVENT_ACTION_UP, when, getDeviceId(), mSource,
|
synthesizeButtonKeys(getContext(), AKEY_EVENT_ACTION_UP, when, getDeviceId(), mSource,
|
||||||
policyFlags, mLastCookedState.buttonState, mCurrentCookedState.buttonState);
|
policyFlags, mLastCookedState.buttonState, mCurrentCookedState.buttonState);
|
||||||
@ -4316,6 +4323,22 @@ void TouchInputMapper::dispatchVirtualKey(nsecs_t when, uint32_t policyFlags,
|
|||||||
getListener()->notifyKey(&args);
|
getListener()->notifyKey(&args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TouchInputMapper::abortTouches(nsecs_t when, uint32_t policyFlags) {
|
||||||
|
BitSet32 currentIdBits = mCurrentCookedState.cookedPointerData.touchingIdBits;
|
||||||
|
if (!currentIdBits.isEmpty()) {
|
||||||
|
int32_t metaState = getContext()->getGlobalMetaState();
|
||||||
|
int32_t buttonState = mCurrentCookedState.buttonState;
|
||||||
|
dispatchMotion(when, policyFlags, mSource, AMOTION_EVENT_ACTION_CANCEL, 0, 0,
|
||||||
|
metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,
|
||||||
|
mCurrentCookedState.cookedPointerData.pointerProperties,
|
||||||
|
mCurrentCookedState.cookedPointerData.pointerCoords,
|
||||||
|
mCurrentCookedState.cookedPointerData.idToIndex,
|
||||||
|
currentIdBits, -1,
|
||||||
|
mOrientedXPrecision, mOrientedYPrecision, mDownTime);
|
||||||
|
mCurrentMotionAborted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TouchInputMapper::dispatchTouches(nsecs_t when, uint32_t policyFlags) {
|
void TouchInputMapper::dispatchTouches(nsecs_t when, uint32_t policyFlags) {
|
||||||
BitSet32 currentIdBits = mCurrentCookedState.cookedPointerData.touchingIdBits;
|
BitSet32 currentIdBits = mCurrentCookedState.cookedPointerData.touchingIdBits;
|
||||||
BitSet32 lastIdBits = mLastCookedState.cookedPointerData.touchingIdBits;
|
BitSet32 lastIdBits = mLastCookedState.cookedPointerData.touchingIdBits;
|
||||||
@ -6089,6 +6112,7 @@ void TouchInputMapper::fadePointer() {
|
|||||||
|
|
||||||
void TouchInputMapper::cancelTouch(nsecs_t when) {
|
void TouchInputMapper::cancelTouch(nsecs_t when) {
|
||||||
abortPointerUsage(when, 0 /*policyFlags*/);
|
abortPointerUsage(when, 0 /*policyFlags*/);
|
||||||
|
abortTouches(when, 0 /* policyFlags*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchInputMapper::isPointInsideSurface(int32_t x, int32_t y) {
|
bool TouchInputMapper::isPointInsideSurface(int32_t x, int32_t y) {
|
||||||
|
@ -1469,6 +1469,9 @@ protected:
|
|||||||
// Have we assigned pointer IDs for this stream
|
// Have we assigned pointer IDs for this stream
|
||||||
bool mHavePointerIds;
|
bool mHavePointerIds;
|
||||||
|
|
||||||
|
// Is the current stream of direct touch events aborted
|
||||||
|
bool mCurrentMotionAborted;
|
||||||
|
|
||||||
// The time the primary pointer last went down.
|
// The time the primary pointer last went down.
|
||||||
nsecs_t mDownTime;
|
nsecs_t mDownTime;
|
||||||
|
|
||||||
@ -1802,6 +1805,7 @@ private:
|
|||||||
void dispatchButtonPress(nsecs_t when, uint32_t policyFlags);
|
void dispatchButtonPress(nsecs_t when, uint32_t policyFlags);
|
||||||
const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData);
|
const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData);
|
||||||
void cookPointerData();
|
void cookPointerData();
|
||||||
|
void abortTouches(nsecs_t when, uint32_t policyFlags);
|
||||||
|
|
||||||
void dispatchPointerUsage(nsecs_t when, uint32_t policyFlags, PointerUsage pointerUsage);
|
void dispatchPointerUsage(nsecs_t when, uint32_t policyFlags, PointerUsage pointerUsage);
|
||||||
void abortPointerUsage(nsecs_t when, uint32_t policyFlags);
|
void abortPointerUsage(nsecs_t when, uint32_t policyFlags);
|
||||||
|
Loading…
Reference in New Issue
Block a user