Skip to content

Commit d6e7fdc

Browse files
vishniakouAndroid (Google) Code Review
authored andcommitted
Revert "TouchInputMapper: Add fatal check expecting x/y axes to always be present"
This reverts commit 6a7626a. Reason for revert: b/408327828 Change-Id: I7ba205ef5a0200f791ef40b62767eb72299988bd
1 parent 6a7626a commit d6e7fdc

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "../Macros.h"
1818

19-
#include <android-base/logging.h>
2019
#include <android/sysprop/InputProperties.sysprop.h>
2120
#include "MultiTouchInputMapper.h"
2221

@@ -188,11 +187,14 @@ std::list<NotifyArgs> MultiTouchInputMapper::reconfigure(nsecs_t when,
188187
void MultiTouchInputMapper::configureRawPointerAxes() {
189188
TouchInputMapper::configureRawPointerAxes();
190189

191-
const auto xInfo = getAbsoluteAxisInfo(ABS_MT_POSITION_X);
192-
const auto yInfo = getAbsoluteAxisInfo(ABS_MT_POSITION_Y);
193-
LOG_IF(FATAL, !xInfo || !yInfo) << "X/Y axes not found for multi-touch device";
194-
mRawPointerAxes.x = *xInfo;
195-
mRawPointerAxes.y = *yInfo;
190+
// TODO(b/351870641): Investigate why we are sometime not getting valid axis infos for the x/y
191+
// axes, even though those axes are required to be supported.
192+
if (const auto xInfo = getAbsoluteAxisInfo(ABS_MT_POSITION_X); xInfo.has_value()) {
193+
mRawPointerAxes.x = *xInfo;
194+
}
195+
if (const auto yInfo = getAbsoluteAxisInfo(ABS_MT_POSITION_Y); yInfo.has_value()) {
196+
mRawPointerAxes.y = *yInfo;
197+
}
196198
mRawPointerAxes.touchMajor = getAbsoluteAxisInfo(ABS_MT_TOUCH_MAJOR);
197199
mRawPointerAxes.touchMinor = getAbsoluteAxisInfo(ABS_MT_TOUCH_MINOR);
198200
mRawPointerAxes.toolMajor = getAbsoluteAxisInfo(ABS_MT_WIDTH_MAJOR);

services/inputflinger/reader/mapper/SingleTouchInputMapper.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#include "SingleTouchInputMapper.h"
1818

19-
#include <android-base/logging.h>
20-
2119
namespace android {
2220

2321
SingleTouchInputMapper::SingleTouchInputMapper(InputDeviceContext& deviceContext,
@@ -74,11 +72,14 @@ void SingleTouchInputMapper::syncTouch(nsecs_t when, RawState* outState) {
7472
void SingleTouchInputMapper::configureRawPointerAxes() {
7573
TouchInputMapper::configureRawPointerAxes();
7674

77-
const auto xInfo = getAbsoluteAxisInfo(ABS_X);
78-
const auto yInfo = getAbsoluteAxisInfo(ABS_Y);
79-
LOG_IF(FATAL, !xInfo || !yInfo) << "X/Y axes not found for single-touch device";
80-
mRawPointerAxes.x = *xInfo;
81-
mRawPointerAxes.y = *yInfo;
75+
// TODO(b/351870641): Investigate why we are sometime not getting valid axis infos for the x/y
76+
// axes, even though those axes are required to be supported.
77+
if (const auto xInfo = getAbsoluteAxisInfo(ABS_X); xInfo.has_value()) {
78+
mRawPointerAxes.x = *xInfo;
79+
}
80+
if (const auto yInfo = getAbsoluteAxisInfo(ABS_Y); yInfo.has_value()) {
81+
mRawPointerAxes.y = *yInfo;
82+
}
8283
mRawPointerAxes.pressure = getAbsoluteAxisInfo(ABS_PRESSURE);
8384
mRawPointerAxes.toolMajor = getAbsoluteAxisInfo(ABS_TOOL_WIDTH);
8485
mRawPointerAxes.distance = getAbsoluteAxisInfo(ABS_DISTANCE);

services/inputflinger/tests/InputReader_test.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,6 @@ class InputReaderTest : public testing::Test {
616616
mFakeEventHub->addDevice(eventHubId, name, classes);
617617
mFakeEventHub->setSysfsRootPath(eventHubId, sysfsRootPath);
618618

619-
// Populate required axis info.
620-
if (classes.test(InputDeviceClass::TOUCH_MT)) {
621-
mFakeEventHub->addAbsoluteAxis(eventHubId, ABS_MT_POSITION_X, 0, 1, 0, 0);
622-
mFakeEventHub->addAbsoluteAxis(eventHubId, ABS_MT_POSITION_Y, 0, 1, 0, 0);
623-
} else if (classes.test(InputDeviceClass::TOUCH)) {
624-
mFakeEventHub->addAbsoluteAxis(eventHubId, ABS_X, 0, 1, 0, 0);
625-
mFakeEventHub->addAbsoluteAxis(eventHubId, ABS_Y, 0, 1, 0, 0);
626-
}
627-
628619
if (configuration) {
629620
mFakeEventHub->addConfigurationMap(eventHubId, configuration);
630621
}

0 commit comments

Comments
 (0)