From 0defadf2c5504374d0e0377aa9accd33907d53cd Mon Sep 17 00:00:00 2001 From: Linnan Li Date: Sun, 5 May 2024 19:17:05 +0800 Subject: Use a strongly typed LogicalDisplayId for displayId(1/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: presubmit Change-Id: I1c348d7f08524471391b21eaba938501506a7772 Signed-off-by: Linnan Li --- libs/input/SpriteController.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libs/input/SpriteController.cpp') diff --git a/libs/input/SpriteController.cpp b/libs/input/SpriteController.cpp index 0baa9291f54d..af499390d390 100644 --- a/libs/input/SpriteController.cpp +++ b/libs/input/SpriteController.cpp @@ -19,9 +19,9 @@ #include "SpriteController.h" -#include -#include +#include #include +#include namespace android { @@ -340,13 +340,14 @@ void SpriteController::ensureSurfaceComposerClient() { } } -sp SpriteController::obtainSurface(int32_t width, int32_t height, int32_t displayId, +sp SpriteController::obtainSurface(int32_t width, int32_t height, + ui::LogicalDisplayId displayId, bool hideOnMirrored) { ensureSurfaceComposerClient(); const sp parent = mParentSurfaceProvider(displayId); if (parent == nullptr) { - ALOGE("Failed to get the parent surface for pointers on display %d", displayId); + LOG(ERROR) << "Failed to get the parent surface for pointers on display " << displayId; } int32_t createFlags = ISurfaceComposerClient::eHidden | ISurfaceComposerClient::eCursorWindow; @@ -475,7 +476,7 @@ void SpriteController::SpriteImpl::setTransformationMatrix( } } -void SpriteController::SpriteImpl::setDisplayId(int32_t displayId) { +void SpriteController::SpriteImpl::setDisplayId(ui::LogicalDisplayId displayId) { AutoMutex _l(mController.mLock); if (mLocked.state.displayId != displayId) { -- cgit v1.2.3-59-g8ed1b