eqs: sensors: Create input event polling one shot sensor

* for double tap to wake in screen off and in aod

Co-authored-by: SGCMarkus <markusornik@gmail.com>
Change-Id: Ie78d7729201836bacd65a57f76e22adb61159192
This commit is contained in:
Cosmin Tanislav
2022-02-20 19:34:44 +02:00
committed by SGCMarkus
parent e4b7f97125
commit 19f1c1d6f0
8 changed files with 239 additions and 12 deletions

View File

@@ -17,8 +17,12 @@
#pragma once
#include <android/hardware/sensors/2.1/types.h>
#include <fcntl.h>
#include <poll.h>
#include <unistd.h>
#include <condition_variable>
#include <fstream>
#include <memory>
#include <mutex>
#include <thread>
@@ -88,6 +92,31 @@ class OneShotSensor : public Sensor {
virtual Result flush() override { return Result::BAD_VALUE; }
};
class InputEventDT2WSensor : public OneShotSensor {
public:
InputEventDT2WSensor(int32_t sensorHandle, ISensorsEventCallback* callback);
virtual ~InputEventDT2WSensor() override;
virtual void activate(bool enable) override;
virtual void activate(bool enable, bool notify, bool lock);
virtual void writeEnable(bool enable);
virtual void setOperationMode(OperationMode mode) override;
virtual std::vector<Event> readEvents() override;
virtual void fillEventData(Event& event);
protected:
virtual void run() override;
std::ofstream mGestureEnable;
private:
void interruptPoll();
struct pollfd mPolls[3];
int mWaitPipeFd[2];
int mPollFds[2];
};
} // namespace implementation
} // namespace subhal
} // namespace V2_1