#include "InputReader.h"
#include <cutils/log.h>
+#include <cutils/properties.h>
#include <input/Keyboard.h>
#include <input/VirtualKeyMap.h>
int32_t rawWidth = mRawPointerAxes.x.maxValue - mRawPointerAxes.x.minValue + 1;
int32_t rawHeight = mRawPointerAxes.y.maxValue - mRawPointerAxes.y.minValue + 1;
+ char hwrotBuf[PROPERTY_VALUE_MAX];
+ int32_t hwrotation = DISPLAY_ORIENTATION_0;
+ if (property_get("ro.sf.hwrotation", hwrotBuf, NULL) > 0) {
+ switch (atoi(hwrotBuf)) {
+ case 90:
+ hwrotation = DISPLAY_ORIENTATION_90;
+ break;
+ case 180:
+ hwrotation = DISPLAY_ORIENTATION_180;
+ break;
+ case 270:
+ hwrotation = DISPLAY_ORIENTATION_270;
+ break;
+ }
+ }
+
// Get associated display dimensions.
DisplayViewport newViewport;
if (mParameters.hasAssociatedDisplay) {
mDeviceMode = DEVICE_MODE_DISABLED;
return;
}
+ newViewport.orientation = (newViewport.orientation + hwrotation) % 4;
} else {
+ if ((hwrotation == DISPLAY_ORIENTATION_90 ||
+ hwrotation == DISPLAY_ORIENTATION_270)) {
+ int tmp = rawWidth;
+ rawWidth = rawHeight;
+ rawHeight = tmp;
+ }
newViewport.setNonDisplayViewport(rawWidth, rawHeight);
+ newViewport.orientation = hwrotation;
}
bool viewportChanged = mViewport != newViewport;
if (viewportChanged) {