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

Commit 4b408beb authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

InputTracer: Don't make WindowDispatchArgs an inner class

For consistency with other structs and definitions in the backend
interface, move WindowDispatchArgs outside of the interface class.

Bug: 210460522
Test: atest inputflinger_tests
Change-Id: I9fe98448bace259faa40b082981211fdf9b1e221
parent 8c3b143e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -72,8 +72,7 @@ void AndroidInputEventProtoConverter::toProtoKeyEvent(const TracedKeyEvent& even
}

void AndroidInputEventProtoConverter::toProtoWindowDispatchEvent(
        const InputTracingBackendInterface::WindowDispatchArgs& args,
        proto::AndroidWindowInputDispatchEvent& outProto) {
        const WindowDispatchArgs& args, proto::AndroidWindowInputDispatchEvent& outProto) {
    std::visit([&](auto entry) { outProto.set_event_id(entry.id); }, args.eventEntry);
    outProto.set_vsync_id(args.vsyncId);
    outProto.set_window_id(args.windowId);
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public:
    static void toProtoMotionEvent(const TracedMotionEvent& event,
                                   proto::AndroidMotionEvent& outProto);
    static void toProtoKeyEvent(const TracedKeyEvent& event, proto::AndroidKeyEvent& outProto);
    static void toProtoWindowDispatchEvent(const InputTracingBackendInterface::WindowDispatchArgs&,
    static void toProtoWindowDispatchEvent(const WindowDispatchArgs&,
                                           proto::AndroidWindowInputDispatchEvent& outProto);
};

+0 −2
Original line number Diff line number Diff line
@@ -52,8 +52,6 @@ public:
private:
    std::unique_ptr<InputTracingBackendInterface> mBackend;

    using WindowDispatchArgs = InputTracingBackendInterface::WindowDispatchArgs;

    // The state of a tracked event, shared across all events derived from the original event.
    struct EventState {
        explicit inline EventState(InputTracer& tracer) : tracer(tracer){};
+14 −12
Original line number Diff line number Diff line
@@ -80,6 +80,20 @@ struct TracedEventArgs {
    bool isSecure;
};

/** Additional information about an input event being dispatched to a window. */
struct WindowDispatchArgs {
    TracedEvent eventEntry;
    nsecs_t deliveryTime;
    int32_t resolvedFlags;
    gui::Uid targetUid;
    int64_t vsyncId;
    int32_t windowId;
    ui::Transform transform;
    ui::Transform rawTransform;
    std::array<uint8_t, 32> hmac;
    int32_t resolvedKeyRepeatCount;
};

/**
 * An interface for the tracing backend, used for setting a custom backend for testing.
 */
@@ -94,18 +108,6 @@ public:
    virtual void traceMotionEvent(const TracedMotionEvent&, const TracedEventArgs&) = 0;

    /** Trace an event being sent to a window. */
    struct WindowDispatchArgs {
        TracedEvent eventEntry;
        nsecs_t deliveryTime;
        int32_t resolvedFlags;
        gui::Uid targetUid;
        int64_t vsyncId;
        int32_t windowId;
        ui::Transform transform;
        ui::Transform rawTransform;
        std::array<uint8_t, 32> hmac;
        int32_t resolvedKeyRepeatCount;
    };
    virtual void traceWindowDispatch(const WindowDispatchArgs&, const TracedEventArgs&) = 0;
};

+0 −2
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ private:
                      TracedEventArgs>;
    std::vector<TraceEntry> mQueue GUARDED_BY(mLock);

    using WindowDispatchArgs = InputTracingBackendInterface::WindowDispatchArgs;

    void threadLoop();
};

Loading