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

Commit faa986c0 authored by Brett Chabot's avatar Brett Chabot
Browse files

Fix libinput mac build, hopefully.

Restore the ifdefs removed in go/ag/12549959, but using
ifdef __linux__ instead of __ANDROID__.

Test: m libinput
Bug: 172023026
Change-Id: Iafbf592e7b937b780e5ffc2df490a6c17f5f6cf5
parent a267bd37
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -177,7 +177,9 @@ struct AInputDevice {

namespace android {

#ifdef __linux__
class Parcel;
#endif

const char* inputEventTypeToString(int32_t type);

@@ -344,8 +346,10 @@ struct PointerCoords {
        return getAxisValue(AMOTION_EVENT_AXIS_Y);
    }

#ifdef __linux__
    status_t readFromParcel(Parcel* parcel);
    status_t writeToParcel(Parcel* parcel) const;
#endif

    bool operator==(const PointerCoords& other) const;
    inline bool operator!=(const PointerCoords& other) const {
@@ -704,8 +708,10 @@ public:
    // Matrix is in row-major form and compatible with SkMatrix.
    void transform(const std::array<float, 9>& matrix);

#ifdef __linux__
    status_t readFromParcel(Parcel* parcel);
    status_t writeToParcel(Parcel* parcel) const;
#endif

    static bool isTouchEvent(uint32_t source, int32_t action);
    inline bool isTouchEvent() const {
+4 −0
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@

#include <stdint.h>

#ifdef __linux__
#include <binder/IBinder.h>
#endif

#include <android-base/result.h>
#include <input/Input.h>
@@ -132,11 +134,13 @@ public:
    void tryRemapKey(int32_t scanCode, int32_t metaState,
            int32_t* outKeyCode, int32_t* outMetaState) const;

#ifdef __linux__
    /* Reads a key map from a parcel. */
    static std::shared_ptr<KeyCharacterMap> readFromParcel(Parcel* parcel);

    /* Writes a key map to a parcel. */
    void writeToParcel(Parcel* parcel) const;
#endif

    KeyCharacterMap(const KeyCharacterMap& other);

+6 −0
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@
#include <input/InputDevice.h>
#include <input/InputEventLabels.h>

#ifdef __linux__
#include <binder/Parcel.h>
#endif
#ifdef __ANDROID__
#include <sys/random.h>
#endif
@@ -254,6 +256,7 @@ void PointerCoords::applyOffset(float xOffset, float yOffset) {
    setAxisValue(AMOTION_EVENT_AXIS_Y, getY() + yOffset);
}

#ifdef __linux__
status_t PointerCoords::readFromParcel(Parcel* parcel) {
    bits = parcel->readInt64();

@@ -277,6 +280,7 @@ status_t PointerCoords::writeToParcel(Parcel* parcel) const {
    }
    return OK;
}
#endif

void PointerCoords::tooManyAxes(int axis) {
    ALOGW("Could not set value for axis %d because the PointerCoords structure is full and "
@@ -538,6 +542,7 @@ void MotionEvent::transform(const std::array<float, 9>& matrix) {
    }
}

#ifdef __linux__
static status_t readFromParcel(ui::Transform& transform, const Parcel& parcel) {
    float dsdx, dtdx, tx, dtdy, dsdy, ty;
    status_t status = parcel.readFloat(&dsdx);
@@ -674,6 +679,7 @@ status_t MotionEvent::writeToParcel(Parcel* parcel) const {
    }
    return OK;
}
#endif

bool MotionEvent::isTouchEvent(uint32_t source, int32_t action) {
    if (source & AINPUT_SOURCE_CLASS_POINTER) {
+4 −1
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@
#include <stdlib.h>
#include <string.h>

#ifdef __linux__
#include <binder/Parcel.h>
#endif
#include <android/keycodes.h>
#include <attestation/HmacKeyManager.h>
#include <input/InputEventLabels.h>
@@ -587,6 +589,7 @@ void KeyCharacterMap::addLockedMetaKey(Vector<KeyEvent>& outEvents,
    }
}

#ifdef __linux__
std::shared_ptr<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
    if (parcel == nullptr) {
        ALOGE("%s: Null parcel", __func__);
@@ -672,7 +675,7 @@ void KeyCharacterMap::writeToParcel(Parcel* parcel) const {
        parcel->writeInt32(0);
    }
}

#endif // __linux__

// --- KeyCharacterMap::Key ---