diff options
| author | 2021-08-12 12:03:37 -0700 | |
|---|---|---|
| committer | 2021-08-12 22:41:41 +0000 | |
| commit | 2e1a9d88a58fac889f13b18a9e6c181a8459feab (patch) | |
| tree | f9ac849149b67c3a82bb1b881f6af42f7fe7fd4f /libs/input/Input.cpp | |
| parent | a8f9cdbc77fee0bd5a1527342af4e2ceb9487b50 (diff) | |
| parent | 810d19378edc7bbd87d738d96c4bb49ed45b3d0c (diff) | |
Merge ab/7633965
Bug: 169893837
Merged-In: I2a2d02a0d7e67ee9577857a210cb6157683e5598
Change-Id: Iecdf0a17afe650483461978b42161940ce002101
Diffstat (limited to 'libs/input/Input.cpp')
| -rw-r--r-- | libs/input/Input.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 70ed438112..d954d23507 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -23,6 +23,7 @@ #include <limits.h> #include <string.h> +#include <android-base/properties.h> #include <android-base/stringprintf.h> #include <input/Input.h> #include <input/InputDevice.h> @@ -41,6 +42,15 @@ namespace android { namespace { +// When per-window-input-rotation is enabled, InputFlinger works in the un-rotated display +// coordinates and SurfaceFlinger includes the display rotation in the input window transforms. +bool isPerWindowInputRotationEnabled() { + static const bool PER_WINDOW_INPUT_ROTATION = + base::GetBoolProperty("persist.debug.per_window_input_rotation", false); + + return PER_WINDOW_INPUT_ROTATION; +} + float transformAngle(const ui::Transform& transform, float angleRadians) { // Construct and transform a vector oriented at the specified clockwise angle from vertical. // Coordinate system: down is increasing Y, right is increasing X. @@ -506,6 +516,8 @@ float MotionEvent::getHistoricalRawAxisValue(int32_t axis, size_t pointerIndex, size_t historicalIndex) const { const PointerCoords* coords = getHistoricalRawPointerCoords(pointerIndex, historicalIndex); + if (!isPerWindowInputRotationEnabled()) return coords->getAxisValue(axis); + if (axis == AMOTION_EVENT_AXIS_X || axis == AMOTION_EVENT_AXIS_Y) { // For compatibility, convert raw coordinates into "oriented screen space". Once app // developers are educated about getRaw, we can consider removing this. |