diff options
| author | 2018-12-28 18:17:15 -0800 | |
|---|---|---|
| committer | 2019-01-10 15:32:04 -0800 | |
| commit | 49e59220d127929ae73cfe81d81683bcad3dcb30 (patch) | |
| tree | 6af6708ebece876326a9f9b7f765602af1a11c0e /libs/input/Input.cpp | |
| parent | bcb4be70fab707a300c1a83920805e984fcb49b8 (diff) | |
Add classification to MotionEvent
The classification will be used to categorize the
current motion event stream. The classification may change from ambiguous to deep press,
for example.
Test: integration tested by printing to logcat whenever CLASSIFICATION_DEEP_PRESS
is present.
Test: atest libinput_tests inputflinger_tests
Bug: 62940136
Change-Id: I2d93583bab42162e1fd1e95ebf624ef3ab9a58ec
Diffstat (limited to 'libs/input/Input.cpp')
| -rw-r--r-- | libs/input/Input.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index a558970b58..db86c8ea30 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -234,6 +234,7 @@ void MotionEvent::initialize( int32_t edgeFlags, int32_t metaState, int32_t buttonState, + MotionClassification classification, float xOffset, float yOffset, float xPrecision, @@ -250,6 +251,7 @@ void MotionEvent::initialize( mEdgeFlags = edgeFlags; mMetaState = metaState; mButtonState = buttonState; + mClassification = classification; mXOffset = xOffset; mYOffset = yOffset; mXPrecision = xPrecision; @@ -270,6 +272,7 @@ void MotionEvent::copyFrom(const MotionEvent* other, bool keepHistory) { mEdgeFlags = other->mEdgeFlags; mMetaState = other->mMetaState; mButtonState = other->mButtonState; + mClassification = other->mClassification; mXOffset = other->mXOffset; mYOffset = other->mYOffset; mXPrecision = other->mXPrecision; @@ -451,6 +454,7 @@ status_t MotionEvent::readFromParcel(Parcel* parcel) { mEdgeFlags = parcel->readInt32(); mMetaState = parcel->readInt32(); mButtonState = parcel->readInt32(); + mClassification = static_cast<MotionClassification>(parcel->readByte()); mXOffset = parcel->readFloat(); mYOffset = parcel->readFloat(); mXPrecision = parcel->readFloat(); @@ -501,6 +505,7 @@ status_t MotionEvent::writeToParcel(Parcel* parcel) const { parcel->writeInt32(mEdgeFlags); parcel->writeInt32(mMetaState); parcel->writeInt32(mButtonState); + parcel->writeByte(static_cast<int8_t>(mClassification)); parcel->writeFloat(mXOffset); parcel->writeFloat(mYOffset); parcel->writeFloat(mXPrecision); |