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

Commit 7b3c2125 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Android (Google) Code Review
Browse files

Merge "Remove __linux__ ifdefs where not needed" into main

parents c06a3b6c b58c0c31
Loading
Loading
Loading
Loading
+2 −18
Original line number Original line Diff line number Diff line
@@ -41,13 +41,11 @@
 * Additional private constants not defined in ndk/ui/input.h.
 * Additional private constants not defined in ndk/ui/input.h.
 */
 */
enum {
enum {
#ifdef __linux__

    /* This event was generated or modified by accessibility service. */
    /* This event was generated or modified by accessibility service. */
    AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
    AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
            android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
            android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
#else

    AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800,
#endif
    /* Signifies that the key is being predispatched */
    /* Signifies that the key is being predispatched */
    AKEY_EVENT_FLAG_PREDISPATCH = 0x20000000,
    AKEY_EVENT_FLAG_PREDISPATCH = 0x20000000,


@@ -90,15 +88,11 @@ enum {
    AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE =
    AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE =
            android::os::IInputConstants::MOTION_EVENT_FLAG_NO_FOCUS_CHANGE,
            android::os::IInputConstants::MOTION_EVENT_FLAG_NO_FOCUS_CHANGE,


#if defined(__linux__)
    /**
    /**
     * This event was generated or modified by accessibility service.
     * This event was generated or modified by accessibility service.
     */
     */
    AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
    AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
            android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
            android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
#else
    AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800,
#endif


    AMOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS =
    AMOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS =
            android::os::IInputConstants::MOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS,
            android::os::IInputConstants::MOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS,
@@ -204,9 +198,7 @@ struct AInputDevice {


namespace android {
namespace android {


#ifdef __linux__
class Parcel;
class Parcel;
#endif


/*
/*
 * Apply the given transform to the point without applying any translation/offset.
 * Apply the given transform to the point without applying any translation/offset.
@@ -312,12 +304,8 @@ enum {


    POLICY_FLAG_RAW_MASK = 0x0000ffff,
    POLICY_FLAG_RAW_MASK = 0x0000ffff,


#ifdef __linux__
    POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY =
    POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY =
            android::os::IInputConstants::POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY,
            android::os::IInputConstants::POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY,
#else
    POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY = 0x20000,
#endif


    /* These flags are set by the input dispatcher. */
    /* These flags are set by the input dispatcher. */


@@ -486,10 +474,8 @@ struct PointerCoords {


    vec2 getXYValue() const { return vec2(getX(), getY()); }
    vec2 getXYValue() const { return vec2(getX(), getY()); }


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


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


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


    static bool isTouchEvent(uint32_t source, int32_t action);
    static bool isTouchEvent(uint32_t source, int32_t action);
    inline bool isTouchEvent() const {
    inline bool isTouchEvent() const {
+0 −4
Original line number Original line Diff line number Diff line
@@ -19,9 +19,7 @@
#include <stdint.h>
#include <stdint.h>
#include <list>
#include <list>


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


#include <android-base/result.h>
#include <android-base/result.h>
#include <input/Input.h>
#include <input/Input.h>
@@ -144,13 +142,11 @@ public:
    std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode,
    std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode,
                                                                           int32_t metaState) const;
                                                                           int32_t metaState) const;


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


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


    bool operator==(const KeyCharacterMap& other) const = default;
    bool operator==(const KeyCharacterMap& other) const = default;


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


#ifdef __linux__
#include <binder/Parcel.h>
#include <binder/Parcel.h>
#endif
#if defined(__ANDROID__)
#if defined(__ANDROID__)
#include <sys/random.h>
#include <sys/random.h>
#endif
#endif
@@ -483,7 +481,6 @@ void PointerCoords::scale(float globalScaleFactor, float windowXScale, float win
    scaleAxisValue(*this, AMOTION_EVENT_AXIS_RELATIVE_Y, windowYScale);
    scaleAxisValue(*this, AMOTION_EVENT_AXIS_RELATIVE_Y, windowYScale);
}
}


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


@@ -511,7 +508,6 @@ status_t PointerCoords::writeToParcel(Parcel* parcel) const {
    parcel->writeBool(isResampled);
    parcel->writeBool(isResampled);
    return OK;
    return OK;
}
}
#endif


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


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


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


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


#ifdef __linux__
std::unique_ptr<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
std::unique_ptr<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
    if (parcel == nullptr) {
    if (parcel == nullptr) {
        ALOGE("%s: Null parcel", __func__);
        ALOGE("%s: Null parcel", __func__);
@@ -744,7 +741,6 @@ void KeyCharacterMap::writeToParcel(Parcel* parcel) const {
        parcel->writeInt32(toAndroidKeyCode);
        parcel->writeInt32(toAndroidKeyCode);
    }
    }
}
}
#endif // __linux__


// --- KeyCharacterMap::Parser ---
// --- KeyCharacterMap::Parser ---