diff options
author | Michael Wright <michaelwr@google.com> | 2015-05-13 17:15:46 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-13 17:15:46 +0000 |
commit | 9e4009334673d68716291e97a1defc30657c4a99 (patch) | |
tree | 6e3a9b7a79f83074dc848adae027a64182dbfd5c /services/inputflinger/InputReader.cpp | |
parent | eab5a1ed7c6262992b4abe7fb9abe752b1932087 (diff) | |
parent | 4866f087181af02e870b2d2fc1d4be8d38c2f36e (diff) | |
download | frameworks_native-9e4009334673d68716291e97a1defc30657c4a99.zip frameworks_native-9e4009334673d68716291e97a1defc30657c4a99.tar.gz frameworks_native-9e4009334673d68716291e97a1defc30657c4a99.tar.bz2 |
am 4866f087: Merge "Use previous pressure value if the current fusion data is zero." into mnc-dev
* commit '4866f087181af02e870b2d2fc1d4be8d38c2f36e':
Use previous pressure value if the current fusion data is zero.
Diffstat (limited to 'services/inputflinger/InputReader.cpp')
-rw-r--r-- | services/inputflinger/InputReader.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp index ef0cd2d..b317cb6 100644 --- a/services/inputflinger/InputReader.cpp +++ b/services/inputflinger/InputReader.cpp @@ -4076,14 +4076,20 @@ void TouchInputMapper::applyExternalStylusButtonState(nsecs_t when) { } void TouchInputMapper::applyExternalStylusTouchState(nsecs_t when) { - CookedPointerData& cpd = mCurrentCookedState.cookedPointerData; - if (mExternalStylusId != -1 && cpd.isTouching(mExternalStylusId)) { - if (mExternalStylusState.pressure != 0.0f) { - PointerCoords& coords = cpd.editPointerCoordsWithId(mExternalStylusId); - coords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, mExternalStylusState.pressure); + CookedPointerData& currentPointerData = mCurrentCookedState.cookedPointerData; + const CookedPointerData& lastPointerData = mLastCookedState.cookedPointerData; + + if (mExternalStylusId != -1 && currentPointerData.isTouching(mExternalStylusId)) { + float pressure = mExternalStylusState.pressure; + if (pressure == 0.0f && lastPointerData.isTouching(mExternalStylusId)) { + const PointerCoords& coords = lastPointerData.pointerCoordsForId(mExternalStylusId); + pressure = coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE); } + PointerCoords& coords = currentPointerData.editPointerCoordsWithId(mExternalStylusId); + coords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure); - PointerProperties& properties = cpd.editPointerPropertiesWithId(mExternalStylusId); + PointerProperties& properties = + currentPointerData.editPointerPropertiesWithId(mExternalStylusId); if (mExternalStylusState.toolType != AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { properties.toolType = mExternalStylusState.toolType; } |