Loading include/input/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -730,7 +730,7 @@ public: static const char* getLabel(int32_t axis); static int32_t getAxisFromLabel(const char* label); static const char* actionToString(int32_t action); static std::string actionToString(int32_t action); protected: int32_t mAction; Loading libs/input/Input.cpp +23 −5 Original line number Diff line number Diff line Loading @@ -19,9 +19,11 @@ #include <attestation/HmacKeyManager.h> #include <cutils/compiler.h> #include <inttypes.h> #include <limits.h> #include <string.h> #include <android-base/stringprintf.h> #include <input/Input.h> #include <input/InputDevice.h> #include <input/InputEventLabels.h> Loading @@ -31,6 +33,8 @@ #include <sys/random.h> #endif using android::base::StringPrintf; namespace android { const char* motionClassificationToString(MotionClassification classification) { Loading Loading @@ -700,23 +704,37 @@ int32_t MotionEvent::getAxisFromLabel(const char* label) { return InputEventLookup::getAxisByLabel(label); } const char* MotionEvent::actionToString(int32_t action) { std::string MotionEvent::actionToString(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_MOVE: return "MOVE"; case AMOTION_EVENT_ACTION_CANCEL: return "CANCEL"; case AMOTION_EVENT_ACTION_OUTSIDE: return "OUTSIDE"; case AMOTION_EVENT_ACTION_POINTER_DOWN: return "POINTER_DOWN"; case AMOTION_EVENT_ACTION_POINTER_UP: return "POINTER_UP"; } return "UNKNOWN"; case AMOTION_EVENT_ACTION_HOVER_MOVE: return "HOVER_MOVE"; case AMOTION_EVENT_ACTION_SCROLL: return "SCROLL"; case AMOTION_EVENT_ACTION_HOVER_ENTER: return "HOVER_ENTER"; case AMOTION_EVENT_ACTION_HOVER_EXIT: return "HOVER_EXIT"; case AMOTION_EVENT_ACTION_BUTTON_PRESS: return "BUTTON_PRESS"; case AMOTION_EVENT_ACTION_BUTTON_RELEASE: return "BUTTON_RELEASE"; } return android::base::StringPrintf("%" PRId32, action); } // --- FocusEvent --- Loading services/inputflinger/dispatcher/Entry.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -207,10 +207,10 @@ std::string MotionEntry::getDescription() const { "buttonState=0x%08x, " "classification=%s, edgeFlags=0x%08x, xPrecision=%.1f, yPrecision=%.1f, " "xCursorPosition=%0.1f, yCursorPosition=%0.1f, pointers=[", deviceId, eventTime, source, displayId, MotionEvent::actionToString(action), actionButton, flags, metaState, buttonState, motionClassificationToString(classification), edgeFlags, xPrecision, yPrecision, xCursorPosition, yCursorPosition); deviceId, eventTime, source, displayId, MotionEvent::actionToString(action).c_str(), actionButton, flags, metaState, buttonState, motionClassificationToString(classification), edgeFlags, xPrecision, yPrecision, xCursorPosition, yCursorPosition); for (uint32_t i = 0; i < pointerCount; i++) { if (i) { Loading Loading
include/input/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -730,7 +730,7 @@ public: static const char* getLabel(int32_t axis); static int32_t getAxisFromLabel(const char* label); static const char* actionToString(int32_t action); static std::string actionToString(int32_t action); protected: int32_t mAction; Loading
libs/input/Input.cpp +23 −5 Original line number Diff line number Diff line Loading @@ -19,9 +19,11 @@ #include <attestation/HmacKeyManager.h> #include <cutils/compiler.h> #include <inttypes.h> #include <limits.h> #include <string.h> #include <android-base/stringprintf.h> #include <input/Input.h> #include <input/InputDevice.h> #include <input/InputEventLabels.h> Loading @@ -31,6 +33,8 @@ #include <sys/random.h> #endif using android::base::StringPrintf; namespace android { const char* motionClassificationToString(MotionClassification classification) { Loading Loading @@ -700,23 +704,37 @@ int32_t MotionEvent::getAxisFromLabel(const char* label) { return InputEventLookup::getAxisByLabel(label); } const char* MotionEvent::actionToString(int32_t action) { std::string MotionEvent::actionToString(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_MOVE: return "MOVE"; case AMOTION_EVENT_ACTION_CANCEL: return "CANCEL"; case AMOTION_EVENT_ACTION_OUTSIDE: return "OUTSIDE"; case AMOTION_EVENT_ACTION_POINTER_DOWN: return "POINTER_DOWN"; case AMOTION_EVENT_ACTION_POINTER_UP: return "POINTER_UP"; } return "UNKNOWN"; case AMOTION_EVENT_ACTION_HOVER_MOVE: return "HOVER_MOVE"; case AMOTION_EVENT_ACTION_SCROLL: return "SCROLL"; case AMOTION_EVENT_ACTION_HOVER_ENTER: return "HOVER_ENTER"; case AMOTION_EVENT_ACTION_HOVER_EXIT: return "HOVER_EXIT"; case AMOTION_EVENT_ACTION_BUTTON_PRESS: return "BUTTON_PRESS"; case AMOTION_EVENT_ACTION_BUTTON_RELEASE: return "BUTTON_RELEASE"; } return android::base::StringPrintf("%" PRId32, action); } // --- FocusEvent --- Loading
services/inputflinger/dispatcher/Entry.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -207,10 +207,10 @@ std::string MotionEntry::getDescription() const { "buttonState=0x%08x, " "classification=%s, edgeFlags=0x%08x, xPrecision=%.1f, yPrecision=%.1f, " "xCursorPosition=%0.1f, yCursorPosition=%0.1f, pointers=[", deviceId, eventTime, source, displayId, MotionEvent::actionToString(action), actionButton, flags, metaState, buttonState, motionClassificationToString(classification), edgeFlags, xPrecision, yPrecision, xCursorPosition, yCursorPosition); deviceId, eventTime, source, displayId, MotionEvent::actionToString(action).c_str(), actionButton, flags, metaState, buttonState, motionClassificationToString(classification), edgeFlags, xPrecision, yPrecision, xCursorPosition, yCursorPosition); for (uint32_t i = 0; i < pointerCount; i++) { if (i) { Loading