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

Commit 3720ed06 authored by Robert Carr's avatar Robert Carr
Browse files

Implement Parcelling functions for InputWindowInfo

In preparation for parcelling across the SurfaceControl interface.
As a dependency we move the parcelling of InputChannels from
frameworks/base JNI code in to InputChannel.h.

Bug: 80101428
Bug: 113136004
Bug: 111440400
Test: None
Change-Id: Ib27f03282e9872274b834bb00737fd351e7a1b30
parent 3fe5ead7
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <utils/BitSet.h>

namespace android {
class Parcel;

/*
 * Intermediate representation used to send input events and related signals.
@@ -143,6 +144,7 @@ protected:
    virtual ~InputChannel();

public:
    InputChannel() = default;
    InputChannel(const std::string& name, int fd);

    /* Creates a pair of input channels.
@@ -183,9 +185,14 @@ public:
    /* Returns a new object that has a duplicate of this channel's fd. */
    sp<InputChannel> dup() const;

    status_t write(Parcel& out) const;
    status_t read(const Parcel& from);

private:
    void setFd(int fd);

    std::string mName;
    int mFd;
    int mFd = -1;
};

/*
+5 −4
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include "InputApplication.h"

namespace android {

class Parcel;

/*
 * Describes the properties of a window that can receive input.
@@ -151,6 +151,9 @@ struct InputWindowInfo {
    bool supportsSplitTouch() const;

    bool overlaps(const InputWindowInfo* other) const;

    status_t write(Parcel& output) const;
    static InputWindowInfo read(const Parcel& from);
};


@@ -168,9 +171,7 @@ public:
        return mInfo;
    }

    inline sp<InputChannel> getInputChannel() const {
        return mInfo ? mInfo->inputChannel : nullptr;
    }
    sp<InputChannel> getInputChannel() const;

    inline std::string getName() const {
        return mInfo ? mInfo->name : "<invalid>";
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ cc_test {
        "libgui",
        "libhidlbase",
        "libhidltransport",
        "libinput",
        "libui",
        "libutils",
        "libnativewindow"
+3 −0
Original line number Diff line number Diff line
@@ -47,11 +47,14 @@ cc_library {
                "InputTransport.cpp",
                "VelocityControl.cpp",
                "VelocityTracker.cpp",
                "InputApplication.cpp",
                "InputWindow.cpp"
            ],

            shared_libs: [
                "libutils",
                "libbinder",
                "libui"
            ],

            sanitize: {
Loading