Add type alias for DeviceId
To facilitate the future transition to a strong type, add a "weak" type
for DeviceId in this CL.
This will allow us to fix some of the existing code before having to
refactor all of it in a single topic.
Also, in this CL, simplify the names of some variables in TouchState
because we no longer have a conflict with the 'deviceId' member.
Bug: 211379801
Test: none
Change-Id: I1f287ad62fa26ba4bbbbbf353bebfbf8ad38ff67
diff --git a/services/inputflinger/dispatcher/InputState.h b/services/inputflinger/dispatcher/InputState.h
index af2a3cb..e741137 100644
--- a/services/inputflinger/dispatcher/InputState.h
+++ b/services/inputflinger/dispatcher/InputState.h
@@ -36,7 +36,7 @@
// Returns true if the specified source is known to have received a hover enter
// motion event.
- bool isHovering(int32_t deviceId, uint32_t source, int32_t displayId) const;
+ bool isHovering(DeviceId deviceId, uint32_t source, int32_t displayId) const;
// Records tracking information for a key event that has just been published.
// Returns true if the event should be delivered, false if it is inconsistent
@@ -76,7 +76,7 @@
private:
struct KeyMemento {
- int32_t deviceId;
+ DeviceId deviceId;
uint32_t source;
int32_t displayId;
int32_t keyCode;
@@ -88,7 +88,7 @@
};
struct MotionMemento {
- int32_t deviceId;
+ DeviceId deviceId;
uint32_t source;
int32_t displayId;
int32_t flags;