Loading include/input/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -534,7 +534,7 @@ public: inline int32_t getActionMasked() const { return getActionMasked(mAction); } static int32_t getActionIndex(int32_t action) { static uint8_t getActionIndex(int32_t action) { return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; } Loading services/inputflinger/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ filegroup { srcs: [ "InputClassifier.cpp", "InputClassifierConverter.cpp", "UnwantedInteractionBlocker.cpp", "InputManager.cpp", ], } Loading @@ -60,6 +61,7 @@ cc_defaults { "android.hardware.input.classifier@1.0", "libbase", "libbinder", "libchrome", "libcrypto", "libcutils", "libhidlbase", Loading @@ -76,6 +78,7 @@ cc_defaults { ], static_libs: [ "libattestation", "libpalmrejection", ], } Loading services/inputflinger/InputClassifierConverter.cpp +1 −6 Original line number Diff line number Diff line Loading @@ -325,11 +325,6 @@ static std::vector<common::V1_0::VideoFrame> convertVideoFrames( return out; } static uint8_t getActionIndex(int32_t action) { return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; } static void getHidlPropertiesAndCoords(const NotifyMotionArgs& args, std::vector<common::V1_0::PointerProperties>* outPointerProperties, std::vector<common::V1_0::PointerCoords>* outPointerCoords) { Loading Loading @@ -360,7 +355,7 @@ common::V1_0::MotionEvent notifyMotionArgsToHalMotionEvent(const NotifyMotionArg event.eventTime = args.eventTime; event.deviceTimestamp = 0; event.action = getAction(args.action & AMOTION_EVENT_ACTION_MASK); event.actionIndex = getActionIndex(args.action); event.actionIndex = MotionEvent::getActionIndex(args.action); event.actionButton = getActionButton(args.actionButton); event.flags = getFlags(args.flags); event.policyFlags = getPolicyFlags(args.policyFlags); Loading services/inputflinger/InputListener.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,25 @@ bool NotifyMotionArgs::operator==(const NotifyMotionArgs& rhs) const { return true; } std::string NotifyMotionArgs::dump() const { std::string coords; for (uint32_t i = 0; i < pointerCount; i++) { if (!coords.empty()) { coords += ", "; } coords += StringPrintf("{%" PRIu32 ": ", i); coords += StringPrintf("id=%" PRIu32 " x=%.1f y=%.1f, pressure=%.1f", pointerProperties[i].id, pointerCoords[i].getX(), pointerCoords[i].getY(), pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE)); coords += "}"; } return StringPrintf("NotifyMotionArgs(id=%" PRId32 ", eventTime=%" PRId64 ", deviceId=%" PRId32 ", source=%s, action=%s, pointerCount=%" PRIu32 " pointers=%s)", id, eventTime, deviceId, inputEventSourceToString(source).c_str(), MotionEvent::actionToString(action).c_str(), pointerCount, coords.c_str()); } void NotifyMotionArgs::notify(InputListenerInterface& listener) const { listener.notifyMotion(this); } Loading services/inputflinger/InputManager.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "InputManager.h" #include "InputDispatcherFactory.h" #include "InputReaderFactory.h" #include "UnwantedInteractionBlocker.h" #include <binder/IPCThreadState.h> Loading Loading @@ -54,12 +55,17 @@ static int32_t exceptionCodeFromStatusT(status_t status) { } } /** * The event flow is via the "InputListener" interface, as follows: * InputReader -> UnwantedInteractionBlocker -> InputClassifier -> InputDispatcher */ InputManager::InputManager( const sp<InputReaderPolicyInterface>& readerPolicy, const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { mDispatcher = createInputDispatcher(dispatcherPolicy); mClassifier = std::make_unique<InputClassifier>(*mDispatcher); mReader = createInputReader(readerPolicy, *mClassifier); mUnwantedInteractionBlocker = std::make_unique<UnwantedInteractionBlocker>(*mClassifier); mReader = createInputReader(readerPolicy, *mUnwantedInteractionBlocker); } InputManager::~InputManager() { Loading Loading @@ -106,6 +112,10 @@ InputReaderInterface& InputManager::getReader() { return *mReader; } UnwantedInteractionBlockerInterface& InputManager::getUnwantedInteractionBlocker() { return *mUnwantedInteractionBlocker; } InputClassifierInterface& InputManager::getClassifier() { return *mClassifier; } Loading Loading
include/input/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -534,7 +534,7 @@ public: inline int32_t getActionMasked() const { return getActionMasked(mAction); } static int32_t getActionIndex(int32_t action) { static uint8_t getActionIndex(int32_t action) { return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; } Loading
services/inputflinger/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ filegroup { srcs: [ "InputClassifier.cpp", "InputClassifierConverter.cpp", "UnwantedInteractionBlocker.cpp", "InputManager.cpp", ], } Loading @@ -60,6 +61,7 @@ cc_defaults { "android.hardware.input.classifier@1.0", "libbase", "libbinder", "libchrome", "libcrypto", "libcutils", "libhidlbase", Loading @@ -76,6 +78,7 @@ cc_defaults { ], static_libs: [ "libattestation", "libpalmrejection", ], } Loading
services/inputflinger/InputClassifierConverter.cpp +1 −6 Original line number Diff line number Diff line Loading @@ -325,11 +325,6 @@ static std::vector<common::V1_0::VideoFrame> convertVideoFrames( return out; } static uint8_t getActionIndex(int32_t action) { return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; } static void getHidlPropertiesAndCoords(const NotifyMotionArgs& args, std::vector<common::V1_0::PointerProperties>* outPointerProperties, std::vector<common::V1_0::PointerCoords>* outPointerCoords) { Loading Loading @@ -360,7 +355,7 @@ common::V1_0::MotionEvent notifyMotionArgsToHalMotionEvent(const NotifyMotionArg event.eventTime = args.eventTime; event.deviceTimestamp = 0; event.action = getAction(args.action & AMOTION_EVENT_ACTION_MASK); event.actionIndex = getActionIndex(args.action); event.actionIndex = MotionEvent::getActionIndex(args.action); event.actionButton = getActionButton(args.actionButton); event.flags = getFlags(args.flags); event.policyFlags = getPolicyFlags(args.policyFlags); Loading
services/inputflinger/InputListener.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,25 @@ bool NotifyMotionArgs::operator==(const NotifyMotionArgs& rhs) const { return true; } std::string NotifyMotionArgs::dump() const { std::string coords; for (uint32_t i = 0; i < pointerCount; i++) { if (!coords.empty()) { coords += ", "; } coords += StringPrintf("{%" PRIu32 ": ", i); coords += StringPrintf("id=%" PRIu32 " x=%.1f y=%.1f, pressure=%.1f", pointerProperties[i].id, pointerCoords[i].getX(), pointerCoords[i].getY(), pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE)); coords += "}"; } return StringPrintf("NotifyMotionArgs(id=%" PRId32 ", eventTime=%" PRId64 ", deviceId=%" PRId32 ", source=%s, action=%s, pointerCount=%" PRIu32 " pointers=%s)", id, eventTime, deviceId, inputEventSourceToString(source).c_str(), MotionEvent::actionToString(action).c_str(), pointerCount, coords.c_str()); } void NotifyMotionArgs::notify(InputListenerInterface& listener) const { listener.notifyMotion(this); } Loading
services/inputflinger/InputManager.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "InputManager.h" #include "InputDispatcherFactory.h" #include "InputReaderFactory.h" #include "UnwantedInteractionBlocker.h" #include <binder/IPCThreadState.h> Loading Loading @@ -54,12 +55,17 @@ static int32_t exceptionCodeFromStatusT(status_t status) { } } /** * The event flow is via the "InputListener" interface, as follows: * InputReader -> UnwantedInteractionBlocker -> InputClassifier -> InputDispatcher */ InputManager::InputManager( const sp<InputReaderPolicyInterface>& readerPolicy, const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { mDispatcher = createInputDispatcher(dispatcherPolicy); mClassifier = std::make_unique<InputClassifier>(*mDispatcher); mReader = createInputReader(readerPolicy, *mClassifier); mUnwantedInteractionBlocker = std::make_unique<UnwantedInteractionBlocker>(*mClassifier); mReader = createInputReader(readerPolicy, *mUnwantedInteractionBlocker); } InputManager::~InputManager() { Loading Loading @@ -106,6 +112,10 @@ InputReaderInterface& InputManager::getReader() { return *mReader; } UnwantedInteractionBlockerInterface& InputManager::getUnwantedInteractionBlocker() { return *mUnwantedInteractionBlocker; } InputClassifierInterface& InputManager::getClassifier() { return *mClassifier; } Loading