diff options
author | 2024-07-18 17:44:51 +0000 | |
---|---|---|
committer | 2024-07-18 17:45:09 +0000 | |
commit | 5b8217ba475cae9b8cbf2dcaeb4e3c20ac07e95b (patch) | |
tree | 27c44ca0f05d3911275cbd873b9e80e78e119a6a | |
parent | c3cf1a294d7c364f6485285083261fe584a148ed (diff) |
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
37 files changed, 14 insertions, 345 deletions
diff --git a/services/inputflinger/InputDeviceMetricsCollector.cpp b/services/inputflinger/InputDeviceMetricsCollector.cpp index b5cb3cbb57..46211441a9 100644 --- a/services/inputflinger/InputDeviceMetricsCollector.cpp +++ b/services/inputflinger/InputDeviceMetricsCollector.cpp @@ -133,15 +133,6 @@ void InputDeviceMetricsCollector::notifyInputDevicesChanged( mNextListener.notify(args); } -void InputDeviceMetricsCollector::notifyConfigurationChanged( - const NotifyConfigurationChangedArgs& args) { - { - std::scoped_lock lock(mLock); - reportCompletedSessions(); - } - mNextListener.notify(args); -} - void InputDeviceMetricsCollector::notifyKey(const NotifyKeyArgs& args) { { std::scoped_lock lock(mLock); diff --git a/services/inputflinger/InputDeviceMetricsCollector.h b/services/inputflinger/InputDeviceMetricsCollector.h index 1bcd527626..0a520e6869 100644 --- a/services/inputflinger/InputDeviceMetricsCollector.h +++ b/services/inputflinger/InputDeviceMetricsCollector.h @@ -107,7 +107,6 @@ public: std::chrono::nanoseconds usageSessionTimeout); void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; void notifySwitch(const NotifySwitchArgs& args) override; diff --git a/services/inputflinger/InputFilter.cpp b/services/inputflinger/InputFilter.cpp index 8e73ce5d94..e4d73fc974 100644 --- a/services/inputflinger/InputFilter.cpp +++ b/services/inputflinger/InputFilter.cpp @@ -67,10 +67,6 @@ void InputFilter::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& mNextListener.notify(args); } -void InputFilter::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - mNextListener.notify(args); -} - void InputFilter::notifyKey(const NotifyKeyArgs& args) { if (isFilterEnabled()) { LOG_ALWAYS_FATAL_IF(!mInputFilterRust->notifyKey(notifyKeyArgsToKeyEvent(args)).isOk()); diff --git a/services/inputflinger/InputFilter.h b/services/inputflinger/InputFilter.h index 4ddc9f4f6b..f626703524 100644 --- a/services/inputflinger/InputFilter.h +++ b/services/inputflinger/InputFilter.h @@ -53,7 +53,6 @@ public: InputFilterPolicyInterface& policy); ~InputFilter() override = default; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; void notifySwitch(const NotifySwitchArgs& args) override; diff --git a/services/inputflinger/InputListener.cpp b/services/inputflinger/InputListener.cpp index 016ae045a9..8b6accf0f8 100644 --- a/services/inputflinger/InputListener.cpp +++ b/services/inputflinger/InputListener.cpp @@ -47,7 +47,6 @@ Visitor(V...) -> Visitor<V...>; void InputListenerInterface::notify(const NotifyArgs& generalArgs) { Visitor v{ [&](const NotifyInputDevicesChangedArgs& args) { notifyInputDevicesChanged(args); }, - [&](const NotifyConfigurationChangedArgs& args) { notifyConfigurationChanged(args); }, [&](const NotifyKeyArgs& args) { notifyKey(args); }, [&](const NotifyMotionArgs& args) { notifyMotion(args); }, [&](const NotifySwitchArgs& args) { notifySwitch(args); }, @@ -68,10 +67,6 @@ void QueuedInputListener::notifyInputDevicesChanged(const NotifyInputDevicesChan mArgsQueue.emplace_back(args); } -void QueuedInputListener::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - mArgsQueue.emplace_back(args); -} - void QueuedInputListener::notifyKey(const NotifyKeyArgs& args) { mArgsQueue.emplace_back(args); } @@ -119,13 +114,6 @@ void TracedInputListener::notifyInputDevicesChanged(const NotifyInputDevicesChan mInnerListener.notify(args); } -void TracedInputListener::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - constexpr static auto& fnName = __func__; - ATRACE_NAME_IF(ATRACE_ENABLED(), - StringPrintf("%s::%s(id=0x%" PRIx32 ")", mName, fnName, args.id)); - mInnerListener.notify(args); -} - void TracedInputListener::notifyKey(const NotifyKeyArgs& args) { constexpr static auto& fnName = __func__; ATRACE_NAME_IF(ATRACE_ENABLED(), diff --git a/services/inputflinger/InputProcessor.cpp b/services/inputflinger/InputProcessor.cpp index 6dd267ce8f..8b8b1ad4d8 100644 --- a/services/inputflinger/InputProcessor.cpp +++ b/services/inputflinger/InputProcessor.cpp @@ -419,12 +419,6 @@ void InputProcessor::notifyInputDevicesChanged(const NotifyInputDevicesChangedAr mQueuedListener.flush(); } -void InputProcessor::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - // pass through - mQueuedListener.notifyConfigurationChanged(args); - mQueuedListener.flush(); -} - void InputProcessor::notifyKey(const NotifyKeyArgs& args) { // pass through mQueuedListener.notifyKey(args); diff --git a/services/inputflinger/InputProcessor.h b/services/inputflinger/InputProcessor.h index 7a00a2dae8..2945dd2277 100644 --- a/services/inputflinger/InputProcessor.h +++ b/services/inputflinger/InputProcessor.h @@ -246,7 +246,6 @@ public: explicit InputProcessor(InputListenerInterface& listener); void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; void notifySwitch(const NotifySwitchArgs& args) override; diff --git a/services/inputflinger/NotifyArgs.cpp b/services/inputflinger/NotifyArgs.cpp index 19a4f26a1e..b2680a2139 100644 --- a/services/inputflinger/NotifyArgs.cpp +++ b/services/inputflinger/NotifyArgs.cpp @@ -35,11 +35,6 @@ NotifyInputDevicesChangedArgs::NotifyInputDevicesChangedArgs(int32_t id, std::vector<InputDeviceInfo> infos) : id(id), inputDeviceInfos(std::move(infos)) {} -// --- NotifyConfigurationChangedArgs --- - -NotifyConfigurationChangedArgs::NotifyConfigurationChangedArgs(int32_t id, nsecs_t eventTime) - : id(id), eventTime(eventTime) {} - // --- NotifyKeyArgs --- NotifyKeyArgs::NotifyKeyArgs(int32_t id, nsecs_t eventTime, nsecs_t readTime, int32_t deviceId, @@ -198,7 +193,6 @@ Visitor(V...) -> Visitor<V...>; const char* toString(const NotifyArgs& args) { Visitor toStringVisitor{ [&](const NotifyInputDevicesChangedArgs&) { return "NotifyInputDevicesChangedArgs"; }, - [&](const NotifyConfigurationChangedArgs&) { return "NotifyConfigurationChangedArgs"; }, [&](const NotifyKeyArgs&) { return "NotifyKeyArgs"; }, [&](const NotifyMotionArgs&) { return "NotifyMotionArgs"; }, [&](const NotifySensorArgs&) { return "NotifySensorArgs"; }, diff --git a/services/inputflinger/PointerChoreographer.cpp b/services/inputflinger/PointerChoreographer.cpp index 31fbb515b2..2ea09d2c9f 100644 --- a/services/inputflinger/PointerChoreographer.cpp +++ b/services/inputflinger/PointerChoreographer.cpp @@ -165,10 +165,6 @@ void PointerChoreographer::notifyInputDevicesChanged(const NotifyInputDevicesCha mNextListener.notify(args); } -void PointerChoreographer::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - mNextListener.notify(args); -} - void PointerChoreographer::notifyKey(const NotifyKeyArgs& args) { fadeMouseCursorOnKeyPress(args); mNextListener.notify(args); diff --git a/services/inputflinger/PointerChoreographer.h b/services/inputflinger/PointerChoreographer.h index aaf1e3e962..635487be6b 100644 --- a/services/inputflinger/PointerChoreographer.h +++ b/services/inputflinger/PointerChoreographer.h @@ -105,7 +105,6 @@ public: void setFocusedDisplay(ui::LogicalDisplayId displayId) override; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; void notifySwitch(const NotifySwitchArgs& args) override; diff --git a/services/inputflinger/UnwantedInteractionBlocker.cpp b/services/inputflinger/UnwantedInteractionBlocker.cpp index 1e2b9b3ad3..0e9ec914b7 100644 --- a/services/inputflinger/UnwantedInteractionBlocker.cpp +++ b/services/inputflinger/UnwantedInteractionBlocker.cpp @@ -342,12 +342,6 @@ UnwantedInteractionBlocker::UnwantedInteractionBlocker(InputListenerInterface& l bool enablePalmRejection) : mQueuedListener(listener), mEnablePalmRejection(enablePalmRejection) {} -void UnwantedInteractionBlocker::notifyConfigurationChanged( - const NotifyConfigurationChangedArgs& args) { - mQueuedListener.notifyConfigurationChanged(args); - mQueuedListener.flush(); -} - void UnwantedInteractionBlocker::notifyKey(const NotifyKeyArgs& args) { mQueuedListener.notifyKey(args); mQueuedListener.flush(); diff --git a/services/inputflinger/UnwantedInteractionBlocker.h b/services/inputflinger/UnwantedInteractionBlocker.h index 419da8366e..8a66e25f58 100644 --- a/services/inputflinger/UnwantedInteractionBlocker.h +++ b/services/inputflinger/UnwantedInteractionBlocker.h @@ -91,7 +91,6 @@ public: explicit UnwantedInteractionBlocker(InputListenerInterface& listener, bool enablePalmRejection); void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; void notifySwitch(const NotifySwitchArgs& args) override; diff --git a/services/inputflinger/dispatcher/Entry.cpp b/services/inputflinger/dispatcher/Entry.cpp index ad9cec1791..ff407af8e1 100644 --- a/services/inputflinger/dispatcher/Entry.cpp +++ b/services/inputflinger/dispatcher/Entry.cpp @@ -68,15 +68,6 @@ EventEntry::EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policy injectionState(nullptr), dispatchInProgress(false) {} -// --- ConfigurationChangedEntry --- - -ConfigurationChangedEntry::ConfigurationChangedEntry(int32_t id, nsecs_t eventTime) - : EventEntry(id, Type::CONFIGURATION_CHANGED, eventTime, 0) {} - -std::string ConfigurationChangedEntry::getDescription() const { - return StringPrintf("ConfigurationChangedEvent(), policyFlags=0x%08x", policyFlags); -} - // --- DeviceResetEntry --- DeviceResetEntry::DeviceResetEntry(int32_t id, nsecs_t eventTime, int32_t deviceId) diff --git a/services/inputflinger/dispatcher/Entry.h b/services/inputflinger/dispatcher/Entry.h index f2f31d88ef..becfb05f67 100644 --- a/services/inputflinger/dispatcher/Entry.h +++ b/services/inputflinger/dispatcher/Entry.h @@ -32,7 +32,6 @@ namespace android::inputdispatcher { struct EventEntry { enum class Type { - CONFIGURATION_CHANGED, DEVICE_RESET, FOCUS, KEY, @@ -78,11 +77,6 @@ struct EventEntry { virtual ~EventEntry() = default; }; -struct ConfigurationChangedEntry : EventEntry { - explicit ConfigurationChangedEntry(int32_t id, nsecs_t eventTime); - std::string getDescription() const override; -}; - struct DeviceResetEntry : EventEntry { int32_t deviceId; diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index 6c4870f071..d1dc1ee4a3 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -558,7 +558,6 @@ bool isConnectionResponsive(const Connection& connection) { // Returns true if the event type passed as argument represents a user activity. bool isUserActivityEvent(const EventEntry& eventEntry) { switch (eventEntry.type) { - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: case EventEntry::Type::DRAG: case EventEntry::Type::FOCUS: @@ -1153,14 +1152,6 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t& nextWakeupTime) { } switch (mPendingEvent->type) { - case EventEntry::Type::CONFIGURATION_CHANGED: { - const ConfigurationChangedEntry& typedEntry = - static_cast<const ConfigurationChangedEntry&>(*mPendingEvent); - done = dispatchConfigurationChangedLocked(currentTime, typedEntry); - dropReason = DropReason::NOT_DROPPED; // configuration changes are never dropped - break; - } - case EventEntry::Type::DEVICE_RESET: { const DeviceResetEntry& typedEntry = static_cast<const DeviceResetEntry&>(*mPendingEvent); @@ -1392,7 +1383,6 @@ bool InputDispatcher::enqueueInboundEventLocked(std::unique_ptr<EventEntry> newE break; } case EventEntry::Type::TOUCH_MODE_CHANGED: - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: case EventEntry::Type::SENSOR: case EventEntry::Type::POINTER_CAPTURE_CHANGED: @@ -1566,7 +1556,6 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason } case EventEntry::Type::FOCUS: case EventEntry::Type::TOUCH_MODE_CHANGED: - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("Should not drop %s events", ftl::enum_string(entry.type).c_str()); break; @@ -1655,18 +1644,6 @@ std::shared_ptr<KeyEntry> InputDispatcher::synthesizeKeyRepeatLocked(nsecs_t cur return newEntry; } -bool InputDispatcher::dispatchConfigurationChangedLocked(nsecs_t currentTime, - const ConfigurationChangedEntry& entry) { - if (DEBUG_OUTBOUND_EVENT_DETAILS) { - ALOGD("dispatchConfigurationChanged - eventTime=%" PRId64, entry.eventTime); - } - - // Reset key repeating in case a keyboard device was added or removed or something. - resetKeyRepeatLocked(); - - return true; -} - bool InputDispatcher::dispatchDeviceResetLocked(nsecs_t currentTime, const DeviceResetEntry& entry) { if (DEBUG_OUTBOUND_EVENT_DETAILS) { @@ -2224,7 +2201,6 @@ ui::LogicalDisplayId InputDispatcher::getTargetDisplayId(const EventEntry& entry case EventEntry::Type::TOUCH_MODE_CHANGED: case EventEntry::Type::POINTER_CAPTURE_CHANGED: case EventEntry::Type::FOCUS: - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: case EventEntry::Type::SENSOR: case EventEntry::Type::DRAG: { @@ -3620,7 +3596,6 @@ void InputDispatcher::enqueueDispatchEntryLocked(const std::shared_ptr<Connectio LOG_ALWAYS_FATAL("SENSOR events should not go to apps via input channel"); break; } - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("%s events should not go to apps", ftl::enum_string(eventEntry->type).c_str()); @@ -3881,7 +3856,6 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, break; } - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: case EventEntry::Type::SENSOR: { LOG_ALWAYS_FATAL("Should never start dispatch cycles for %s events", @@ -4277,7 +4251,6 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( ftl::enum_string(cancelationEventEntry->type).c_str()); break; } - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: case EventEntry::Type::SENSOR: { LOG_ALWAYS_FATAL("%s event should not be found inside Connections's queue", @@ -4360,7 +4333,6 @@ void InputDispatcher::synthesizePointerDownEventsForConnectionLocked( case EventEntry::Type::KEY: case EventEntry::Type::FOCUS: case EventEntry::Type::TOUCH_MODE_CHANGED: - case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: case EventEntry::Type::POINTER_CAPTURE_CHANGED: case EventEntry::Type::SENSOR: @@ -4446,28 +4418,11 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent( void InputDispatcher::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) { std::scoped_lock _l(mLock); + // Reset key repeating in case a keyboard device was added or removed or something. + resetKeyRepeatLocked(); mLatencyTracker.setInputDevices(args.inputDeviceInfos); } -void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - if (debugInboundEventDetails()) { - ALOGD("notifyConfigurationChanged - eventTime=%" PRId64, args.eventTime); - } - - bool needWake = false; - { // acquire lock - std::scoped_lock _l(mLock); - - std::unique_ptr<ConfigurationChangedEntry> newEntry = - std::make_unique<ConfigurationChangedEntry>(args.id, args.eventTime); - needWake = enqueueInboundEventLocked(std::move(newEntry)); - } // release lock - - if (needWake) { - mLooper->wake(); - } -} - void InputDispatcher::notifyKey(const NotifyKeyArgs& args) { ALOGD_IF(debugInboundEventDetails(), "notifyKey - id=%" PRIx32 ", eventTime=%" PRId64 diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h index 212522661c..b2d5274515 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.h +++ b/services/inputflinger/dispatcher/InputDispatcher.h @@ -97,7 +97,6 @@ public: status_t stop() override; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; void notifySwitch(const NotifySwitchArgs& args) override; @@ -447,8 +446,6 @@ private: REQUIRES(mLock); // Dispatch inbound events. - bool dispatchConfigurationChangedLocked(nsecs_t currentTime, - const ConfigurationChangedEntry& entry) REQUIRES(mLock); bool dispatchDeviceResetLocked(nsecs_t currentTime, const DeviceResetEntry& entry) REQUIRES(mLock); bool dispatchKeyLocked(nsecs_t currentTime, std::shared_ptr<const KeyEntry> entry, diff --git a/services/inputflinger/include/InputListener.h b/services/inputflinger/include/InputListener.h index 0b7f7c2831..d8a9afaedd 100644 --- a/services/inputflinger/include/InputListener.h +++ b/services/inputflinger/include/InputListener.h @@ -38,7 +38,6 @@ public: virtual ~InputListenerInterface() { } virtual void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) = 0; - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) = 0; virtual void notifyKey(const NotifyKeyArgs& args) = 0; virtual void notifyMotion(const NotifyMotionArgs& args) = 0; virtual void notifySwitch(const NotifySwitchArgs& args) = 0; @@ -60,7 +59,6 @@ public: explicit QueuedInputListener(InputListenerInterface& innerListener); virtual void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; virtual void notifyKey(const NotifyKeyArgs& args) override; virtual void notifyMotion(const NotifyMotionArgs& args) override; virtual void notifySwitch(const NotifySwitchArgs& args) override; @@ -84,7 +82,6 @@ public: explicit TracedInputListener(const char* name, InputListenerInterface& innerListener); virtual void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; virtual void notifyKey(const NotifyKeyArgs& args) override; virtual void notifyMotion(const NotifyMotionArgs& args) override; virtual void notifySwitch(const NotifySwitchArgs& args) override; diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h index 35519d1eb2..42a03c10ca 100644 --- a/services/inputflinger/include/InputReaderBase.h +++ b/services/inputflinger/include/InputReaderBase.h @@ -454,9 +454,6 @@ public: */ virtual void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) = 0; - /* Notifies the system that a configuration change has occurred. */ - virtual void notifyConfigurationChanged(nsecs_t when) = 0; - /* Gets the keyboard layout for a particular input device. */ virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay( const InputDeviceIdentifier& identifier, diff --git a/services/inputflinger/include/NotifyArgs.h b/services/inputflinger/include/NotifyArgs.h index db417cf830..14487fe04e 100644 --- a/services/inputflinger/include/NotifyArgs.h +++ b/services/inputflinger/include/NotifyArgs.h @@ -39,21 +39,6 @@ struct NotifyInputDevicesChangedArgs { NotifyInputDevicesChangedArgs& operator=(const NotifyInputDevicesChangedArgs&) = default; }; -/* Describes a configuration change event. */ -struct NotifyConfigurationChangedArgs { - int32_t id; - nsecs_t eventTime; - - inline NotifyConfigurationChangedArgs() {} - - NotifyConfigurationChangedArgs(int32_t id, nsecs_t eventTime); - - bool operator==(const NotifyConfigurationChangedArgs& rhs) const = default; - - NotifyConfigurationChangedArgs(const NotifyConfigurationChangedArgs& other) = default; - NotifyConfigurationChangedArgs& operator=(const NotifyConfigurationChangedArgs&) = default; -}; - /* Describes a key event. */ struct NotifyKeyArgs { int32_t id; @@ -234,8 +219,8 @@ struct NotifyVibratorStateArgs { }; using NotifyArgs = - std::variant<NotifyInputDevicesChangedArgs, NotifyConfigurationChangedArgs, NotifyKeyArgs, - NotifyMotionArgs, NotifySensorArgs, NotifySwitchArgs, NotifyDeviceResetArgs, + std::variant<NotifyInputDevicesChangedArgs, NotifyKeyArgs, NotifyMotionArgs, + NotifySensorArgs, NotifySwitchArgs, NotifyDeviceResetArgs, NotifyPointerCaptureChangedArgs, NotifyVibratorStateArgs>; const char* toString(const NotifyArgs& args); diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp index 938158069b..e11adb8c76 100644 --- a/services/inputflinger/reader/EventHub.cpp +++ b/services/inputflinger/reader/EventHub.cpp @@ -888,7 +888,6 @@ EventHub::EventHub(void) : mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1), mControllerNumbers(), - mNeedToSendFinishedDeviceScan(false), mNeedToReopenDevices(false), mNeedToScanDevices(true), mPendingEventCount(0), @@ -1877,7 +1876,6 @@ std::vector<RawEvent> EventHub::getEvents(int timeoutMillis) { .type = DEVICE_REMOVED, }); it = mClosingDevices.erase(it); - mNeedToSendFinishedDeviceScan = true; if (events.size() == EVENT_BUFFER_SIZE) { break; } @@ -1886,7 +1884,6 @@ std::vector<RawEvent> EventHub::getEvents(int timeoutMillis) { if (mNeedToScanDevices) { mNeedToScanDevices = false; scanDevicesLocked(); - mNeedToSendFinishedDeviceScan = true; } while (!mOpeningDevices.empty()) { @@ -1915,18 +1912,6 @@ std::vector<RawEvent> EventHub::getEvents(int timeoutMillis) { if (!inserted) { ALOGW("Device id %d exists, replaced.", device->id); } - mNeedToSendFinishedDeviceScan = true; - if (events.size() == EVENT_BUFFER_SIZE) { - break; - } - } - - if (mNeedToSendFinishedDeviceScan) { - mNeedToSendFinishedDeviceScan = false; - events.push_back({ - .when = now, - .type = FINISHED_DEVICE_SCAN, - }); if (events.size() == EVENT_BUFFER_SIZE) { break; } diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp index 9e9e816c0c..f0e53b5464 100644 --- a/services/inputflinger/reader/InputReader.cpp +++ b/services/inputflinger/reader/InputReader.cpp @@ -180,6 +180,9 @@ void InputReader::loopOnce() { } if (oldGeneration != mGeneration) { + // Reset global meta state because it depends on connected input devices. + updateGlobalMetaStateLocked(); + inputDevicesChanged = true; inputDevices = getInputDevicesLocked(); mPendingArgs.emplace_back( @@ -212,15 +215,6 @@ void InputReader::loopOnce() { mPolicy->notifyInputDevicesChanged(inputDevices); } - // Notify the policy of configuration change. This must be after policy is notified about input - // device changes so that policy can fetch newly added input devices on configuration change. - for (const auto& args : notifyArgs) { - const auto* configArgs = std::get_if<NotifyConfigurationChangedArgs>(&args); - if (configArgs != nullptr) { - mPolicy->notifyConfigurationChanged(configArgs->eventTime); - } - } - // Notify the policy of the start of every new stylus gesture. for (const auto& args : notifyArgs) { const auto* motionArgs = std::get_if<NotifyMotionArgs>(&args); @@ -256,9 +250,6 @@ std::list<NotifyArgs> InputReader::processEventsLocked(const RawEvent* rawEvents case EventHubInterface::DEVICE_REMOVED: removeDeviceLocked(rawEvent->when, rawEvent->deviceId); break; - case EventHubInterface::FINISHED_DEVICE_SCAN: - handleConfigurationChangedLocked(rawEvent->when); - break; default: ALOG_ASSERT(false); // can't happen break; @@ -423,14 +414,6 @@ int32_t InputReader::nextInputDeviceIdLocked() { return ++mNextInputDeviceId; } -void InputReader::handleConfigurationChangedLocked(nsecs_t when) { - // Reset global meta state because it depends on the list of all configured devices. - updateGlobalMetaStateLocked(); - - // Enqueue configuration changed. - mPendingArgs.emplace_back(NotifyConfigurationChangedArgs{mContext.getNextId(), when}); -} - void InputReader::refreshConfigurationLocked(ConfigurationChanges changes) { mPolicy->getReaderConfiguration(&mConfig); mEventHub->setExcludedDevices(mConfig.excludedDeviceNames); diff --git a/services/inputflinger/reader/include/EventHub.h b/services/inputflinger/reader/include/EventHub.h index c647558c9f..657126a825 100644 --- a/services/inputflinger/reader/include/EventHub.h +++ b/services/inputflinger/reader/include/EventHub.h @@ -254,9 +254,6 @@ public: DEVICE_ADDED = 0x10000000, // Sent when a device is removed. DEVICE_REMOVED = 0x20000000, - // Sent when all added/removed devices from the most recent scan have been reported. - // This event is always sent at least once. - FINISHED_DEVICE_SCAN = 0x30000000, FIRST_SYNTHETIC_EVENT = DEVICE_ADDED, }; @@ -789,7 +786,6 @@ private: std::vector<std::unique_ptr<Device>> mOpeningDevices; std::vector<std::unique_ptr<Device>> mClosingDevices; - bool mNeedToSendFinishedDeviceScan; bool mNeedToReopenDevices; bool mNeedToScanDevices; std::vector<std::string> mExcludedDevices; diff --git a/services/inputflinger/reader/include/InputReader.h b/services/inputflinger/reader/include/InputReader.h index 03ca840b9f..4f60a8a50f 100644 --- a/services/inputflinger/reader/include/InputReader.h +++ b/services/inputflinger/reader/include/InputReader.h @@ -221,8 +221,6 @@ private: size_t count) REQUIRES(mLock); [[nodiscard]] std::list<NotifyArgs> timeoutExpiredLocked(nsecs_t when) REQUIRES(mLock); - void handleConfigurationChangedLocked(nsecs_t when) REQUIRES(mLock); - int32_t mGlobalMetaState GUARDED_BY(mLock); void updateGlobalMetaStateLocked() REQUIRES(mLock); int32_t getGlobalMetaStateLocked() REQUIRES(mLock); diff --git a/services/inputflinger/tests/EventHub_test.cpp b/services/inputflinger/tests/EventHub_test.cpp index 2e296daa22..0e3d15a1ac 100644 --- a/services/inputflinger/tests/EventHub_test.cpp +++ b/services/inputflinger/tests/EventHub_test.cpp @@ -48,9 +48,6 @@ static void dumpEvents(const std::vector<RawEvent>& events) { case EventHubInterface::DEVICE_REMOVED: ALOGI("Device removed: %i", event.deviceId); break; - case EventHubInterface::FINISHED_DEVICE_SCAN: - ALOGI("Finished device scan."); - break; } } else { ALOGI("Device %" PRId32 " : time = %" PRId64 ", type %i, code %i, value %i", @@ -145,15 +142,13 @@ void EventHubTest::consumeInitialDeviceAddedEvents() { // None of the existing system devices should be changing while this test is run. // Check that the returned device ids are unique for all of the existing devices. EXPECT_EQ(existingDevices.size(), events.size() - 1); - // The last event should be "finished device scan" - EXPECT_EQ(EventHubInterface::FINISHED_DEVICE_SCAN, events[events.size() - 1].type); } int32_t EventHubTest::waitForDeviceCreation() { // Wait a little longer than usual, to ensure input device has time to be created std::vector<RawEvent> events = getEvents(2); - if (events.size() != 2) { - ADD_FAILURE() << "Instead of 2 events, received " << events.size(); + if (events.size() != 1) { + ADD_FAILURE() << "Instead of 1 event, received " << events.size(); return 0; // this value is unused } const RawEvent& deviceAddedEvent = events[0]; @@ -161,21 +156,15 @@ int32_t EventHubTest::waitForDeviceCreation() { InputDeviceIdentifier identifier = mEventHub->getDeviceIdentifier(deviceAddedEvent.deviceId); const int32_t deviceId = deviceAddedEvent.deviceId; EXPECT_EQ(identifier.name, mKeyboard->getName()); - const RawEvent& finishedDeviceScanEvent = events[1]; - EXPECT_EQ(static_cast<int32_t>(EventHubInterface::FINISHED_DEVICE_SCAN), - finishedDeviceScanEvent.type); return deviceId; } void EventHubTest::waitForDeviceClose(int32_t deviceId) { std::vector<RawEvent> events = getEvents(2); - ASSERT_EQ(2U, events.size()); + ASSERT_EQ(1U, events.size()); const RawEvent& deviceRemovedEvent = events[0]; EXPECT_EQ(static_cast<int32_t>(EventHubInterface::DEVICE_REMOVED), deviceRemovedEvent.type); EXPECT_EQ(deviceId, deviceRemovedEvent.deviceId); - const RawEvent& finishedDeviceScanEvent = events[1]; - EXPECT_EQ(static_cast<int32_t>(EventHubInterface::FINISHED_DEVICE_SCAN), - finishedDeviceScanEvent.type); } void EventHubTest::assertNoMoreEvents() { diff --git a/services/inputflinger/tests/FakeEventHub.cpp b/services/inputflinger/tests/FakeEventHub.cpp index 7079278a90..31fbf209a3 100644 --- a/services/inputflinger/tests/FakeEventHub.cpp +++ b/services/inputflinger/tests/FakeEventHub.cpp @@ -88,10 +88,6 @@ status_t FakeEventHub::disableDevice(int32_t deviceId) { return device->disable(); } -void FakeEventHub::finishDeviceScan() { - enqueueEvent(ARBITRARY_TIME, READ_TIME, 0, EventHubInterface::FINISHED_DEVICE_SCAN, 0, 0); -} - void FakeEventHub::addConfigurationProperty(int32_t deviceId, const char* key, const char* value) { getDevice(deviceId)->configuration.addProperty(key, value); } diff --git a/services/inputflinger/tests/FakeEventHub.h b/services/inputflinger/tests/FakeEventHub.h index c2c875f518..3d8dddd532 100644 --- a/services/inputflinger/tests/FakeEventHub.h +++ b/services/inputflinger/tests/FakeEventHub.h @@ -112,8 +112,6 @@ public: status_t enableDevice(int32_t deviceId) override; status_t disableDevice(int32_t deviceId) override; - void finishDeviceScan(); - void addConfigurationProperty(int32_t deviceId, const char* key, const char* value); void addConfigurationMap(int32_t deviceId, const PropertyMap* configuration); diff --git a/services/inputflinger/tests/FakeInputReaderPolicy.cpp b/services/inputflinger/tests/FakeInputReaderPolicy.cpp index 56a8918b96..6099c91daf 100644 --- a/services/inputflinger/tests/FakeInputReaderPolicy.cpp +++ b/services/inputflinger/tests/FakeInputReaderPolicy.cpp @@ -65,23 +65,6 @@ void FakeInputReaderPolicy::assertStylusGestureNotNotified() { 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); @@ -251,12 +234,6 @@ void FakeInputReaderPolicy::notifyInputDevicesChanged( 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; diff --git a/services/inputflinger/tests/FakeInputReaderPolicy.h b/services/inputflinger/tests/FakeInputReaderPolicy.h index ea6e7f2a88..94f1311a1e 100644 --- a/services/inputflinger/tests/FakeInputReaderPolicy.h +++ b/services/inputflinger/tests/FakeInputReaderPolicy.h @@ -42,8 +42,6 @@ public: void assertInputDevicesNotChanged(); void assertStylusGestureNotified(int32_t deviceId); void assertStylusGestureNotNotified(); - void assertConfigurationChanged(); - void assertConfigurationNotChanged(); virtual void clearViewports(); std::optional<DisplayViewport> getDisplayViewportByUniqueId(const std::string& uniqueId) const; @@ -84,7 +82,6 @@ public: private: void getReaderConfiguration(InputReaderConfiguration* outConfig) override; void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) override; - void notifyConfigurationChanged(nsecs_t when) override; std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay( const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) override; std::string getDeviceAlias(const InputDeviceIdentifier&) override; @@ -93,12 +90,10 @@ private: mutable std::mutex mLock; std::condition_variable mDevicesChangedCondition; - std::condition_variable mConfigurationChangedCondition; InputReaderConfiguration mConfig; std::vector<InputDeviceInfo> mInputDevices GUARDED_BY(mLock); bool mInputDevicesChanged GUARDED_BY(mLock){false}; - bool mConfigurationChanged GUARDED_BY(mLock){false}; std::vector<DisplayViewport> mViewports; TouchAffineTransformation transform; bool mIsInputMethodConnectionActive{false}; diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp index 4e662d4b5e..93caad362f 100644 --- a/services/inputflinger/tests/InputDispatcher_test.cpp +++ b/services/inputflinger/tests/InputDispatcher_test.cpp @@ -411,8 +411,6 @@ TEST_F(InputDispatcherTest, InjectInputEvent_ValidatesMotionEvents) { << "Should reject motion events with duplicate pointer ids."; } -/* Test InputDispatcher for notifyConfigurationChanged and notifySwitch events */ - TEST_F(InputDispatcherTest, NotifySwitch_CallsPolicy) { NotifySwitchArgs args(InputEvent::nextId(), /*eventTime=*/20, /*policyFlags=*/0, /*switchValues=*/1, diff --git a/services/inputflinger/tests/InputProcessor_test.cpp b/services/inputflinger/tests/InputProcessor_test.cpp index f7e5e6783b..d4c5a009a6 100644 --- a/services/inputflinger/tests/InputProcessor_test.cpp +++ b/services/inputflinger/tests/InputProcessor_test.cpp @@ -63,20 +63,6 @@ protected: void SetUp() override { mProcessor = std::make_unique<InputProcessor>(mTestListener); } }; -/** - * Create a basic configuration change and send it to input processor. - * Expect that the event is received by the next input stage, unmodified. - */ -TEST_F(InputProcessorTest, SendToNextStage_NotifyConfigurationChangedArgs) { - // Create a basic configuration change and send to processor - NotifyConfigurationChangedArgs args(/*sequenceNum=*/1, /*eventTime=*/2); - - mProcessor->notifyConfigurationChanged(args); - NotifyConfigurationChangedArgs outArgs; - ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifyConfigurationChangedWasCalled(&outArgs)); - ASSERT_EQ(args, outArgs); -} - TEST_F(InputProcessorTest, SendToNextStage_NotifyKeyArgs) { // Create a basic key event and send to processor NotifyKeyArgs args(/*sequenceNum=*/1, /*eventTime=*/2, /*readTime=*/21, /*deviceId=*/3, diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp index 1ba79a9c71..9bbc44aa36 100644 --- a/services/inputflinger/tests/InputReader_test.cpp +++ b/services/inputflinger/tests/InputReader_test.cpp @@ -624,7 +624,6 @@ protected: if (configuration) { mFakeEventHub->addConfigurationMap(eventHubId, configuration); } - mFakeEventHub->finishDeviceScan(); mReader->loopOnce(); mReader->loopOnce(); ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged()); @@ -758,8 +757,6 @@ TEST_F(InputReaderTest, WhenEnabledChanges_SendsDeviceResetNotification) { 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 @@ TEST_F(InputReaderTest, WhenEnabledChanges_SendsDeviceResetNotification) { 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 @@ TEST_F(InputReaderTest, MarkSupportedKeyCodes_ForwardsRequestsToMappers) { 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 @@ TEST_F(InputReaderTest, Device_CanDispatchToDisplay) { // 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 @@ TEST_F(InputReaderTest, WhenEnabledChanges_AllSubdevicesAreUpdated) { 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 @@ protected: // 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 @@ TEST_F(InputReaderIntegrationTest, TestInvalidDevice) { // 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 @@ TEST_F(InputReaderIntegrationTest, AddNewDevice) { 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 @@ TEST_F(InputReaderIntegrationTest, AddNewDevice) { keyboard.reset(); ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertInputDevicesChanged()); - ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertConfigurationChanged()); ASSERT_EQ(initialNumDevices, mFakePolicy->getInputDevices().size()); } @@ -1534,21 +1510,14 @@ TEST_F(InputReaderIntegrationTest, SendsEventsToInputListener) { 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 @@ protected: 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 @@ protected: 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 @@ TEST_P(TouchIntegrationTest, ExternalStylusConnectedDuringTouchGesture) { // 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 @@ TEST_P(TouchIntegrationTest, ExternalStylusConnectedDuringTouchGesture) { // 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 @@ private: 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 @@ TEST_F(ExternalStylusIntegrationTest, ExternalStylusConnectionChangesTouchscreen 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 @@ TEST_F(ExternalStylusIntegrationTest, FusedExternalStylusPressureReported) { 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 @@ TEST_F(ExternalStylusIntegrationTest, FusedExternalStylusPressureNotReported) { 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 @@ TEST_F(ExternalStylusIntegrationTest, UnfusedExternalStylus) { // 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); diff --git a/services/inputflinger/tests/PointerChoreographer_test.cpp b/services/inputflinger/tests/PointerChoreographer_test.cpp index 144e723ecb..bd9a9052de 100644 --- a/services/inputflinger/tests/PointerChoreographer_test.cpp +++ b/services/inputflinger/tests/PointerChoreographer_test.cpp @@ -196,7 +196,6 @@ private: TEST_F(PointerChoreographerTest, ForwardsArgsToInnerListener) { const std::vector<NotifyArgs> allArgs{NotifyInputDevicesChangedArgs{}, - NotifyConfigurationChangedArgs{}, KeyArgsBuilder(AKEY_EVENT_ACTION_DOWN, AINPUT_SOURCE_KEYBOARD).build(), MotionArgsBuilder(AMOTION_EVENT_ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN) .pointer(FIRST_TOUCH_POINTER) @@ -214,9 +213,6 @@ TEST_F(PointerChoreographerTest, ForwardsArgsToInnerListener) { [&](const NotifyInputDevicesChangedArgs& args) { mTestListener.assertNotifyInputDevicesChangedWasCalled(); }, - [&](const NotifyConfigurationChangedArgs& args) { - mTestListener.assertNotifyConfigurationChangedWasCalled(); - }, [&](const NotifyKeyArgs& args) { mTestListener.assertNotifyKeyWasCalled(); }, diff --git a/services/inputflinger/tests/TestInputListener.cpp b/services/inputflinger/tests/TestInputListener.cpp index 41e250f789..369f9cc7cb 100644 --- a/services/inputflinger/tests/TestInputListener.cpp +++ b/services/inputflinger/tests/TestInputListener.cpp @@ -37,19 +37,6 @@ void TestInputListener::assertNotifyInputDevicesChangedWasCalled( "to have been called.")); } -void TestInputListener::assertNotifyConfigurationChangedWasCalled( - NotifyConfigurationChangedArgs* outEventArgs) { - ASSERT_NO_FATAL_FAILURE( - assertCalled<NotifyConfigurationChangedArgs>(outEventArgs, - "Expected notifyConfigurationChanged() " - "to have been called.")); -} - -void TestInputListener::assertNotifyConfigurationChangedWasNotCalled() { - ASSERT_NO_FATAL_FAILURE(assertNotCalled<NotifyConfigurationChangedArgs>( - "notifyConfigurationChanged() should not be called.")); -} - void TestInputListener::assertNotifyDeviceResetWasCalled(NotifyDeviceResetArgs* outEventArgs) { ASSERT_NO_FATAL_FAILURE( assertCalled< @@ -192,10 +179,6 @@ void TestInputListener::notifyInputDevicesChanged(const NotifyInputDevicesChange addToQueue<NotifyInputDevicesChangedArgs>(args); } -void TestInputListener::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { - addToQueue<NotifyConfigurationChangedArgs>(args); -} - void TestInputListener::notifyDeviceReset(const NotifyDeviceResetArgs& args) { addToQueue<NotifyDeviceResetArgs>(args); } diff --git a/services/inputflinger/tests/TestInputListener.h b/services/inputflinger/tests/TestInputListener.h index 3c5e0146d6..47eae4dd8f 100644 --- a/services/inputflinger/tests/TestInputListener.h +++ b/services/inputflinger/tests/TestInputListener.h @@ -38,11 +38,6 @@ public: void assertNotifyInputDevicesChangedWasCalled( NotifyInputDevicesChangedArgs* outEventArgs = nullptr); - void assertNotifyConfigurationChangedWasCalled( - NotifyConfigurationChangedArgs* outEventArgs = nullptr); - - void assertNotifyConfigurationChangedWasNotCalled(); - void clearNotifyDeviceResetCalls(); void assertNotifyDeviceResetWasCalled(const ::testing::Matcher<NotifyDeviceResetArgs>& matcher); @@ -85,8 +80,6 @@ private: virtual void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; - virtual void notifyDeviceReset(const NotifyDeviceResetArgs& args) override; virtual void notifyKey(const NotifyKeyArgs& args) override; @@ -107,7 +100,6 @@ private: const std::chrono::milliseconds mEventDidNotHappenTimeout; std::tuple<std::vector<NotifyInputDevicesChangedArgs>, // - std::vector<NotifyConfigurationChangedArgs>, // std::vector<NotifyDeviceResetArgs>, // std::vector<NotifyKeyArgs>, // std::vector<NotifyMotionArgs>, // diff --git a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp index 853f628a13..bbb2fc8d38 100644 --- a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp +++ b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp @@ -414,20 +414,6 @@ protected: }; /** - * Create a basic configuration change and send it to input processor. - * Expect that the event is received by the next input stage, unmodified. - */ -TEST_F(UnwantedInteractionBlockerTest, ConfigurationChangedIsPassedToNextListener) { - // Create a basic configuration change and send to blocker - NotifyConfigurationChangedArgs args(/*sequenceNum=*/1, /*eventTime=*/2); - - mBlocker->notifyConfigurationChanged(args); - NotifyConfigurationChangedArgs outArgs; - ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifyConfigurationChangedWasCalled(&outArgs)); - ASSERT_EQ(args, outArgs); -} - -/** * Keys are not handled in 'UnwantedInteractionBlocker' and should be passed * to next stage unmodified. */ diff --git a/services/inputflinger/tests/fuzzers/InputClassifierFuzzer.cpp b/services/inputflinger/tests/fuzzers/InputClassifierFuzzer.cpp index 0b4ac1fe86..46a6189d0f 100644 --- a/services/inputflinger/tests/fuzzers/InputClassifierFuzzer.cpp +++ b/services/inputflinger/tests/fuzzers/InputClassifierFuzzer.cpp @@ -39,12 +39,6 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { while (fdp.remaining_bytes() > 0) { fdp.PickValueInArray<std::function<void()>>({ [&]() -> void { - // SendToNextStage_NotifyConfigurationChangedArgs - mClassifier->notifyConfigurationChanged( - {/*sequenceNum=*/fdp.ConsumeIntegral<int32_t>(), - /*eventTime=*/fdp.ConsumeIntegral<nsecs_t>()}); - }, - [&]() -> void { // SendToNextStage_NotifyKeyArgs const nsecs_t eventTime = fdp.ConsumeIntegralInRange<nsecs_t>(0, diff --git a/services/inputflinger/tests/fuzzers/MapperHelpers.h b/services/inputflinger/tests/fuzzers/MapperHelpers.h index d986b31e9d..fea0d9a1c1 100644 --- a/services/inputflinger/tests/fuzzers/MapperHelpers.h +++ b/services/inputflinger/tests/fuzzers/MapperHelpers.h @@ -32,8 +32,7 @@ constexpr size_t kValidTypes[] = {EV_SW, EV_MSC, EV_REL, android::EventHubInterface::DEVICE_ADDED, - android::EventHubInterface::DEVICE_REMOVED, - android::EventHubInterface::FINISHED_DEVICE_SCAN}; + android::EventHubInterface::DEVICE_REMOVED}; constexpr size_t kValidCodes[] = { SYN_REPORT, @@ -296,7 +295,6 @@ public: } void setTouchAffineTransformation(const TouchAffineTransformation t) { mTransform = t; } void notifyStylusGestureStarted(int32_t, nsecs_t) {} - void notifyConfigurationChanged(nsecs_t) {} bool isInputMethodConnectionActive() override { return mFdp->ConsumeBool(); } std::optional<DisplayViewport> getPointerViewportForAssociatedDisplay( ui::LogicalDisplayId associatedDisplayId) override { @@ -307,7 +305,6 @@ public: class FuzzInputListener : public virtual InputListenerInterface { public: void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override {} - void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override {} void notifyKey(const NotifyKeyArgs& args) override {} void notifyMotion(const NotifyMotionArgs& args) override {} void notifySwitch(const NotifySwitchArgs& args) override {} @@ -346,7 +343,6 @@ public: void updateLedMetaState(int32_t metaState) override{}; int32_t getLedMetaState() override { return mFdp->ConsumeIntegral<int32_t>(); }; void notifyStylusGestureStarted(int32_t, nsecs_t) {} - void notifyConfigurationChanged(nsecs_t) {} void setPreventingTouchpadTaps(bool prevent) override {} bool isPreventingTouchpadTaps() override { return mFdp->ConsumeBool(); }; |