diff options
author | Prabir Pradhan <prabirmsp@google.com> | 2022-02-24 09:08:54 -0800 |
---|---|---|
committer | Prabir Pradhan <prabirmsp@google.com> | 2022-02-28 21:45:39 +0000 |
commit | 8e6ce224398316a809ac21ba661ba2c4ed9704c7 (patch) | |
tree | 26607d8b071eb84e74500b86c93ab7b82010e026 /include/input | |
parent | e73b8065221ff4afb123615646cb2a842906367c (diff) | |
download | native-8e6ce224398316a809ac21ba661ba2c4ed9704c7.tar.gz |
Fix input injection with zero coords
In the native MotionEvent class, setting an axis value to 0 is
equivalent to removing the axis from the bitfield of valid axes. This is
because getting an axis value that is not set in the bitfield will
return 0 by default.
This means that we cannot rely on the bitfield of valid axes to know
exactly which axes are valid, since all axes are always valid with a
default value of 0.
Rather than transforming only the axies that are set in the bitfield, we
add a helper function to MotionEvent to transform the entire
PointerCoords.
Bug: 219711163
Test: manual, see bug: adb shell input draganddrop 665 531 0 531 1000
Change-Id: I335beebf8263a38f180f2f4c6a788fbd69d15a6f
Merged-In: I335beebf8263a38f180f2f4c6a788fbd69d15a6f
(cherry picked from commit 890532e49c0e329c0c462fb2733c5ae27a395b7b)
Diffstat (limited to 'include/input')
-rw-r--r-- | include/input/Input.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/input/Input.h b/include/input/Input.h index 2837add22c..b23a9518f7 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -814,6 +814,8 @@ public: static vec2 calculateTransformedXY(uint32_t source, const ui::Transform&, const vec2& xy); static float calculateTransformedAxisValue(int32_t axis, uint32_t source, const ui::Transform&, const PointerCoords&); + static PointerCoords calculateTransformedCoords(uint32_t source, const ui::Transform&, + const PointerCoords&); protected: int32_t mAction; |