Convert orientation values in input to ui::Rotation.
ui::Rotation both provides better typesafety as well as some convenience
functions (e.g. operator+, operator-).
Test: atest TouchVideoFrame_test.cpp InputReader_test.cpp
Change-Id: Ib423457c742ed3d41f2e3fc269ddf86809cbf247
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 3685f54..162b757 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -552,19 +552,19 @@
&pointerCoords[getPointerCount()]);
}
-int MotionEvent::getSurfaceRotation() const {
+int32_t MotionEvent::getSurfaceRotation() const {
// The surface rotation is the rotation from the window's coordinate space to that of the
// display. Since the event's transform takes display space coordinates to window space, the
// returned surface rotation is the inverse of the rotation for the surface.
switch (mTransform.getOrientation()) {
case ui::Transform::ROT_0:
- return DISPLAY_ORIENTATION_0;
+ return static_cast<int32_t>(ui::ROTATION_0);
case ui::Transform::ROT_90:
- return DISPLAY_ORIENTATION_270;
+ return static_cast<int32_t>(ui::ROTATION_270);
case ui::Transform::ROT_180:
- return DISPLAY_ORIENTATION_180;
+ return static_cast<int32_t>(ui::ROTATION_180);
case ui::Transform::ROT_270:
- return DISPLAY_ORIENTATION_90;
+ return static_cast<int32_t>(ui::ROTATION_90);
default:
return -1;
}