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/TouchState.h b/services/inputflinger/dispatcher/TouchState.h
index 9f29a4a..25b9643 100644
--- a/services/inputflinger/dispatcher/TouchState.h
+++ b/services/inputflinger/dispatcher/TouchState.h
@@ -41,24 +41,24 @@
std::set<int32_t> getActiveDeviceIds() const;
bool hasTouchingPointers(int32_t device) const;
- void removeTouchingPointer(int32_t deviceId, int32_t pointerId);
- void removeTouchingPointerFromWindow(int32_t deviceId, int32_t pointerId,
+ void removeTouchingPointer(DeviceId deviceId, int32_t pointerId);
+ void removeTouchingPointerFromWindow(DeviceId deviceId, int32_t pointerId,
const sp<android::gui::WindowInfoHandle>& windowHandle);
void addOrUpdateWindow(const sp<android::gui::WindowInfoHandle>& windowHandle,
- ftl::Flags<InputTarget::Flags> targetFlags, int32_t deviceId,
+ ftl::Flags<InputTarget::Flags> targetFlags, DeviceId deviceId,
std::bitset<MAX_POINTER_ID + 1> touchingPointerIds,
std::optional<nsecs_t> firstDownTimeInTarget = std::nullopt);
void addHoveringPointerToWindow(const sp<android::gui::WindowInfoHandle>& windowHandle,
- int32_t deviceId, int32_t hoveringPointerId);
- void removeHoveringPointer(int32_t deviceId, int32_t hoveringPointerId);
+ DeviceId deviceId, int32_t hoveringPointerId);
+ void removeHoveringPointer(DeviceId deviceId, int32_t hoveringPointerId);
void clearHoveringPointers();
- void removeAllPointersForDevice(int32_t deviceId);
+ void removeAllPointersForDevice(DeviceId deviceId);
void removeWindowByToken(const sp<IBinder>& token);
void filterNonAsIsTouchWindows();
// Cancel pointers for current set of windows except the window with particular binder token.
- void cancelPointersForWindowsExcept(int32_t deviceId,
+ void cancelPointersForWindowsExcept(DeviceId deviceId,
std::bitset<MAX_POINTER_ID + 1> pointerIds,
const sp<IBinder>& token);
// Cancel pointers for current set of non-pilfering windows i.e. windows with isPilferingWindow
@@ -75,7 +75,7 @@
bool hasHoveringPointers() const;
std::set<sp<android::gui::WindowInfoHandle>> getWindowsWithHoveringPointer(
- int32_t deviceId, int32_t pointerId) const;
+ DeviceId deviceId, int32_t pointerId) const;
std::string dump() const;
};