Loading services/inputflinger/InputClassifier.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -345,7 +345,7 @@ void InputClassifier::HalDeathRecipient::serviceDied( // --- InputClassifier --- InputClassifier::InputClassifier(const sp<InputListenerInterface>& listener) InputClassifier::InputClassifier(InputListenerInterface& listener) : mListener(listener), mHalDeathRecipient(new HalDeathRecipient(*this)) {} void InputClassifier::setMotionClassifierEnabled(bool enabled) { Loading @@ -369,12 +369,12 @@ void InputClassifier::setMotionClassifierEnabled(bool enabled) { void InputClassifier::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) { // pass through mListener->notifyConfigurationChanged(args); mListener.notifyConfigurationChanged(args); } void InputClassifier::notifyKey(const NotifyKeyArgs* args) { // pass through mListener->notifyKey(args); mListener.notifyKey(args); } void InputClassifier::notifyMotion(const NotifyMotionArgs* args) { Loading @@ -382,28 +382,28 @@ void InputClassifier::notifyMotion(const NotifyMotionArgs* args) { // MotionClassifier is only used for touch events, for now const bool sendToMotionClassifier = mMotionClassifier && isTouchEvent(*args); if (!sendToMotionClassifier) { mListener->notifyMotion(args); mListener.notifyMotion(args); return; } NotifyMotionArgs newArgs(*args); newArgs.classification = mMotionClassifier->classify(newArgs); mListener->notifyMotion(&newArgs); mListener.notifyMotion(&newArgs); } void InputClassifier::notifySensor(const NotifySensorArgs* args) { // pass through mListener->notifySensor(args); mListener.notifySensor(args); } void InputClassifier::notifyVibratorState(const NotifyVibratorStateArgs* args) { // pass through mListener->notifyVibratorState(args); mListener.notifyVibratorState(args); } void InputClassifier::notifySwitch(const NotifySwitchArgs* args) { // pass through mListener->notifySwitch(args); mListener.notifySwitch(args); } void InputClassifier::notifyDeviceReset(const NotifyDeviceResetArgs* args) { Loading @@ -412,12 +412,12 @@ void InputClassifier::notifyDeviceReset(const NotifyDeviceResetArgs* args) { mMotionClassifier->reset(*args); } // continue to next stage mListener->notifyDeviceReset(args); mListener.notifyDeviceReset(args); } void InputClassifier::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) { // pass through mListener->notifyPointerCaptureChanged(args); mListener.notifyPointerCaptureChanged(args); } void InputClassifier::setMotionClassifier( Loading services/inputflinger/InputClassifier.h +4 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ #define _UI_INPUT_CLASSIFIER_H #include <android-base/thread_annotations.h> #include <utils/RefBase.h> #include <thread> #include <unordered_map> Loading Loading @@ -88,7 +87,7 @@ public: * Base interface for an InputListener stage. * Provides classification to events. */ class InputClassifierInterface : public virtual RefBase, public InputListenerInterface { class InputClassifierInterface : public InputListenerInterface { public: virtual void setMotionClassifierEnabled(bool enabled) = 0; /** Loading @@ -96,7 +95,7 @@ public: * This method may be called on any thread (usually by the input manager). */ virtual void dump(std::string& dump) = 0; protected: InputClassifierInterface() { } virtual ~InputClassifierInterface() { } }; Loading Loading @@ -223,7 +222,7 @@ private: */ class InputClassifier : public InputClassifierInterface { public: explicit InputClassifier(const sp<InputListenerInterface>& listener); explicit InputClassifier(InputListenerInterface& listener); virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) override; virtual void notifyKey(const NotifyKeyArgs* args) override; Loading @@ -245,7 +244,7 @@ private: // Protect access to mMotionClassifier, since it may become null via a hidl callback std::mutex mLock; // The next stage to pass input events to sp<InputListenerInterface> mListener; InputListenerInterface& mListener; std::unique_ptr<MotionClassifierInterface> mMotionClassifier GUARDED_BY(mLock); std::thread mInitializeMotionClassifierThread; Loading services/inputflinger/InputListener.cpp +18 −19 Original line number Diff line number Diff line Loading @@ -44,8 +44,8 @@ bool NotifyConfigurationChangedArgs::operator==(const NotifyConfigurationChanged return id == rhs.id && eventTime == rhs.eventTime; } void NotifyConfigurationChangedArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyConfigurationChanged(this); void NotifyConfigurationChangedArgs::notify(InputListenerInterface& listener) const { listener.notifyConfigurationChanged(this); } // --- NotifyKeyArgs --- Loading Loading @@ -89,8 +89,8 @@ bool NotifyKeyArgs::operator==(const NotifyKeyArgs& rhs) const { downTime == rhs.downTime; } void NotifyKeyArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyKey(this); void NotifyKeyArgs::notify(InputListenerInterface& listener) const { listener.notifyKey(this); } // --- NotifyMotionArgs --- Loading Loading @@ -188,8 +188,8 @@ bool NotifyMotionArgs::operator==(const NotifyMotionArgs& rhs) const { return true; } void NotifyMotionArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyMotion(this); void NotifyMotionArgs::notify(InputListenerInterface& listener) const { listener.notifyMotion(this); } // --- NotifySwitchArgs --- Loading @@ -212,8 +212,8 @@ bool NotifySwitchArgs::operator==(const NotifySwitchArgs rhs) const { switchValues == rhs.switchValues && switchMask == rhs.switchMask; } void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifySwitch(this); void NotifySwitchArgs::notify(InputListenerInterface& listener) const { listener.notifySwitch(this); } // --- NotifySensorArgs --- Loading Loading @@ -247,8 +247,8 @@ bool NotifySensorArgs::operator==(const NotifySensorArgs rhs) const { hwTimestamp == rhs.hwTimestamp && values == rhs.values; } void NotifySensorArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifySensor(this); void NotifySensorArgs::notify(InputListenerInterface& listener) const { listener.notifySensor(this); } // --- NotifyVibratorStateArgs --- Loading @@ -265,8 +265,8 @@ bool NotifyVibratorStateArgs::operator==(const NotifyVibratorStateArgs rhs) cons isOn == rhs.isOn; } void NotifyVibratorStateArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyVibratorState(this); void NotifyVibratorStateArgs::notify(InputListenerInterface& listener) const { listener.notifyVibratorState(this); } // --- NotifyDeviceResetArgs --- Loading @@ -281,8 +281,8 @@ bool NotifyDeviceResetArgs::operator==(const NotifyDeviceResetArgs& rhs) const { return id == rhs.id && eventTime == rhs.eventTime && deviceId == rhs.deviceId; } void NotifyDeviceResetArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyDeviceReset(this); void NotifyDeviceResetArgs::notify(InputListenerInterface& listener) const { listener.notifyDeviceReset(this); } // --- NotifyPointerCaptureChangedArgs --- Loading @@ -299,8 +299,8 @@ bool NotifyPointerCaptureChangedArgs::operator==(const NotifyPointerCaptureChang return id == rhs.id && eventTime == rhs.eventTime && request == rhs.request; } void NotifyPointerCaptureChangedArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyPointerCaptureChanged(this); void NotifyPointerCaptureChangedArgs::notify(InputListenerInterface& listener) const { listener.notifyPointerCaptureChanged(this); } // --- QueuedInputListener --- Loading @@ -312,9 +312,8 @@ static inline void traceEvent(const char* functionName, int32_t id) { } } QueuedInputListener::QueuedInputListener(const sp<InputListenerInterface>& innerListener) : mInnerListener(innerListener) { } QueuedInputListener::QueuedInputListener(InputListenerInterface& innerListener) : mInnerListener(innerListener) {} QueuedInputListener::~QueuedInputListener() { size_t count = mArgsQueue.size(); Loading services/inputflinger/InputManager.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -58,8 +58,8 @@ InputManager::InputManager( const sp<InputReaderPolicyInterface>& readerPolicy, const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { mDispatcher = createInputDispatcher(dispatcherPolicy); mClassifier = new InputClassifier(mDispatcher); mReader = createInputReader(readerPolicy, mClassifier); mClassifier = std::make_unique<InputClassifier>(*mDispatcher); mReader = createInputReader(readerPolicy, *mClassifier); } InputManager::~InputManager() { Loading Loading @@ -102,16 +102,16 @@ status_t InputManager::stop() { return status; } sp<InputReaderInterface> InputManager::getReader() { return mReader; InputReaderInterface& InputManager::getReader() { return *mReader; } sp<InputClassifierInterface> InputManager::getClassifier() { return mClassifier; InputClassifierInterface& InputManager::getClassifier() { return *mClassifier; } sp<InputDispatcherInterface> InputManager::getDispatcher() { return mDispatcher; InputDispatcherInterface& InputManager::getDispatcher() { return *mDispatcher; } // Used by tests only. Loading services/inputflinger/InputManager.h +9 −9 Original line number Diff line number Diff line Loading @@ -75,13 +75,13 @@ public: virtual status_t stop() = 0; /* Gets the input reader. */ virtual sp<InputReaderInterface> getReader() = 0; virtual InputReaderInterface& getReader() = 0; /* Gets the input classifier */ virtual sp<InputClassifierInterface> getClassifier() = 0; virtual InputClassifierInterface& getClassifier() = 0; /* Gets the input dispatcher. */ virtual sp<InputDispatcherInterface> getDispatcher() = 0; virtual InputDispatcherInterface& getDispatcher() = 0; }; class InputManager : public InputManagerInterface, public BnInputFlinger { Loading @@ -96,9 +96,9 @@ public: status_t start() override; status_t stop() override; sp<InputReaderInterface> getReader() override; sp<InputClassifierInterface> getClassifier() override; sp<InputDispatcherInterface> getDispatcher() override; InputReaderInterface& getReader() override; InputClassifierInterface& getClassifier() override; InputDispatcherInterface& getDispatcher() override; status_t dump(int fd, const Vector<String16>& args) override; binder::Status createInputChannel(const std::string& name, InputChannel* outChannel) override; Loading @@ -106,11 +106,11 @@ public: binder::Status setFocusedWindow(const gui::FocusRequest&) override; private: sp<InputReaderInterface> mReader; std::unique_ptr<InputReaderInterface> mReader; sp<InputClassifierInterface> mClassifier; std::unique_ptr<InputClassifierInterface> mClassifier; sp<InputDispatcherInterface> mDispatcher; std::unique_ptr<InputDispatcherInterface> mDispatcher; }; } // namespace android Loading Loading
services/inputflinger/InputClassifier.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -345,7 +345,7 @@ void InputClassifier::HalDeathRecipient::serviceDied( // --- InputClassifier --- InputClassifier::InputClassifier(const sp<InputListenerInterface>& listener) InputClassifier::InputClassifier(InputListenerInterface& listener) : mListener(listener), mHalDeathRecipient(new HalDeathRecipient(*this)) {} void InputClassifier::setMotionClassifierEnabled(bool enabled) { Loading @@ -369,12 +369,12 @@ void InputClassifier::setMotionClassifierEnabled(bool enabled) { void InputClassifier::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) { // pass through mListener->notifyConfigurationChanged(args); mListener.notifyConfigurationChanged(args); } void InputClassifier::notifyKey(const NotifyKeyArgs* args) { // pass through mListener->notifyKey(args); mListener.notifyKey(args); } void InputClassifier::notifyMotion(const NotifyMotionArgs* args) { Loading @@ -382,28 +382,28 @@ void InputClassifier::notifyMotion(const NotifyMotionArgs* args) { // MotionClassifier is only used for touch events, for now const bool sendToMotionClassifier = mMotionClassifier && isTouchEvent(*args); if (!sendToMotionClassifier) { mListener->notifyMotion(args); mListener.notifyMotion(args); return; } NotifyMotionArgs newArgs(*args); newArgs.classification = mMotionClassifier->classify(newArgs); mListener->notifyMotion(&newArgs); mListener.notifyMotion(&newArgs); } void InputClassifier::notifySensor(const NotifySensorArgs* args) { // pass through mListener->notifySensor(args); mListener.notifySensor(args); } void InputClassifier::notifyVibratorState(const NotifyVibratorStateArgs* args) { // pass through mListener->notifyVibratorState(args); mListener.notifyVibratorState(args); } void InputClassifier::notifySwitch(const NotifySwitchArgs* args) { // pass through mListener->notifySwitch(args); mListener.notifySwitch(args); } void InputClassifier::notifyDeviceReset(const NotifyDeviceResetArgs* args) { Loading @@ -412,12 +412,12 @@ void InputClassifier::notifyDeviceReset(const NotifyDeviceResetArgs* args) { mMotionClassifier->reset(*args); } // continue to next stage mListener->notifyDeviceReset(args); mListener.notifyDeviceReset(args); } void InputClassifier::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) { // pass through mListener->notifyPointerCaptureChanged(args); mListener.notifyPointerCaptureChanged(args); } void InputClassifier::setMotionClassifier( Loading
services/inputflinger/InputClassifier.h +4 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ #define _UI_INPUT_CLASSIFIER_H #include <android-base/thread_annotations.h> #include <utils/RefBase.h> #include <thread> #include <unordered_map> Loading Loading @@ -88,7 +87,7 @@ public: * Base interface for an InputListener stage. * Provides classification to events. */ class InputClassifierInterface : public virtual RefBase, public InputListenerInterface { class InputClassifierInterface : public InputListenerInterface { public: virtual void setMotionClassifierEnabled(bool enabled) = 0; /** Loading @@ -96,7 +95,7 @@ public: * This method may be called on any thread (usually by the input manager). */ virtual void dump(std::string& dump) = 0; protected: InputClassifierInterface() { } virtual ~InputClassifierInterface() { } }; Loading Loading @@ -223,7 +222,7 @@ private: */ class InputClassifier : public InputClassifierInterface { public: explicit InputClassifier(const sp<InputListenerInterface>& listener); explicit InputClassifier(InputListenerInterface& listener); virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) override; virtual void notifyKey(const NotifyKeyArgs* args) override; Loading @@ -245,7 +244,7 @@ private: // Protect access to mMotionClassifier, since it may become null via a hidl callback std::mutex mLock; // The next stage to pass input events to sp<InputListenerInterface> mListener; InputListenerInterface& mListener; std::unique_ptr<MotionClassifierInterface> mMotionClassifier GUARDED_BY(mLock); std::thread mInitializeMotionClassifierThread; Loading
services/inputflinger/InputListener.cpp +18 −19 Original line number Diff line number Diff line Loading @@ -44,8 +44,8 @@ bool NotifyConfigurationChangedArgs::operator==(const NotifyConfigurationChanged return id == rhs.id && eventTime == rhs.eventTime; } void NotifyConfigurationChangedArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyConfigurationChanged(this); void NotifyConfigurationChangedArgs::notify(InputListenerInterface& listener) const { listener.notifyConfigurationChanged(this); } // --- NotifyKeyArgs --- Loading Loading @@ -89,8 +89,8 @@ bool NotifyKeyArgs::operator==(const NotifyKeyArgs& rhs) const { downTime == rhs.downTime; } void NotifyKeyArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyKey(this); void NotifyKeyArgs::notify(InputListenerInterface& listener) const { listener.notifyKey(this); } // --- NotifyMotionArgs --- Loading Loading @@ -188,8 +188,8 @@ bool NotifyMotionArgs::operator==(const NotifyMotionArgs& rhs) const { return true; } void NotifyMotionArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyMotion(this); void NotifyMotionArgs::notify(InputListenerInterface& listener) const { listener.notifyMotion(this); } // --- NotifySwitchArgs --- Loading @@ -212,8 +212,8 @@ bool NotifySwitchArgs::operator==(const NotifySwitchArgs rhs) const { switchValues == rhs.switchValues && switchMask == rhs.switchMask; } void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifySwitch(this); void NotifySwitchArgs::notify(InputListenerInterface& listener) const { listener.notifySwitch(this); } // --- NotifySensorArgs --- Loading Loading @@ -247,8 +247,8 @@ bool NotifySensorArgs::operator==(const NotifySensorArgs rhs) const { hwTimestamp == rhs.hwTimestamp && values == rhs.values; } void NotifySensorArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifySensor(this); void NotifySensorArgs::notify(InputListenerInterface& listener) const { listener.notifySensor(this); } // --- NotifyVibratorStateArgs --- Loading @@ -265,8 +265,8 @@ bool NotifyVibratorStateArgs::operator==(const NotifyVibratorStateArgs rhs) cons isOn == rhs.isOn; } void NotifyVibratorStateArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyVibratorState(this); void NotifyVibratorStateArgs::notify(InputListenerInterface& listener) const { listener.notifyVibratorState(this); } // --- NotifyDeviceResetArgs --- Loading @@ -281,8 +281,8 @@ bool NotifyDeviceResetArgs::operator==(const NotifyDeviceResetArgs& rhs) const { return id == rhs.id && eventTime == rhs.eventTime && deviceId == rhs.deviceId; } void NotifyDeviceResetArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyDeviceReset(this); void NotifyDeviceResetArgs::notify(InputListenerInterface& listener) const { listener.notifyDeviceReset(this); } // --- NotifyPointerCaptureChangedArgs --- Loading @@ -299,8 +299,8 @@ bool NotifyPointerCaptureChangedArgs::operator==(const NotifyPointerCaptureChang return id == rhs.id && eventTime == rhs.eventTime && request == rhs.request; } void NotifyPointerCaptureChangedArgs::notify(const sp<InputListenerInterface>& listener) const { listener->notifyPointerCaptureChanged(this); void NotifyPointerCaptureChangedArgs::notify(InputListenerInterface& listener) const { listener.notifyPointerCaptureChanged(this); } // --- QueuedInputListener --- Loading @@ -312,9 +312,8 @@ static inline void traceEvent(const char* functionName, int32_t id) { } } QueuedInputListener::QueuedInputListener(const sp<InputListenerInterface>& innerListener) : mInnerListener(innerListener) { } QueuedInputListener::QueuedInputListener(InputListenerInterface& innerListener) : mInnerListener(innerListener) {} QueuedInputListener::~QueuedInputListener() { size_t count = mArgsQueue.size(); Loading
services/inputflinger/InputManager.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -58,8 +58,8 @@ InputManager::InputManager( const sp<InputReaderPolicyInterface>& readerPolicy, const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { mDispatcher = createInputDispatcher(dispatcherPolicy); mClassifier = new InputClassifier(mDispatcher); mReader = createInputReader(readerPolicy, mClassifier); mClassifier = std::make_unique<InputClassifier>(*mDispatcher); mReader = createInputReader(readerPolicy, *mClassifier); } InputManager::~InputManager() { Loading Loading @@ -102,16 +102,16 @@ status_t InputManager::stop() { return status; } sp<InputReaderInterface> InputManager::getReader() { return mReader; InputReaderInterface& InputManager::getReader() { return *mReader; } sp<InputClassifierInterface> InputManager::getClassifier() { return mClassifier; InputClassifierInterface& InputManager::getClassifier() { return *mClassifier; } sp<InputDispatcherInterface> InputManager::getDispatcher() { return mDispatcher; InputDispatcherInterface& InputManager::getDispatcher() { return *mDispatcher; } // Used by tests only. Loading
services/inputflinger/InputManager.h +9 −9 Original line number Diff line number Diff line Loading @@ -75,13 +75,13 @@ public: virtual status_t stop() = 0; /* Gets the input reader. */ virtual sp<InputReaderInterface> getReader() = 0; virtual InputReaderInterface& getReader() = 0; /* Gets the input classifier */ virtual sp<InputClassifierInterface> getClassifier() = 0; virtual InputClassifierInterface& getClassifier() = 0; /* Gets the input dispatcher. */ virtual sp<InputDispatcherInterface> getDispatcher() = 0; virtual InputDispatcherInterface& getDispatcher() = 0; }; class InputManager : public InputManagerInterface, public BnInputFlinger { Loading @@ -96,9 +96,9 @@ public: status_t start() override; status_t stop() override; sp<InputReaderInterface> getReader() override; sp<InputClassifierInterface> getClassifier() override; sp<InputDispatcherInterface> getDispatcher() override; InputReaderInterface& getReader() override; InputClassifierInterface& getClassifier() override; InputDispatcherInterface& getDispatcher() override; status_t dump(int fd, const Vector<String16>& args) override; binder::Status createInputChannel(const std::string& name, InputChannel* outChannel) override; Loading @@ -106,11 +106,11 @@ public: binder::Status setFocusedWindow(const gui::FocusRequest&) override; private: sp<InputReaderInterface> mReader; std::unique_ptr<InputReaderInterface> mReader; sp<InputClassifierInterface> mClassifier; std::unique_ptr<InputClassifierInterface> mClassifier; sp<InputDispatcherInterface> mDispatcher; std::unique_ptr<InputDispatcherInterface> mDispatcher; }; } // namespace android Loading