diff options
author | Michael Wright <michaelwr@google.com> | 2015-05-13 16:56:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-13 16:56:07 +0000 |
commit | 4866f087181af02e870b2d2fc1d4be8d38c2f36e (patch) | |
tree | ddd438580bb7706dd2ab7685abdcfb66ad109913 /services | |
parent | 4eed0f8f8dd3673e55a93c0b62b8b9ebefa135cf (diff) | |
parent | 53dca3aadda499824d3d0b2bbc25a72fc1a37877 (diff) | |
download | frameworks_native-4866f087181af02e870b2d2fc1d4be8d38c2f36e.zip frameworks_native-4866f087181af02e870b2d2fc1d4be8d38c2f36e.tar.gz frameworks_native-4866f087181af02e870b2d2fc1d4be8d38c2f36e.tar.bz2 |
Merge "Use previous pressure value if the current fusion data is zero." into mnc-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/inputflinger/InputReader.cpp | 18 | ||||
-rw-r--r-- | services/inputflinger/InputReader.h | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp index c6389a9..2888785 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; } diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h index aadc37f..ae090c1 100644 --- a/services/inputflinger/InputReader.h +++ b/services/inputflinger/InputReader.h @@ -881,11 +881,11 @@ struct CookedPointerData { return pointerProperties[idToIndex[id]]; } - inline bool isHovering(uint32_t pointerIndex) { + inline bool isHovering(uint32_t pointerIndex) const { return hoveringIdBits.hasBit(pointerProperties[pointerIndex].id); } - inline bool isTouching(uint32_t pointerIndex) { + inline bool isTouching(uint32_t pointerIndex) const { return touchingIdBits.hasBit(pointerProperties[pointerIndex].id); } }; |