Revert "Revert "Remove notifyConfigurationChanged listener and p..."
Revert submission 28384450-revert-28338641-remove_notify_configuration_changed-KXBQXRGFTY
Reason for revert: Builds started passing.
Reverted changes: /q/submissionid:28384450-revert-28338641-remove_notify_configuration_changed-KXBQXRGFTY
Change-Id: I6e9ffd1fbb5cf6edcbc08591e615bc1d1d383ea6
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 1ba79a9..9bbc44a 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -624,7 +624,6 @@
if (configuration) {
mFakeEventHub->addConfigurationMap(eventHubId, configuration);
}
- mFakeEventHub->finishDeviceScan();
mReader->loopOnce();
mReader->loopOnce();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
@@ -758,8 +757,6 @@
mReader->pushNextDevice(device);
ASSERT_NO_FATAL_FAILURE(addDevice(eventHubId, "fake", deviceClass, nullptr));
- ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyConfigurationChangedWasCalled(nullptr));
-
NotifyDeviceResetArgs resetArgs;
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs));
ASSERT_EQ(deviceId, resetArgs.deviceId);
@@ -775,7 +772,6 @@
disableDevice(deviceId);
mReader->loopOnce();
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasNotCalled());
- ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyConfigurationChangedWasNotCalled());
ASSERT_EQ(device->isEnabled(), false);
enableDevice(deviceId);
@@ -960,17 +956,6 @@
ASSERT_TRUE(flags[0] && flags[1] && !flags[2] && !flags[3]);
}
-TEST_F(InputReaderTest, LoopOnce_WhenDeviceScanFinished_SendsConfigurationChanged) {
- constexpr int32_t eventHubId = 1;
- addDevice(eventHubId, "ignored", InputDeviceClass::KEYBOARD, nullptr);
-
- NotifyConfigurationChangedArgs args;
-
- ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyConfigurationChangedWasCalled(&args));
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
- ASSERT_EQ(ARBITRARY_TIME, args.eventTime);
-}
-
TEST_F(InputReaderTest, LoopOnce_ForwardsRawEventsToMappers) {
constexpr int32_t deviceId = END_RESERVED_ID + 1000;
constexpr ftl::Flags<InputDeviceClass> deviceClass = InputDeviceClass::KEYBOARD;
@@ -1075,7 +1060,6 @@
// The device is added after the input port associations are processed since
// we do not yet support dynamic device-to-display associations.
ASSERT_NO_FATAL_FAILURE(addDevice(eventHubId, "fake", deviceClass, nullptr));
- ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyConfigurationChangedWasCalled());
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled());
ASSERT_NO_FATAL_FAILURE(mapper.assertConfigureWasCalled());
@@ -1105,8 +1089,6 @@
ASSERT_NO_FATAL_FAILURE(addDevice(eventHubIds[0], "fake1", deviceClass, nullptr));
ASSERT_NO_FATAL_FAILURE(addDevice(eventHubIds[1], "fake2", deviceClass, nullptr));
- ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyConfigurationChangedWasCalled(nullptr));
-
NotifyDeviceResetArgs resetArgs;
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs));
ASSERT_EQ(deviceId, resetArgs.deviceId);
@@ -1479,9 +1461,7 @@
// to the test device will show up in mReader. We wait for those input devices to
// show up before beginning the tests.
ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyInputDevicesChangedWasCalled());
- ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyConfigurationChangedWasCalled());
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
}
};
@@ -1501,12 +1481,10 @@
// consider it as a valid device.
std::unique_ptr<UinputDevice> invalidDevice = createUinputDevice<InvalidUinputDevice>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesNotChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationNotChanged());
ASSERT_EQ(numDevices, mFakePolicy->getInputDevices().size());
invalidDevice.reset();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesNotChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationNotChanged());
ASSERT_EQ(numDevices, mFakePolicy->getInputDevices().size());
}
@@ -1515,7 +1493,6 @@
std::unique_ptr<UinputHomeKey> keyboard = createUinputDevice<UinputHomeKey>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
ASSERT_EQ(initialNumDevices + 1, mFakePolicy->getInputDevices().size());
const auto device = waitForDevice(keyboard->getName());
@@ -1526,7 +1503,6 @@
keyboard.reset();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
ASSERT_EQ(initialNumDevices, mFakePolicy->getInputDevices().size());
}
@@ -1534,21 +1510,14 @@
std::unique_ptr<UinputHomeKey> keyboard = createUinputDevice<UinputHomeKey>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- NotifyConfigurationChangedArgs configChangedArgs;
- ASSERT_NO_FATAL_FAILURE(
- mTestListener->assertNotifyConfigurationChangedWasCalled(&configChangedArgs));
- int32_t prevId = configChangedArgs.id;
- nsecs_t prevTimestamp = configChangedArgs.eventTime;
-
NotifyKeyArgs keyArgs;
keyboard->pressAndReleaseHomeKey();
ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyKeyWasCalled(&keyArgs));
ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action);
- ASSERT_NE(prevId, keyArgs.id);
- prevId = keyArgs.id;
- ASSERT_LE(prevTimestamp, keyArgs.eventTime);
ASSERT_LE(keyArgs.eventTime, keyArgs.readTime);
- prevTimestamp = keyArgs.eventTime;
+
+ int32_t prevId = keyArgs.id;
+ nsecs_t prevTimestamp = keyArgs.eventTime;
ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyKeyWasCalled(&keyArgs));
ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action);
@@ -1671,8 +1640,6 @@
mDevice = createUinputDevice<UinputTouchScreen>(Rect(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT));
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
- ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyConfigurationChangedWasCalled());
const auto info = waitForDevice(mDevice->getName());
ASSERT_TRUE(info);
mDeviceInfo = *info;
@@ -1741,8 +1708,6 @@
UNIQUE_ID, isInputPortAssociation ? DISPLAY_PORT : NO_PORT,
ViewportType::INTERNAL);
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
- ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyConfigurationChangedWasCalled());
const auto info = waitForDevice(mDevice->getName());
ASSERT_TRUE(info);
mDeviceInfo = *info;
@@ -2075,7 +2040,6 @@
// Connecting an external stylus mid-gesture should not interrupt the ongoing gesture stream.
auto externalStylus = createUinputDevice<UinputExternalStylus>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
const auto stylusInfo = waitForDevice(externalStylus->getName());
ASSERT_TRUE(stylusInfo);
@@ -2088,7 +2052,6 @@
// Disconnecting an external stylus mid-gesture should not interrupt the ongoing gesture stream.
externalStylus.reset();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyMotionWasNotCalled());
// Up
@@ -2146,8 +2109,6 @@
mStylusDeviceLifecycleTracker = createUinputDevice<T>();
mStylus = mStylusDeviceLifecycleTracker.get();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
- ASSERT_NO_FATAL_FAILURE(mTestListener->assertNotifyConfigurationChangedWasCalled());
const auto info = waitForDevice(mStylus->getName());
ASSERT_TRUE(info);
mStylusInfo = *info;
@@ -2417,7 +2378,6 @@
std::unique_ptr<UinputExternalStylusWithPressure> stylus =
createUinputDevice<UinputExternalStylusWithPressure>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
const auto stylusInfo = waitForDevice(stylus->getName());
ASSERT_TRUE(stylusInfo);
@@ -2435,7 +2395,6 @@
std::unique_ptr<UinputExternalStylusWithPressure> stylus =
createUinputDevice<UinputExternalStylusWithPressure>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
const auto stylusInfo = waitForDevice(stylus->getName());
ASSERT_TRUE(stylusInfo);
@@ -2481,7 +2440,6 @@
std::unique_ptr<UinputExternalStylusWithPressure> stylus =
createUinputDevice<UinputExternalStylusWithPressure>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
const auto stylusInfo = waitForDevice(stylus->getName());
ASSERT_TRUE(stylusInfo);
@@ -2561,7 +2519,6 @@
// touch pointers.
std::unique_ptr<UinputExternalStylus> stylus = createUinputDevice<UinputExternalStylus>();
ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged());
- ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged());
const auto stylusInfo = waitForDevice(stylus->getName());
ASSERT_TRUE(stylusInfo);