Remove custom timestamp from hw/libhw/input

These are no longer used by EventHub, and should not be carried forward.

Bug: 116601048
Test: presubmit only
Merged-In: I35129484d9945dcd4d291e0f2fac894e07c53c04
Change-Id: I35129484d9945dcd4d291e0f2fac894e07c53c04
This commit is contained in:
Siarhei Vishniakou 2019-08-12 14:20:09 -05:00
parent 9359ffb16b
commit 1fc88e88f6
3 changed files with 0 additions and 55 deletions

View file

@ -37,8 +37,6 @@
#include "MouseInputMapper.h"
#include "SwitchInputMapper.h"
#define MSC_ANDROID_TIME_SEC 0x6
#define MSC_ANDROID_TIME_USEC 0x7
namespace android {
@ -240,25 +238,6 @@ void EvdevDevice::processInput(InputEvent& event, nsecs_t currentTime) {
event.value);
#endif
if (event.type == EV_MSC) {
if (event.code == MSC_ANDROID_TIME_SEC) {
mOverrideSec = event.value;
} else if (event.code == MSC_ANDROID_TIME_USEC) {
mOverrideUsec = event.value;
}
return;
}
if (mOverrideSec || mOverrideUsec) {
event.when = s2ns(mOverrideSec) + us2ns(mOverrideUsec);
ALOGV("applied override time %d.%06d", mOverrideSec, mOverrideUsec);
if (event.type == EV_SYN && event.code == SYN_REPORT) {
mOverrideSec = 0;
mOverrideUsec = 0;
}
}
// Bug 7291243: Add a guard in case the kernel generates timestamps
// that appear to be far into the future because they were generated
// using the wrong clock source.

View file

@ -72,9 +72,6 @@ private:
InputDeviceHandle* mDeviceHandle = nullptr;
std::vector<std::unique_ptr<InputMapper>> mMappers;
uint32_t mClasses = 0;
int32_t mOverrideSec = 0;
int32_t mOverrideUsec = 0;
};
/* Input device classes. */

View file

@ -31,8 +31,6 @@
// # of milliseconds to allow for timing measurements
#define TIMING_TOLERANCE_MS 25
#define MSC_ANDROID_TIME_SEC 0x6
#define MSC_ANDROID_TIME_USEC 0x7
using ::testing::_;
using ::testing::NiceMock;
@ -66,35 +64,6 @@ protected:
NiceMock<MockInputDeviceDefinition> mDeviceDef;
};
TEST_F(EvdevDeviceTest, testOverrideTime) {
auto node = std::make_shared<MockInputDeviceNode>();
auto device = std::make_unique<EvdevDevice>(&mHost, node);
ASSERT_TRUE(device != nullptr);
// Send two timestamp override events before an input event.
nsecs_t when = 2ULL;
InputEvent msc1 = { when, EV_MSC, MSC_ANDROID_TIME_SEC, 1 };
InputEvent msc2 = { when, EV_MSC, MSC_ANDROID_TIME_USEC, 900000 };
// Send a key down and syn. Should get the overridden timestamp.
InputEvent keyDown = { when, EV_KEY, KEY_HOME, 1 };
InputEvent syn = { when, EV_SYN, SYN_REPORT, 0 };
// Send a key up, which should be at the reported timestamp.
InputEvent keyUp = { when, EV_KEY, KEY_HOME, 0 };
device->processInput(msc1, when);
device->processInput(msc2, when);
device->processInput(keyDown, when);
device->processInput(syn, when);
device->processInput(keyUp, when);
nsecs_t expectedWhen = s2ns(1) + us2ns(900000);
EXPECT_EQ(expectedWhen, keyDown.when);
EXPECT_EQ(expectedWhen, syn.when);
EXPECT_EQ(when, keyUp.when);
}
TEST_F(EvdevDeviceTest, testWrongClockCorrection) {
auto node = std::make_shared<MockInputDeviceNode>();
auto device = std::make_unique<EvdevDevice>(&mHost, node);