Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb75bc8f authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Verify all injected events

Prior to this CL, we only verified the streams from events injected from
accessibility.

With this CL, we will now verify all injected events, even if they did
not originate from a11y. That means, these events were injected from
tests. For now, we will only log the fact that the stream is
inconsistent, but still let it through. Eventually, we can fail the
injection instead, which will prevent crashes in the dispatcher.

Bug: 329439551
Test: atest inputflinger_tests
Change-Id: Ie7313fd79f614d3347ef7198812be3c810eb86ea
parent 517839c4
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -4885,10 +4885,11 @@ InputEventInjectionResult InputDispatcher::injectInputEvent(const InputEvent* ev

            mLock.lock();

            if (policyFlags & POLICY_FLAG_FILTERED) {
                // The events from InputFilter impersonate real hardware devices. Check these
                // events for consistency and print an error. An inconsistent event sent from
                // InputFilter could cause a crash in the later stages of dispatching pipeline.
            {
                // Verify all injected streams, whether the injection is coming from apps or from
                // input filter. Print an error if the stream becomes inconsistent with this event.
                // An inconsistent injected event sent could cause a crash in the later stages of
                // dispatching pipeline.
                auto [it, _] =
                        mInputFilterVerifiersByDisplay.try_emplace(displayId,
                                                                   std::string("Injection on ") +