From 81420cc49e1150c6fd64d3d8b595bd51fac8c15f Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Mon, 6 Sep 2021 10:28:50 -0700 Subject: InputDispatcherPolicy: Transform incoming/outgoing events The InputDispatcherPolicy expects events to be in the logical display space. When per-window-input-rotation is enabled, the dispatcher works in the display space, so we need to transform events accordingly. 1. MotionEvents that are injected from the policy are in logical display coordinates. We need to transform them to display space before proceeding with injection. 2. When sending events to the policy to be filtered by the InputFilter, we need to include the display transform so that the events are in the logical display space. This also removes the flag gurad for the per-window-input-rotation feature in Input.cpp, which is required for the tests to pass when the flag is disabled. This guard does not do anything anymore because the RawTransforms are blocked by the flag in SF. Bug: 179274888 Test: manual: adb shell input swipe 200 200 500 500 1000 Test: atest InputShellCommandTest // CTS test for input injeciton Test: atest inputflinger_tests Change-Id: I122e511039ca629ab8982ed27d3d35f9e7b37d70 --- libs/input/Input.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'libs/input/Input.cpp') diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 30e5d5b0bc..a1542c8793 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -20,10 +20,8 @@ #include #include #include -#include #include -#include #include #include #include @@ -43,15 +41,6 @@ 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. @@ -511,8 +500,6 @@ 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 logical display space. const vec2 xy = shouldDisregardTranslation(mSource) -- cgit v1.2.3-59-g8ed1b