Loading services/inputflinger/include/InputReaderBase.h +2 −1 Original line number Diff line number Diff line Loading @@ -335,7 +335,8 @@ public: virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) = 0; /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */ virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId) = 0; virtual std::shared_ptr<PointerControllerInterface> obtainPointerController( int32_t deviceId) = 0; /* Notifies the input reader policy that some input devices have changed * and provides information about all current input devices. Loading services/inputflinger/include/PointerControllerInterface.h +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ namespace android { * The pointer controller is responsible for providing synchronization and for tracking * display orientation changes if needed. */ class PointerControllerInterface : public virtual RefBase { class PointerControllerInterface { protected: PointerControllerInterface() { } virtual ~PointerControllerInterface() { } Loading services/inputflinger/reader/InputReader.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -390,8 +390,9 @@ bool InputReader::shouldDropVirtualKeyLocked(nsecs_t now, int32_t keyCode, int32 } } sp<PointerControllerInterface> InputReader::getPointerControllerLocked(int32_t deviceId) { sp<PointerControllerInterface> controller = mPointerController.promote(); std::shared_ptr<PointerControllerInterface> InputReader::getPointerControllerLocked( int32_t deviceId) { std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller == nullptr) { controller = mPolicy->obtainPointerController(deviceId); mPointerController = controller; Loading @@ -401,7 +402,7 @@ sp<PointerControllerInterface> InputReader::getPointerControllerLocked(int32_t d } void InputReader::updatePointerDisplayLocked() { sp<PointerControllerInterface> controller = mPointerController.promote(); std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller == nullptr) { return; } Loading @@ -424,7 +425,7 @@ void InputReader::updatePointerDisplayLocked() { } void InputReader::fadePointerLocked() { sp<PointerControllerInterface> controller = mPointerController.promote(); std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller != nullptr) { controller->fade(PointerControllerInterface::TRANSITION_GRADUAL); } Loading Loading @@ -725,7 +726,8 @@ void InputReader::ContextImpl::fadePointer() { mReader->fadePointerLocked(); } sp<PointerControllerInterface> InputReader::ContextImpl::getPointerController(int32_t deviceId) { std::shared_ptr<PointerControllerInterface> InputReader::ContextImpl::getPointerController( int32_t deviceId) { // lock is already held by the input loop return mReader->getPointerControllerLocked(deviceId); } Loading services/inputflinger/reader/include/InputReader.h +11 −9 Original line number Diff line number Diff line Loading @@ -17,19 +17,20 @@ #ifndef _UI_INPUTREADER_INPUT_READER_H #define _UI_INPUTREADER_INPUT_READER_H #include "EventHub.h" #include "InputListener.h" #include "InputReaderBase.h" #include "InputReaderContext.h" #include "InputThread.h" #include <PointerControllerInterface.h> #include <utils/Condition.h> #include <utils/Mutex.h> #include <memory> #include <unordered_map> #include <vector> #include "EventHub.h" #include "InputListener.h" #include "InputReaderBase.h" #include "InputReaderContext.h" #include "InputThread.h" namespace android { class InputDevice; Loading Loading @@ -104,7 +105,8 @@ protected: virtual void disableVirtualKeysUntil(nsecs_t time) override; virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) override; virtual void fadePointer() override; virtual sp<PointerControllerInterface> getPointerController(int32_t deviceId) override; virtual std::shared_ptr<PointerControllerInterface> getPointerController( int32_t deviceId) override; virtual void requestTimeoutAtTime(nsecs_t when) override; virtual int32_t bumpGeneration() override; virtual void getExternalStylusDevices(std::vector<InputDeviceInfo>& outDevices) override; Loading Loading @@ -160,8 +162,8 @@ private: void dispatchExternalStylusState(const StylusState& state); // The PointerController that is shared among all the input devices that need it. wp<PointerControllerInterface> mPointerController; sp<PointerControllerInterface> getPointerControllerLocked(int32_t deviceId); std::weak_ptr<PointerControllerInterface> mPointerController; std::shared_ptr<PointerControllerInterface> getPointerControllerLocked(int32_t deviceId); void updatePointerDisplayLocked(); void fadePointerLocked(); Loading services/inputflinger/reader/include/InputReaderContext.h +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public: virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) = 0; virtual void fadePointer() = 0; virtual sp<PointerControllerInterface> getPointerController(int32_t deviceId) = 0; virtual std::shared_ptr<PointerControllerInterface> getPointerController(int32_t deviceId) = 0; virtual void requestTimeoutAtTime(nsecs_t when) = 0; virtual int32_t bumpGeneration() = 0; Loading Loading
services/inputflinger/include/InputReaderBase.h +2 −1 Original line number Diff line number Diff line Loading @@ -335,7 +335,8 @@ public: virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) = 0; /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */ virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId) = 0; virtual std::shared_ptr<PointerControllerInterface> obtainPointerController( int32_t deviceId) = 0; /* Notifies the input reader policy that some input devices have changed * and provides information about all current input devices. Loading
services/inputflinger/include/PointerControllerInterface.h +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ namespace android { * The pointer controller is responsible for providing synchronization and for tracking * display orientation changes if needed. */ class PointerControllerInterface : public virtual RefBase { class PointerControllerInterface { protected: PointerControllerInterface() { } virtual ~PointerControllerInterface() { } Loading
services/inputflinger/reader/InputReader.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -390,8 +390,9 @@ bool InputReader::shouldDropVirtualKeyLocked(nsecs_t now, int32_t keyCode, int32 } } sp<PointerControllerInterface> InputReader::getPointerControllerLocked(int32_t deviceId) { sp<PointerControllerInterface> controller = mPointerController.promote(); std::shared_ptr<PointerControllerInterface> InputReader::getPointerControllerLocked( int32_t deviceId) { std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller == nullptr) { controller = mPolicy->obtainPointerController(deviceId); mPointerController = controller; Loading @@ -401,7 +402,7 @@ sp<PointerControllerInterface> InputReader::getPointerControllerLocked(int32_t d } void InputReader::updatePointerDisplayLocked() { sp<PointerControllerInterface> controller = mPointerController.promote(); std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller == nullptr) { return; } Loading @@ -424,7 +425,7 @@ void InputReader::updatePointerDisplayLocked() { } void InputReader::fadePointerLocked() { sp<PointerControllerInterface> controller = mPointerController.promote(); std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller != nullptr) { controller->fade(PointerControllerInterface::TRANSITION_GRADUAL); } Loading Loading @@ -725,7 +726,8 @@ void InputReader::ContextImpl::fadePointer() { mReader->fadePointerLocked(); } sp<PointerControllerInterface> InputReader::ContextImpl::getPointerController(int32_t deviceId) { std::shared_ptr<PointerControllerInterface> InputReader::ContextImpl::getPointerController( int32_t deviceId) { // lock is already held by the input loop return mReader->getPointerControllerLocked(deviceId); } Loading
services/inputflinger/reader/include/InputReader.h +11 −9 Original line number Diff line number Diff line Loading @@ -17,19 +17,20 @@ #ifndef _UI_INPUTREADER_INPUT_READER_H #define _UI_INPUTREADER_INPUT_READER_H #include "EventHub.h" #include "InputListener.h" #include "InputReaderBase.h" #include "InputReaderContext.h" #include "InputThread.h" #include <PointerControllerInterface.h> #include <utils/Condition.h> #include <utils/Mutex.h> #include <memory> #include <unordered_map> #include <vector> #include "EventHub.h" #include "InputListener.h" #include "InputReaderBase.h" #include "InputReaderContext.h" #include "InputThread.h" namespace android { class InputDevice; Loading Loading @@ -104,7 +105,8 @@ protected: virtual void disableVirtualKeysUntil(nsecs_t time) override; virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) override; virtual void fadePointer() override; virtual sp<PointerControllerInterface> getPointerController(int32_t deviceId) override; virtual std::shared_ptr<PointerControllerInterface> getPointerController( int32_t deviceId) override; virtual void requestTimeoutAtTime(nsecs_t when) override; virtual int32_t bumpGeneration() override; virtual void getExternalStylusDevices(std::vector<InputDeviceInfo>& outDevices) override; Loading Loading @@ -160,8 +162,8 @@ private: void dispatchExternalStylusState(const StylusState& state); // The PointerController that is shared among all the input devices that need it. wp<PointerControllerInterface> mPointerController; sp<PointerControllerInterface> getPointerControllerLocked(int32_t deviceId); std::weak_ptr<PointerControllerInterface> mPointerController; std::shared_ptr<PointerControllerInterface> getPointerControllerLocked(int32_t deviceId); void updatePointerDisplayLocked(); void fadePointerLocked(); Loading
services/inputflinger/reader/include/InputReaderContext.h +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public: virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) = 0; virtual void fadePointer() = 0; virtual sp<PointerControllerInterface> getPointerController(int32_t deviceId) = 0; virtual std::shared_ptr<PointerControllerInterface> getPointerController(int32_t deviceId) = 0; virtual void requestTimeoutAtTime(nsecs_t when) = 0; virtual int32_t bumpGeneration() = 0; Loading