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

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

Merge "Convert #define in Macros.h to bools"

parents 7965f4a1 465e1c06
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -379,21 +379,22 @@ void InputDevice::process(const RawEvent* rawEvents, size_t count) {
    // gamepad button presses are handled by different mappers but they should be dispatched
    // in the order received.
    for (const RawEvent* rawEvent = rawEvents; count != 0; rawEvent++) {
#if DEBUG_RAW_EVENTS
        if (DEBUG_RAW_EVENTS) {
            ALOGD("Input event: device=%d type=0x%04x code=0x%04x value=0x%08x when=%" PRId64,
              rawEvent->deviceId, rawEvent->type, rawEvent->code, rawEvent->value, rawEvent->when);
#endif
                  rawEvent->deviceId, rawEvent->type, rawEvent->code, rawEvent->value,
                  rawEvent->when);
        }

        if (mDropUntilNextSync) {
            if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) {
                mDropUntilNextSync = false;
#if DEBUG_RAW_EVENTS
                if (DEBUG_RAW_EVENTS) {
                    ALOGD("Recovered from input event buffer overrun.");
#endif
                }
            } else {
#if DEBUG_RAW_EVENTS
                if (DEBUG_RAW_EVENTS) {
                    ALOGD("Dropped input event while waiting for next input sync.");
#endif
                }
            }
        } else if (rawEvent->type == EV_SYN && rawEvent->code == SYN_DROPPED) {
            ALOGI("Detected input event buffer overrun for device %s.", getName().c_str());
+6 −6
Original line number Diff line number Diff line
@@ -113,9 +113,9 @@ void InputReader::loopOnce() {
        if (mNextTimeout != LLONG_MAX) {
            nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
            if (now >= mNextTimeout) {
#if DEBUG_RAW_EVENTS
                if (DEBUG_RAW_EVENTS) {
                    ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f);
#endif
                }
                mNextTimeout = LLONG_MAX;
                timeoutExpiredLocked(now);
            }
@@ -155,9 +155,9 @@ void InputReader::processEventsLocked(const RawEvent* rawEvents, size_t count) {
                }
                batchSize += 1;
            }
#if DEBUG_RAW_EVENTS
            if (DEBUG_RAW_EVENTS) {
                ALOGD("BatchSize: %zu Count: %zu", batchSize, count);
#endif
            }
            processEventsForDeviceLocked(deviceId, rawEvent, batchSize);
        } else {
            switch (rawEvent->type) {
+6 −9
Original line number Diff line number Diff line
@@ -22,28 +22,25 @@
//#define LOG_NDEBUG 0

// Log debug messages for each raw event received from the EventHub.
#define DEBUG_RAW_EVENTS 0

// Log debug messages about touch screen filtering hacks.
#define DEBUG_HACKS 0
static constexpr bool DEBUG_RAW_EVENTS = false;

// Log debug messages about virtual key processing.
#define DEBUG_VIRTUAL_KEYS 0
static constexpr bool DEBUG_VIRTUAL_KEYS = false;

// Log debug messages about pointers.
static constexpr bool DEBUG_POINTERS = false;

// Log debug messages about pointer assignment calculations.
#define DEBUG_POINTER_ASSIGNMENT 0
static constexpr bool DEBUG_POINTER_ASSIGNMENT = false;

// Log debug messages about gesture detection.
#define DEBUG_GESTURES 0
static constexpr bool DEBUG_GESTURES = false;

// Log debug messages about the vibrator.
#define DEBUG_VIBRATOR 0
static constexpr bool DEBUG_VIBRATOR = false;

// Log debug messages about fusing stylus data.
#define DEBUG_STYLUS_FUSION 0
static constexpr bool DEBUG_STYLUS_FUSION = false;

#define INDENT "  "
#define INDENT2 "    "
+221 −216

File changed.

Preview size limit exceeded, changes collapsed.

+24 −24
Original line number Diff line number Diff line
@@ -41,10 +41,10 @@ void VibratorInputMapper::process(const RawEvent* rawEvent) {

void VibratorInputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat,
                                  int32_t token) {
#if DEBUG_VIBRATOR
    if (DEBUG_VIBRATOR) {
        ALOGD("vibrate: deviceId=%d, pattern=[%s], repeat=%zd, token=%d", getDeviceId(),
              sequence.toString().c_str(), repeat, token);
#endif
    }

    mVibrating = true;
    mSequence = sequence;
@@ -59,9 +59,9 @@ void VibratorInputMapper::vibrate(const VibrationSequence& sequence, ssize_t rep
}

void VibratorInputMapper::cancelVibrate(int32_t token) {
#if DEBUG_VIBRATOR
    if (DEBUG_VIBRATOR) {
        ALOGD("cancelVibrate: deviceId=%d, token=%d", getDeviceId(), token);
#endif
    }

    if (mVibrating && mToken == token) {
        stopVibrating();
@@ -87,9 +87,9 @@ void VibratorInputMapper::timeoutExpired(nsecs_t when) {
}

void VibratorInputMapper::nextStep() {
#if DEBUG_VIBRATOR
    if (DEBUG_VIBRATOR) {
        ALOGD("nextStep: index=%d, vibrate deviceId=%d", (int)mIndex, getDeviceId());
#endif
    }
    mIndex += 1;
    if (size_t(mIndex) >= mSequence.pattern.size()) {
        if (mRepeat < 0) {
@@ -102,16 +102,16 @@ void VibratorInputMapper::nextStep() {

    const VibrationElement& element = mSequence.pattern[mIndex];
    if (element.isOn()) {
#if DEBUG_VIBRATOR
        if (DEBUG_VIBRATOR) {
            std::string description = element.toString();
            ALOGD("nextStep: sending vibrate deviceId=%d, element=%s", getDeviceId(),
                  description.c_str());
#endif
        }
        getDeviceContext().vibrate(element);
    } else {
#if DEBUG_VIBRATOR
        if (DEBUG_VIBRATOR) {
            ALOGD("nextStep: sending cancel vibrate deviceId=%d", getDeviceId());
#endif
        }
        getDeviceContext().cancelVibrate();
    }
    nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
@@ -119,16 +119,16 @@ void VibratorInputMapper::nextStep() {
            std::chrono::duration_cast<std::chrono::nanoseconds>(element.duration);
    mNextStepTime = now + duration.count();
    getContext()->requestTimeoutAtTime(mNextStepTime);
#if DEBUG_VIBRATOR
    if (DEBUG_VIBRATOR) {
        ALOGD("nextStep: scheduled timeout in %lldms", element.duration.count());
#endif
    }
}

void VibratorInputMapper::stopVibrating() {
    mVibrating = false;
#if DEBUG_VIBRATOR
    if (DEBUG_VIBRATOR) {
        ALOGD("stopVibrating: sending cancel vibrate deviceId=%d", getDeviceId());
#endif
    }
    getDeviceContext().cancelVibrate();

    // Request InputReader to notify InputManagerService for vibration complete.