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

Commit fdfda3c2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add pid to monitor"

parents 60839846 58cfc60c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4932,7 +4932,7 @@ base::Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(
}

base::Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(
        int32_t displayId, bool isGestureMonitor, const std::string& name) {
        int32_t displayId, bool isGestureMonitor, const std::string& name, int32_t pid) {
    std::shared_ptr<InputChannel> serverChannel;
    std::unique_ptr<InputChannel> clientChannel;
    status_t result = openInputChannelPair(name, serverChannel, clientChannel);
@@ -4956,7 +4956,7 @@ base::Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(

        auto& monitorsByDisplay =
                isGestureMonitor ? mGestureMonitorsByDisplay : mGlobalMonitorsByDisplay;
        monitorsByDisplay[displayId].emplace_back(serverChannel);
        monitorsByDisplay[displayId].emplace_back(serverChannel, pid);

        mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this);
    }
+4 −2
Original line number Diff line number Diff line
@@ -124,8 +124,10 @@ public:
    virtual base::Result<std::unique_ptr<InputChannel>> createInputChannel(
            const std::string& name) override;
    virtual void setFocusedWindow(const FocusRequest&) override;
    virtual base::Result<std::unique_ptr<InputChannel>> createInputMonitor(
            int32_t displayId, bool isGestureMonitor, const std::string& name) override;
    virtual base::Result<std::unique_ptr<InputChannel>> createInputMonitor(int32_t displayId,
                                                                           bool isGestureMonitor,
                                                                           const std::string& name,
                                                                           int32_t pid) override;
    virtual status_t removeInputChannel(const sp<IBinder>& connectionToken) override;
    virtual status_t pilferPointers(const sp<IBinder>& token) override;
    virtual void requestPointerCapture(const sp<IBinder>& windowToken, bool enabled) override;
+2 −1
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@
namespace android::inputdispatcher {

// --- Monitor ---
Monitor::Monitor(const std::shared_ptr<InputChannel>& inputChannel) : inputChannel(inputChannel) {}
Monitor::Monitor(const std::shared_ptr<InputChannel>& inputChannel, int32_t pid)
      : inputChannel(inputChannel), pid(pid) {}

// --- TouchedMonitor ---
TouchedMonitor::TouchedMonitor(const Monitor& monitor, float xOffset, float yOffset)
+3 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ namespace android::inputdispatcher {
struct Monitor {
    std::shared_ptr<InputChannel> inputChannel; // never null

    explicit Monitor(const std::shared_ptr<InputChannel>& inputChannel);
    int32_t pid;

    explicit Monitor(const std::shared_ptr<InputChannel>& inputChannel, int32_t pid);
};

// For tracking the offsets we need to apply when adding gesture monitor targets.
+4 −2
Original line number Diff line number Diff line
@@ -173,8 +173,10 @@ public:
     *
     * This method may be called on any thread (usually by the input manager).
     */
    virtual base::Result<std::unique_ptr<InputChannel>> createInputMonitor(
            int32_t displayId, bool gestureMonitor, const std::string& name) = 0;
    virtual base::Result<std::unique_ptr<InputChannel>> createInputMonitor(int32_t displayId,
                                                                           bool gestureMonitor,
                                                                           const std::string& name,
                                                                           int32_t pid) = 0;

    /* Removes input channels that will no longer receive input events.
     *
Loading