Remove workaround for unrotated gesture monitor (1/3)

There is currently a conflation between per-window-input-rotation and
unrotated gesture monitors. We would like to enable
per-widnow-input-rotation first without affecting gesture monitors so
that the old behavior is maintained for gesture monitors.

We can then add unrotated gesture monitors as a new feature later on.

Bug: 201982032
Bug: 179274888
Test: manual
Change-Id: I87d131016f403a9d06b1bd1ead542863af6cbe16
This commit is contained in:
Prabir Pradhan
2021-10-04 05:44:50 -07:00
parent bf23230dc0
commit ccc3781225
4 changed files with 2 additions and 37 deletions

View File

@@ -39,7 +39,6 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Choreographer;
import android.view.Display;
import android.view.ISystemGestureExclusionListener;
import android.view.IWindowManager;
import android.view.InputDevice;
@@ -105,9 +104,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
static final boolean DEBUG_MISSING_GESTURE = false;
static final String DEBUG_MISSING_GESTURE_TAG = "NoBackGesture";
private static final boolean ENABLE_PER_WINDOW_INPUT_ROTATION =
SystemProperties.getBoolean("persist.debug.per_window_input_rotation", false);
private ISystemGestureExclusionListener mGestureExclusionListener =
new ISystemGestureExclusionListener.Stub() {
@Override
@@ -559,16 +555,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
private void onInputEvent(InputEvent ev) {
if (!(ev instanceof MotionEvent)) return;
MotionEvent event = (MotionEvent) ev;
if (ENABLE_PER_WINDOW_INPUT_ROTATION) {
final Display display = mContext.getDisplay();
int rotation = display.getRotation();
if (rotation != Surface.ROTATION_0) {
Point sz = new Point();
display.getRealSize(sz);
event = MotionEvent.obtain(event);
event.transform(MotionEvent.createRotateMatrix(rotation, sz.x, sz.y));
}
}
onMotionEvent(event);
}

View File

@@ -73,7 +73,6 @@ import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ShellCallback;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.VibrationEffect;
import android.os.vibrator.StepSegment;
@@ -175,9 +174,6 @@ public class InputManagerService extends IInputManager.Stub
/** TODO(b/169067926): Remove this. */
private static final boolean UNTRUSTED_TOUCHES_TOAST = false;
public static final boolean ENABLE_PER_WINDOW_INPUT_ROTATION =
SystemProperties.getBoolean("persist.debug.per_window_input_rotation", false);
// Pointer to native input manager service object.
private final long mPtr;

View File

@@ -1067,7 +1067,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
final InputChannel inputChannel = mWmService.mInputManager.monitorInput(
"PointerEventDispatcher" + mDisplayId, mDisplayId);
mPointerEventDispatcher = new PointerEventDispatcher(inputChannel, this);
mPointerEventDispatcher = new PointerEventDispatcher(inputChannel);
// Tap Listeners are supported for:
// 1. All physical displays (multi-display).

View File

@@ -16,15 +16,11 @@
package com.android.server.wm;
import static com.android.server.input.InputManagerService.ENABLE_PER_WINDOW_INPUT_ROTATION;
import android.graphics.Point;
import android.view.InputChannel;
import android.view.InputDevice;
import android.view.InputEvent;
import android.view.InputEventReceiver;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.WindowManagerPolicyConstants.PointerEventListener;
import com.android.server.UiThread;
@@ -35,12 +31,8 @@ public class PointerEventDispatcher extends InputEventReceiver {
private final ArrayList<PointerEventListener> mListeners = new ArrayList<>();
private PointerEventListener[] mListenersArray = new PointerEventListener[0];
private final DisplayContent mDisplayContent;
private final Point mTmpSize = new Point();
public PointerEventDispatcher(InputChannel inputChannel, DisplayContent dc) {
public PointerEventDispatcher(InputChannel inputChannel) {
super(inputChannel, UiThread.getHandler().getLooper());
mDisplayContent = dc;
}
@Override
@@ -49,15 +41,6 @@ public class PointerEventDispatcher extends InputEventReceiver {
if (event instanceof MotionEvent
&& (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
MotionEvent motionEvent = (MotionEvent) event;
if (ENABLE_PER_WINDOW_INPUT_ROTATION) {
final int rotation = mDisplayContent.getRotation();
if (rotation != Surface.ROTATION_0) {
mDisplayContent.getDisplay().getRealSize(mTmpSize);
motionEvent = MotionEvent.obtain(motionEvent);
motionEvent.transform(MotionEvent.createRotateMatrix(
rotation, mTmpSize.x, mTmpSize.y));
}
}
PointerEventListener[] listeners;
synchronized (mListeners) {
if (mListenersArray == null) {