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

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

Merge "Don't leak input events to dumpsys on user builds" into pi-dev

parents 2fd951b6 3b7d7797
Loading
Loading
Loading
Loading
+2 −48
Original line number Original line Diff line number Diff line
@@ -105,36 +105,6 @@ static inline const char* toString(bool value) {
    return value ? "true" : "false";
    return value ? "true" : "false";
}
}


static std::string motionActionToString(int32_t action) {
    // Convert MotionEvent action to string
    switch(action & AMOTION_EVENT_ACTION_MASK) {
        case AMOTION_EVENT_ACTION_DOWN:
            return "DOWN";
        case AMOTION_EVENT_ACTION_MOVE:
            return "MOVE";
        case AMOTION_EVENT_ACTION_UP:
            return "UP";
        case AMOTION_EVENT_ACTION_POINTER_DOWN:
            return "POINTER_DOWN";
        case AMOTION_EVENT_ACTION_POINTER_UP:
            return "POINTER_UP";
    }
    return StringPrintf("%" PRId32, action);
}

static std::string keyActionToString(int32_t action) {
    // Convert KeyEvent action to string
    switch(action) {
        case AKEY_EVENT_ACTION_DOWN:
            return "DOWN";
        case AKEY_EVENT_ACTION_UP:
            return "UP";
        case AKEY_EVENT_ACTION_MULTIPLE:
            return "MULTIPLE";
    }
    return StringPrintf("%" PRId32, action);
}

static inline int32_t getMotionEventActionPointerIndex(int32_t action) {
static inline int32_t getMotionEventActionPointerIndex(int32_t action) {
    return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)
    return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)
            >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
            >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
@@ -4006,11 +3976,7 @@ InputDispatcher::KeyEntry::~KeyEntry() {
}
}


void InputDispatcher::KeyEntry::appendDescription(std::string& msg) const {
void InputDispatcher::KeyEntry::appendDescription(std::string& msg) const {
    msg += StringPrintf("KeyEvent(deviceId=%d, source=0x%08x, action=%s, "
    msg += StringPrintf("KeyEvent");
            "flags=0x%08x, keyCode=%d, scanCode=%d, metaState=0x%08x, "
            "repeatCount=%d), policyFlags=0x%08x",
            deviceId, source, keyActionToString(action).c_str(), flags, keyCode,
            scanCode, metaState, repeatCount, policyFlags);
}
}


void InputDispatcher::KeyEntry::recycle() {
void InputDispatcher::KeyEntry::recycle() {
@@ -4051,19 +4017,7 @@ InputDispatcher::MotionEntry::~MotionEntry() {
}
}


void InputDispatcher::MotionEntry::appendDescription(std::string& msg) const {
void InputDispatcher::MotionEntry::appendDescription(std::string& msg) const {
    msg += StringPrintf("MotionEvent(deviceId=%d, source=0x%08x, action=%s, actionButton=0x%08x, "
    msg += StringPrintf("MotionEvent");
            "flags=0x%08x, metaState=0x%08x, buttonState=0x%08x, "
            "edgeFlags=0x%08x, xPrecision=%.1f, yPrecision=%.1f, displayId=%d, pointers=[",
            deviceId, source, motionActionToString(action).c_str(), actionButton, flags, metaState,
            buttonState, edgeFlags, xPrecision, yPrecision, displayId);
    for (uint32_t i = 0; i < pointerCount; i++) {
        if (i) {
            msg += ", ";
        }
        msg += StringPrintf("%d: (%.1f, %.1f)", pointerProperties[i].id,
                pointerCoords[i].getX(), pointerCoords[i].getY());
    }
    msg += StringPrintf("]), policyFlags=0x%08x", policyFlags);
}
}