// Ensure we have valid X and Y axes.
if (!mRawPointerAxes.x.valid || !mRawPointerAxes.y.valid) {
ALOGW(INDENT "Touch device '%s' did not report support for X or Y axis! "
"The device will be inoperable.", getDeviceName().string());
mDeviceMode = DEVICE_MODE_DISABLED;
return;
}
// Raw width and height in the natural orientation.
int32_t rawWidth = mRawPointerAxes.x.maxValue - mRawPointerAxes.x.minValue + 1;
int32_t rawHeight = mRawPointerAxes.y.maxValue - mRawPointerAxes.y.minValue + 1;
// Get associated display dimensions.
DisplayViewport newViewport;
if (mParameters.hasAssociatedDisplay) {
if (!mConfig.getDisplayInfo(mParameters.associatedDisplayIsExternal, &newViewport)) {
ALOGI(INDENT "Touch device '%s' could not query the properties of its associated "
"display. The device will be inoperable until the display size "
"becomes available.",
getDeviceName().string());
mDeviceMode = DEVICE_MODE_DISABLED;
return;
}
} else {
newViewport.setNonDisplayViewport(rawWidth, rawHeight);
}
bool viewportChanged = mViewport != newViewport;
if (viewportChanged) {
mViewport = newViewport;