From 13bf76a87d9113d60f39e645c5453bf18d0a158d Mon Sep 17 00:00:00 2001 From: Linnan Li Date: Sun, 5 May 2024 19:18:02 +0800 Subject: Use a strongly typed LogicalDisplayId for displayId(2/n) Currently, we use int32_t for displayId, which is not a safe type, and it may also lead to misdefinition of types. Here, we introduce LogicalDisplayId as a strong type for displayId and move all contents of constants.h into LogicalDisplayId.h. Bug: 339106983 Test: atest inputflinger_tests Test: atest InputTests Test: m checkinput Test: m libsurfaceflinger_unittest Test: presubmit Change-Id: If44e56f69553d095af5adb59b595e4a852ab32ce Signed-off-by: Linnan Li --- libs/input/InputConsumerNoResampling.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libs/input/InputConsumerNoResampling.cpp') diff --git a/libs/input/InputConsumerNoResampling.cpp b/libs/input/InputConsumerNoResampling.cpp index 76f2b4a4f8..15d992f9f3 100644 --- a/libs/input/InputConsumerNoResampling.cpp +++ b/libs/input/InputConsumerNoResampling.cpp @@ -47,10 +47,10 @@ const bool DEBUG_TRANSPORT_CONSUMER = std::unique_ptr createKeyEvent(const InputMessage& msg) { std::unique_ptr event = std::make_unique(); event->initialize(msg.body.key.eventId, msg.body.key.deviceId, msg.body.key.source, - msg.body.key.displayId, msg.body.key.hmac, msg.body.key.action, - msg.body.key.flags, msg.body.key.keyCode, msg.body.key.scanCode, - msg.body.key.metaState, msg.body.key.repeatCount, msg.body.key.downTime, - msg.body.key.eventTime); + ui::LogicalDisplayId{msg.body.key.displayId}, msg.body.key.hmac, + msg.body.key.action, msg.body.key.flags, msg.body.key.keyCode, + msg.body.key.scanCode, msg.body.key.metaState, msg.body.key.repeatCount, + msg.body.key.downTime, msg.body.key.eventTime); return event; } @@ -93,8 +93,8 @@ std::unique_ptr createMotionEvent(const InputMessage& msg) { msg.body.motion.dtdyRaw, msg.body.motion.dsdyRaw, msg.body.motion.tyRaw, 0, 0, 1}); event->initialize(msg.body.motion.eventId, msg.body.motion.deviceId, msg.body.motion.source, - msg.body.motion.displayId, msg.body.motion.hmac, msg.body.motion.action, - msg.body.motion.actionButton, msg.body.motion.flags, + ui::LogicalDisplayId{msg.body.motion.displayId}, msg.body.motion.hmac, + msg.body.motion.action, msg.body.motion.actionButton, msg.body.motion.flags, msg.body.motion.edgeFlags, msg.body.motion.metaState, msg.body.motion.buttonState, msg.body.motion.classification, transform, msg.body.motion.xPrecision, msg.body.motion.yPrecision, -- cgit v1.2.3-59-g8ed1b