summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2024-05-13 13:17:05 -0700
committer Siarhei Vishniakou <svv@google.com> 2024-05-14 11:16:22 -0700
commit445af18b5228bcae504e4974347e70842df95c2b (patch)
treeebd5e0ebdee08d557c50d74a123e810bd62a4542
parent057d218e3105a3aefe316c2cced64c65a7465a3c (diff)
Replace ADISPLAY_ID_ constants with LogicalDisplayId equivalents
This will help remove ADISPLAY_ID_ constants. Bug: 339106983 Test: m checkinput Change-Id: I37e1ccf4872c0758b2817121199ef5beee7e107f
-rw-r--r--core/jni/platform/host/HostRuntime.cpp2
-rw-r--r--libs/input/MouseCursorController.cpp4
-rw-r--r--libs/input/PointerController.h2
-rw-r--r--libs/input/SpriteController.h2
-rw-r--r--libs/input/tests/PointerController_test.cpp12
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp4
6 files changed, 13 insertions, 13 deletions
diff --git a/core/jni/platform/host/HostRuntime.cpp b/core/jni/platform/host/HostRuntime.cpp
index bf2fddab3d41..acef609448ad 100644
--- a/core/jni/platform/host/HostRuntime.cpp
+++ b/core/jni/platform/host/HostRuntime.cpp
@@ -330,7 +330,7 @@ static void init_keyboard(JNIEnv* env, const vector<string>& keyboardPaths) {
InputDeviceInfo info = InputDeviceInfo();
info.initialize(keyboardId, 0, 0, InputDeviceIdentifier(),
"keyboard " + std::to_string(keyboardId), true, false,
- ui::ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
info.setKeyboardType(AINPUT_KEYBOARD_TYPE_ALPHABETIC);
info.setKeyCharacterMap(*charMap);
diff --git a/libs/input/MouseCursorController.cpp b/libs/input/MouseCursorController.cpp
index 5cf5a1d00815..f1ee3256dbee 100644
--- a/libs/input/MouseCursorController.cpp
+++ b/libs/input/MouseCursorController.cpp
@@ -467,10 +467,10 @@ void MouseCursorController::startAnimationLocked() REQUIRES(mLock) {
std::function<bool(nsecs_t)> func = std::bind(&MouseCursorController::doAnimations, this, _1);
/*
- * Using ui::ADISPLAY_ID_NONE for displayId here to avoid removing the callback
+ * Using ui::LogicalDisplayId::INVALID for displayId here to avoid removing the callback
* if a TouchSpotController with the same display is removed.
*/
- mContext.addAnimationCallback(ui::ADISPLAY_ID_NONE, func);
+ mContext.addAnimationCallback(ui::LogicalDisplayId::INVALID, func);
}
} // namespace android
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index 70e5c2455d81..c6430f7f36ff 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -109,7 +109,7 @@ private:
struct Locked {
Presentation presentation;
- ui::LogicalDisplayId pointerDisplayId = ui::ADISPLAY_ID_NONE;
+ ui::LogicalDisplayId pointerDisplayId = ui::LogicalDisplayId::INVALID;
std::vector<gui::DisplayInfo> mDisplayInfos;
std::unordered_map<ui::LogicalDisplayId, TouchSpotController> spotControllers;
diff --git a/libs/input/SpriteController.h b/libs/input/SpriteController.h
index 070c90c372ff..e147c567ae2d 100644
--- a/libs/input/SpriteController.h
+++ b/libs/input/SpriteController.h
@@ -174,7 +174,7 @@ private:
int32_t layer{0};
float alpha{1.0f};
SpriteTransformationMatrix transformationMatrix;
- ui::LogicalDisplayId displayId{ui::ADISPLAY_ID_DEFAULT};
+ ui::LogicalDisplayId displayId{ui::LogicalDisplayId::DEFAULT};
sp<SurfaceControl> surfaceControl;
int32_t surfaceWidth{0};
diff --git a/libs/input/tests/PointerController_test.cpp b/libs/input/tests/PointerController_test.cpp
index 7a133801f514..2dcb1f1d1650 100644
--- a/libs/input/tests/PointerController_test.cpp
+++ b/libs/input/tests/PointerController_test.cpp
@@ -166,7 +166,7 @@ protected:
PointerControllerTest();
~PointerControllerTest();
- void ensureDisplayViewportIsSet(ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_DEFAULT);
+ void ensureDisplayViewportIsSet(ui::LogicalDisplayId displayId = ui::LogicalDisplayId::DEFAULT);
sp<MockSprite> mPointerSprite;
sp<MockPointerControllerPolicyInterface> mPolicy;
@@ -335,23 +335,23 @@ TEST_F(PointerControllerTest, updatesSkipScreenshotFlagForTouchSpots) {
// Update spots to sync state with sprite
mPointerController->setSpots(&testSpotCoords, testIdToIndex.cbegin(), testIdBits,
- ui::ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
testing::Mock::VerifyAndClearExpectations(testSpotSprite.get());
// Marking the display to skip screenshot should update sprite as well
- mPointerController->setSkipScreenshot(ui::ADISPLAY_ID_DEFAULT, true);
+ mPointerController->setSkipScreenshot(ui::LogicalDisplayId::DEFAULT, true);
EXPECT_CALL(*testSpotSprite, setSkipScreenshot).With(testing::Args<0>(true));
// Update spots to sync state with sprite
mPointerController->setSpots(&testSpotCoords, testIdToIndex.cbegin(), testIdBits,
- ui::ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
testing::Mock::VerifyAndClearExpectations(testSpotSprite.get());
// Reset flag and verify again
- mPointerController->setSkipScreenshot(ui::ADISPLAY_ID_DEFAULT, false);
+ mPointerController->setSkipScreenshot(ui::LogicalDisplayId::DEFAULT, false);
EXPECT_CALL(*testSpotSprite, setSkipScreenshot).With(testing::Args<0>(false));
mPointerController->setSpots(&testSpotCoords, testIdToIndex.cbegin(), testIdBits,
- ui::ADISPLAY_ID_DEFAULT);
+ ui::LogicalDisplayId::DEFAULT);
testing::Mock::VerifyAndClearExpectations(testSpotSprite.get());
}
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index a01c1231b373..3a04509e322a 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -423,7 +423,7 @@ private:
std::set<int32_t> disabledInputDevices{};
// Associated Pointer controller display.
- ui::LogicalDisplayId pointerDisplayId{ui::ADISPLAY_ID_DEFAULT};
+ ui::LogicalDisplayId pointerDisplayId{ui::LogicalDisplayId::DEFAULT};
// True if stylus button reporting through motion events is enabled.
bool stylusButtonMotionEventsEnabled{true};
@@ -1886,7 +1886,7 @@ static jobject nativeCreateInputMonitor(JNIEnv* env, jobject nativeImplObj, jint
jstring nameObj, jint pid) {
NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
- if (displayId == ui::ADISPLAY_ID_NONE.val()) {
+ if (ui::LogicalDisplayId{displayId} == ui::LogicalDisplayId::INVALID) {
std::string message = "InputChannel used as a monitor must be associated with a display";
jniThrowRuntimeException(env, message.c_str());
return nullptr;