Initial InputMappers for evdev input HAL.
The previous design of the InputHost wrapper classes made it very
painful to do testing, so this change also reverts to a more classical
C++ pattern for non-copyable objects. The InputHost classes still simply
call through to the input_host_t and callbacks as before.
Updated unittests to use gmock for mocking the InputHost interactions.
Change-Id: I4b70df2c89ed48af77446b8f5b87a4bde94510bf
diff --git a/modules/input/evdev/InputDevice.h b/modules/input/evdev/InputDevice.h
index b4f3244..a379d6c 100644
--- a/modules/input/evdev/InputDevice.h
+++ b/modules/input/evdev/InputDevice.h
@@ -18,11 +18,13 @@
#define ANDROID_INPUT_DEVICE_H_
#include <memory>
+#include <vector>
#include <utils/Timers.h>
#include "InputHost.h"
#include "InputHub.h"
+#include "InputMapper.h"
namespace android {
@@ -45,16 +47,22 @@
*/
class EvdevDevice : public InputDeviceInterface {
public:
- EvdevDevice(InputHost host, const std::shared_ptr<InputDeviceNode>& node);
+ EvdevDevice(InputHostInterface* host, const std::shared_ptr<InputDeviceNode>& node);
virtual ~EvdevDevice() override = default;
virtual void processInput(InputEvent& event, nsecs_t currentTime) override;
virtual uint32_t getInputClasses() override { return mClasses; }
private:
- InputHost mHost;
+ void createMappers();
+ void configureDevice();
+
+ InputHostInterface* mHost = nullptr;
std::shared_ptr<InputDeviceNode> mDeviceNode;
- InputDeviceIdentifier mInputId;
+ InputDeviceIdentifier* mInputId = nullptr;
+ InputDeviceDefinition* mDeviceDefinition = nullptr;
+ InputDeviceHandle* mDeviceHandle = nullptr;
+ std::vector<std::unique_ptr<InputMapper>> mMappers;
uint32_t mClasses = 0;
int32_t mOverrideSec = 0;