Revert "Remove notifyConfigurationChanged listener and policy calls"
Revert submission 28338641-remove_notify_configuration_changed
Reason for revert: Droidmonitor created revert due to http://b/353980868 - verifying through ABTD before submission.
Reverted changes: /q/submissionid:28338641-remove_notify_configuration_changed
Change-Id: I06b37a72b5cb67e377a2deb79c14d266afdcf81f
diff --git a/services/inputflinger/tests/FakeInputReaderPolicy.cpp b/services/inputflinger/tests/FakeInputReaderPolicy.cpp
index 6099c91..56a8918 100644
--- a/services/inputflinger/tests/FakeInputReaderPolicy.cpp
+++ b/services/inputflinger/tests/FakeInputReaderPolicy.cpp
@@ -65,6 +65,23 @@
ASSERT_FALSE(mDeviceIdOfNotifiedStylusGesture);
}
+void FakeInputReaderPolicy::assertConfigurationChanged() {
+ std::unique_lock lock(mLock);
+ base::ScopedLockAssertion assumeLocked(mLock);
+
+ const bool configurationChanged =
+ mConfigurationChangedCondition.wait_for(lock, WAIT_TIMEOUT, [this]() REQUIRES(mLock) {
+ return mConfigurationChanged;
+ });
+ ASSERT_TRUE(configurationChanged) << "Timed out waiting for configuration change";
+ mConfigurationChanged = false;
+}
+
+void FakeInputReaderPolicy::assertConfigurationNotChanged() {
+ std::scoped_lock lock(mLock);
+ ASSERT_FALSE(mConfigurationChanged);
+}
+
void FakeInputReaderPolicy::clearViewports() {
mViewports.clear();
mConfig.setDisplayViewports(mViewports);
@@ -234,6 +251,12 @@
mDevicesChangedCondition.notify_all();
}
+void FakeInputReaderPolicy::notifyConfigurationChanged(nsecs_t when) {
+ std::scoped_lock lock(mLock);
+ mConfigurationChanged = true;
+ mConfigurationChangedCondition.notify_all();
+}
+
std::shared_ptr<KeyCharacterMap> FakeInputReaderPolicy::getKeyboardLayoutOverlay(
const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) {
return nullptr;