Refactor how timeouts are calculated. (DO NOT MERGE)

Added a timeout mechanism to EventHub and InputReader so that
InputMappers can request timeouts to perform delayed processing of
input when needed.

Change-Id: I89c1171c9326c6e413042e3ee13aa9f7f1fc0454
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index 55ab479..fdb4cfc 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -159,6 +159,8 @@
 
     virtual void fadePointer() = 0;
 
+    virtual void requestTimeoutAtTime(nsecs_t when) = 0;
+
     virtual InputReaderPolicyInterface* getPolicy() = 0;
     virtual InputDispatcherInterface* getDispatcher() = 0;
     virtual EventHubInterface* getEventHub() = 0;
@@ -233,6 +235,7 @@
     void configureExcludedDevices();
 
     void consumeEvent(const RawEvent* rawEvent);
+    void timeoutExpired(nsecs_t when);
 
     void handleConfigurationChanged(nsecs_t when);
 
@@ -253,6 +256,9 @@
     virtual bool shouldDropVirtualKey(nsecs_t now,
             InputDevice* device, int32_t keyCode, int32_t scanCode);
 
+    nsecs_t mNextTimeout;
+    virtual void requestTimeoutAtTime(nsecs_t when);
+
     // state queries
     typedef int32_t (InputDevice::*GetStateFunc)(uint32_t sourceMask, int32_t code);
     int32_t getState(int32_t deviceId, uint32_t sourceMask, int32_t code,
@@ -296,6 +302,7 @@
     void configure();
     void reset();
     void process(const RawEvent* rawEvent);
+    void timeoutExpired(nsecs_t when);
 
     void getDeviceInfo(InputDeviceInfo* outDeviceInfo);
     int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode);
@@ -352,6 +359,7 @@
     virtual void configure();
     virtual void reset();
     virtual void process(const RawEvent* rawEvent) = 0;
+    virtual void timeoutExpired(nsecs_t when);
 
     virtual int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode);
     virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode);