Merge "Fix some bugs in input rotation" into sc-dev

This commit is contained in:
Evan Rosky
2021-03-01 19:20:50 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 28 deletions

View File

@@ -36,7 +36,6 @@ import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.MotionEvent.PointerCoords;
import android.view.Surface;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
@@ -60,9 +59,6 @@ public class PointerLocationView extends View implements InputDeviceListener,
*/
private static final String GESTURE_EXCLUSION_PROP = "debug.pointerlocation.showexclusion";
private static final boolean ENABLE_PER_WINDOW_INPUT_ROTATION =
SystemProperties.getBoolean("persist.debug.per_window_input_rotation", false);
public static class PointerState {
// Trace of previous points.
private float[] mTraceX = new float[32];
@@ -356,21 +352,6 @@ public class PointerLocationView extends View implements InputDeviceListener,
.toString(), 1 + itemW * 6, base, mTextPaint);
}
int saveId = canvas.save();
if (ENABLE_PER_WINDOW_INPUT_ROTATION) {
// Rotate negative (since we're rotating the drawing canvas vs the output).
canvas.rotate(-90.0f * mContext.getDisplay().getRotation());
switch (mContext.getDisplay().getRotation()) {
case Surface.ROTATION_90:
canvas.translate(-canvas.getHeight(), 0);
break;
case Surface.ROTATION_180:
canvas.translate(-canvas.getWidth(), -canvas.getHeight());
break;
case Surface.ROTATION_270:
canvas.translate(0, -canvas.getWidth());
}
}
// Pointer trace.
for (int p = 0; p < NP; p++) {
final PointerState ps = mPointers.get(p);
@@ -480,7 +461,6 @@ public class PointerLocationView extends View implements InputDeviceListener,
}
}
}
canvas.restoreToCount(saveId);
}
private void logMotionEvent(String type, MotionEvent event) {