Move ADISPLAY_ID_ definitions into LogicalDisplayId
These will eventually replace the existing definitions as follows:
ADISPLAY_ID_NONE -->> LogicalDisplayId::INVALID
ADISPLAY_ID_DEFAULT -->> LogicalDisplayId::DEFAULT
We are keeping the old definitions for now, to reduce the merge
conflicts. These will be removed in subsequent CLs, after the
frameworks/base and other repository patches go in.
The constant "NONE" was renamed to "INVALID" to make it consistent with
the Java definitions.
Bug: 339106983
Test: m checkinput
Change-Id: I0274be345159c85cb51fcea743d8acd3d298cd07
diff --git a/services/inputflinger/reader/mapper/CapturedTouchpadEventConverter.cpp b/services/inputflinger/reader/mapper/CapturedTouchpadEventConverter.cpp
index 21dec6f..09a5f08 100644
--- a/services/inputflinger/reader/mapper/CapturedTouchpadEventConverter.cpp
+++ b/services/inputflinger/reader/mapper/CapturedTouchpadEventConverter.cpp
@@ -278,7 +278,7 @@
LOG_ALWAYS_FATAL_IF(coords.size() != properties.size(),
"Mismatched coords and properties arrays.");
return NotifyMotionArgs(mReaderContext.getNextId(), when, readTime, mDeviceId, SOURCE,
- ui::ADISPLAY_ID_NONE, /*policyFlags=*/POLICY_FLAG_WAKE, action,
+ ui::LogicalDisplayId::INVALID, /*policyFlags=*/POLICY_FLAG_WAKE, action,
/*actionButton=*/actionButton, flags,
mReaderContext.getGlobalMetaState(), mButtonState,
MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, coords.size(),
diff --git a/services/inputflinger/reader/mapper/CursorInputMapper.cpp b/services/inputflinger/reader/mapper/CursorInputMapper.cpp
index d5fe040..c67314d 100644
--- a/services/inputflinger/reader/mapper/CursorInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/CursorInputMapper.cpp
@@ -488,13 +488,13 @@
if (mEnableNewMousePointerBallistics) {
mNewPointerVelocityControl.setAccelerationEnabled(
config.displaysWithMousePointerAccelerationDisabled.count(
- mDisplayId.value_or(ui::ADISPLAY_ID_NONE)) == 0);
+ mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0);
mNewPointerVelocityControl.setCurve(
createAccelerationCurveForPointerSensitivity(config.mousePointerSpeed));
} else {
mOldPointerVelocityControl.setParameters(
(config.displaysWithMousePointerAccelerationDisabled.count(
- mDisplayId.value_or(ui::ADISPLAY_ID_NONE)) == 0)
+ mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0)
? config.pointerVelocityControlParameters
: FLAT_VELOCITY_CONTROL_PARAMS);
}
@@ -506,7 +506,7 @@
void CursorInputMapper::configureOnChangeDisplayInfo(const InputReaderConfiguration& config) {
const bool isPointer = mParameters.mode == Parameters::Mode::POINTER;
- mDisplayId = ui::ADISPLAY_ID_NONE;
+ mDisplayId = ui::LogicalDisplayId::INVALID;
std::optional<DisplayViewport> resolvedViewport;
if (auto assocViewport = mDeviceContext.getAssociatedViewport(); assocViewport) {
// This InputDevice is associated with a viewport.
@@ -518,7 +518,8 @@
// Always use DISPLAY_ID_NONE for mouse events.
// PointerChoreographer will make it target the correct the displayId later.
resolvedViewport = getContext()->getPolicy()->getPointerViewportForAssociatedDisplay();
- mDisplayId = resolvedViewport ? std::make_optional(ui::ADISPLAY_ID_NONE) : std::nullopt;
+ mDisplayId =
+ resolvedViewport ? std::make_optional(ui::LogicalDisplayId::INVALID) : std::nullopt;
}
mOrientation = (mParameters.orientationAware && mParameters.hasAssociatedDisplay) ||
diff --git a/services/inputflinger/reader/mapper/CursorInputMapper.h b/services/inputflinger/reader/mapper/CursorInputMapper.h
index e45105a..75ca9c0 100644
--- a/services/inputflinger/reader/mapper/CursorInputMapper.h
+++ b/services/inputflinger/reader/mapper/CursorInputMapper.h
@@ -113,7 +113,7 @@
SimpleVelocityControl mWheelYVelocityControl;
// The display that events generated by this mapper should target. This can be set to
- // ADISPLAY_ID_NONE to target the focused display. If there is no display target (i.e.
+ // LogicalDisplayId::INVALID to target the focused display. If there is no display target (i.e.
// std::nullopt), all events will be ignored.
std::optional<ui::LogicalDisplayId> mDisplayId;
ui::Rotation mOrientation{ui::ROTATION_0};
diff --git a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
index 7fcff95..5ce4d30 100644
--- a/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/JoystickInputMapper.cpp
@@ -341,7 +341,7 @@
// button will likely wake the device.
// TODO: Use the input device configuration to control this behavior more finely.
uint32_t policyFlags = 0;
- ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE;
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID;
if (getDeviceContext().getAssociatedViewport()) {
displayId = getDeviceContext().getAssociatedViewport()->displayId;
}
diff --git a/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp b/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
index be8d183..2124555 100644
--- a/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
@@ -114,7 +114,7 @@
if (mViewport) {
return mViewport->displayId;
}
- return ui::ADISPLAY_ID_NONE;
+ return ui::LogicalDisplayId::INVALID;
}
std::optional<KeyboardLayoutInfo> KeyboardInputMapper::getKeyboardLayoutInfo() const {
diff --git a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
index a3206c2..0ddbc06 100644
--- a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp
@@ -125,7 +125,7 @@
if (scrolled) {
int32_t metaState = getContext()->getGlobalMetaState();
// This is not a pointer, so it's not associated with a display.
- ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE;
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID;
if (mOrientation == ui::ROTATION_180) {
scroll = -scroll;
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 489bea8..8b4b691 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -2646,7 +2646,7 @@
PointerCoords pointerCoords;
pointerCoords.clear();
out.push_back(NotifyMotionArgs(getContext()->getNextId(), when, readTime, getDeviceId(),
- mSource, ui::ADISPLAY_ID_NONE, policyFlags,
+ mSource, ui::LogicalDisplayId::INVALID, policyFlags,
AMOTION_EVENT_ACTION_HOVER_MOVE, 0, flags, metaState,
buttonState, MotionClassification::NONE,
AMOTION_EVENT_EDGE_FLAG_NONE, 1, &pointerProperties,
@@ -3477,7 +3477,8 @@
hovering = false;
}
- return dispatchPointerSimple(when, readTime, policyFlags, down, hovering, ui::ADISPLAY_ID_NONE);
+ return dispatchPointerSimple(when, readTime, policyFlags, down, hovering,
+ ui::LogicalDisplayId::INVALID);
}
std::list<NotifyArgs> TouchInputMapper::abortPointerMouse(nsecs_t when, nsecs_t readTime,
@@ -3684,7 +3685,8 @@
source |= AINPUT_SOURCE_BLUETOOTH_STYLUS;
}
- const ui::LogicalDisplayId displayId = getAssociatedDisplayId().value_or(ui::ADISPLAY_ID_NONE);
+ const ui::LogicalDisplayId displayId =
+ getAssociatedDisplayId().value_or(ui::LogicalDisplayId::INVALID);
float xCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION;
float yCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION;
@@ -3961,7 +3963,7 @@
std::optional<ui::LogicalDisplayId> TouchInputMapper::getAssociatedDisplayId() {
if (mParameters.hasAssociatedDisplay) {
if (mDeviceMode == DeviceMode::POINTER) {
- return ui::ADISPLAY_ID_NONE;
+ return ui::LogicalDisplayId::INVALID;
} else {
return std::make_optional(mViewport.displayId);
}
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.h b/services/inputflinger/reader/mapper/TouchInputMapper.h
index 0c9ffa2..b24f2ff 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.h
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.h
@@ -705,7 +705,7 @@
// Values reported for the last pointer event.
uint32_t source;
- ui::LogicalDisplayId displayId{ui::ADISPLAY_ID_NONE};
+ ui::LogicalDisplayId displayId{ui::LogicalDisplayId::INVALID};
float lastCursorX;
float lastCursorY;
@@ -718,7 +718,7 @@
hovering = false;
downTime = 0;
source = 0;
- displayId = ui::ADISPLAY_ID_NONE;
+ displayId = ui::LogicalDisplayId::INVALID;
lastCursorX = 0.f;
lastCursorY = 0.f;
}
diff --git a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
index e157862..2a580c9 100644
--- a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
@@ -322,7 +322,7 @@
}
if (!changes.any() || changes.test(InputReaderConfiguration::Change::DISPLAY_INFO)) {
- mDisplayId = ui::ADISPLAY_ID_NONE;
+ mDisplayId = ui::LogicalDisplayId::INVALID;
std::optional<DisplayViewport> resolvedViewport;
std::optional<FloatRect> boundsInLogicalDisplay;
if (auto assocViewport = mDeviceContext.getAssociatedViewport(); assocViewport) {
@@ -335,7 +335,8 @@
// Always use DISPLAY_ID_NONE for touchpad events.
// PointerChoreographer will make it target the correct the displayId later.
resolvedViewport = getContext()->getPolicy()->getPointerViewportForAssociatedDisplay();
- mDisplayId = resolvedViewport ? std::make_optional(ui::ADISPLAY_ID_NONE) : std::nullopt;
+ mDisplayId = resolvedViewport ? std::make_optional(ui::LogicalDisplayId::INVALID)
+ : std::nullopt;
}
mGestureConverter.setDisplayId(mDisplayId);
diff --git a/services/inputflinger/reader/mapper/TouchpadInputMapper.h b/services/inputflinger/reader/mapper/TouchpadInputMapper.h
index f27895f..546fa5b 100644
--- a/services/inputflinger/reader/mapper/TouchpadInputMapper.h
+++ b/services/inputflinger/reader/mapper/TouchpadInputMapper.h
@@ -107,7 +107,7 @@
std::set<int32_t> mPalmTrackingIds;
// The display that events generated by this mapper should target. This can be set to
- // ADISPLAY_ID_NONE to target the focused display. If there is no display target (i.e.
+ // LogicalDisplayId::INVALID to target the focused display. If there is no display target (i.e.
// std::nullopt), all events will be ignored.
std::optional<ui::LogicalDisplayId> mDisplayId;