summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2024-05-10 13:41:35 -0700
committer Siarhei Vishniakou <svv@google.com> 2024-05-14 08:31:17 -0700
commitcfbee5304f8fa7210e6f0816ca2ef2b6ab22c689 (patch)
tree95e36c55a539de10ccef28a5d5c66357990c7ab9 /libs
parent278e699ba51bb8c2bcde28f9d83565d7bf85d6a5 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/include/gui/DisplayInfo.h2
-rw-r--r--libs/gui/include/gui/WindowInfo.h2
-rw-r--r--libs/gui/tests/EndToEndNativeInputTest.cpp8
-rw-r--r--libs/input/Input.cpp8
-rw-r--r--libs/input/InputDevice.cpp2
-rw-r--r--libs/input/KeyCharacterMap.cpp7
-rw-r--r--libs/input/tests/InputEvent_test.cpp6
-rw-r--r--libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp28
-rw-r--r--libs/input/tests/InputPublisherAndConsumer_test.cpp28
-rw-r--r--libs/input/tests/MotionPredictor_test.cpp7
-rw-r--r--libs/input/tests/TouchResampling_test.cpp10
-rw-r--r--libs/input/tests/VelocityTracker_test.cpp4
-rw-r--r--libs/input/tests/VerifiedInputEvent_test.cpp4
-rw-r--r--libs/ui/include/ui/LogicalDisplayId.h14
14 files changed, 70 insertions, 60 deletions
diff --git a/libs/gui/include/gui/DisplayInfo.h b/libs/gui/include/gui/DisplayInfo.h
index 7282b807a4..7094658379 100644
--- a/libs/gui/include/gui/DisplayInfo.h
+++ b/libs/gui/include/gui/DisplayInfo.h
@@ -29,7 +29,7 @@ namespace android::gui {
* This should only be used by InputFlinger to support raw coordinates in logical display space.
*/
struct DisplayInfo : public Parcelable {
- ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE;
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID;
// Logical display dimensions.
int32_t logicalWidth = 0;
diff --git a/libs/gui/include/gui/WindowInfo.h b/libs/gui/include/gui/WindowInfo.h
index 3ea3f67bd8..eb3be5588a 100644
--- a/libs/gui/include/gui/WindowInfo.h
+++ b/libs/gui/include/gui/WindowInfo.h
@@ -234,7 +234,7 @@ struct WindowInfo : public Parcelable {
Uid ownerUid = Uid::INVALID;
std::string packageName;
ftl::Flags<InputConfig> inputConfig;
- ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_NONE;
+ ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID;
InputApplicationInfo applicationInfo;
bool replaceTouchableRegionWithCrop = false;
wp<IBinder> touchableRegionCropHandle;
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index c0e79655f8..45e33902c7 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -59,8 +59,6 @@ using android::gui::FocusRequest;
using android::gui::InputApplicationInfo;
using android::gui::TouchOcclusionMode;
using android::gui::WindowInfo;
-using android::ui::ADISPLAY_ID_DEFAULT;
-using android::ui::ADISPLAY_ID_NONE;
namespace android {
namespace {
@@ -313,7 +311,7 @@ public:
reportedListener->wait();
}
- void requestFocus(ui::LogicalDisplayId displayId = ADISPLAY_ID_DEFAULT) {
+ void requestFocus(ui::LogicalDisplayId displayId = ui::LogicalDisplayId::DEFAULT) {
SurfaceComposerClient::Transaction t;
FocusRequest request;
request.token = mInputInfo.token;
@@ -438,7 +436,7 @@ void injectTapOnDisplay(int x, int y, ui::LogicalDisplayId displayId) {
}
void injectTap(int x, int y) {
- injectTapOnDisplay(x, y, ADISPLAY_ID_DEFAULT);
+ injectTapOnDisplay(x, y, ui::LogicalDisplayId::DEFAULT);
}
void injectKeyOnDisplay(uint32_t keycode, ui::LogicalDisplayId displayId) {
@@ -451,7 +449,7 @@ void injectKeyOnDisplay(uint32_t keycode, ui::LogicalDisplayId displayId) {
}
void injectKey(uint32_t keycode) {
- injectKeyOnDisplay(keycode, ADISPLAY_ID_NONE);
+ injectKeyOnDisplay(keycode, ui::LogicalDisplayId::INVALID);
}
TEST_F(InputSurfacesTest, can_receive_input) {
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 1178d02510..ee121d53fe 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -1198,7 +1198,7 @@ std::ostream& operator<<(std::ostream& out, const MotionEvent& event) {
void FocusEvent::initialize(int32_t id, bool hasFocus) {
InputEvent::initialize(id, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, AINPUT_SOURCE_UNKNOWN,
- ui::ADISPLAY_ID_NONE, INVALID_HMAC);
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC);
mHasFocus = hasFocus;
}
@@ -1211,7 +1211,7 @@ void FocusEvent::initialize(const FocusEvent& from) {
void CaptureEvent::initialize(int32_t id, bool pointerCaptureEnabled) {
InputEvent::initialize(id, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, AINPUT_SOURCE_UNKNOWN,
- ui::ADISPLAY_ID_NONE, INVALID_HMAC);
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC);
mPointerCaptureEnabled = pointerCaptureEnabled;
}
@@ -1224,7 +1224,7 @@ void CaptureEvent::initialize(const CaptureEvent& from) {
void DragEvent::initialize(int32_t id, float x, float y, bool isExiting) {
InputEvent::initialize(id, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, AINPUT_SOURCE_UNKNOWN,
- ui::ADISPLAY_ID_NONE, INVALID_HMAC);
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC);
mIsExiting = isExiting;
mX = x;
mY = y;
@@ -1241,7 +1241,7 @@ void DragEvent::initialize(const DragEvent& from) {
void TouchModeEvent::initialize(int32_t id, bool isInTouchMode) {
InputEvent::initialize(id, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, AINPUT_SOURCE_UNKNOWN,
- ui::ADISPLAY_ID_NONE, INVALID_HMAC);
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC);
mIsInTouchMode = isInTouchMode;
}
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp
index 50239a1f9f..bc678103c2 100644
--- a/libs/input/InputDevice.cpp
+++ b/libs/input/InputDevice.cpp
@@ -169,7 +169,7 @@ std::string InputDeviceIdentifier::getCanonicalName() const {
// --- InputDeviceInfo ---
InputDeviceInfo::InputDeviceInfo() {
- initialize(-1, 0, -1, InputDeviceIdentifier(), "", false, false, ui::ADISPLAY_ID_NONE);
+ initialize(-1, 0, -1, InputDeviceIdentifier(), "", false, false, ui::LogicalDisplayId::INVALID);
}
InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other)
diff --git a/libs/input/KeyCharacterMap.cpp b/libs/input/KeyCharacterMap.cpp
index f75bf410f2..1cf5612d45 100644
--- a/libs/input/KeyCharacterMap.cpp
+++ b/libs/input/KeyCharacterMap.cpp
@@ -497,9 +497,10 @@ void KeyCharacterMap::addKey(Vector<KeyEvent>& outEvents, int32_t deviceId, int3
int32_t metaState, bool down, nsecs_t time) {
outEvents.push();
KeyEvent& event = outEvents.editTop();
- event.initialize(InputEvent::nextId(), deviceId, AINPUT_SOURCE_KEYBOARD, ui::ADISPLAY_ID_NONE,
- INVALID_HMAC, down ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, 0, keyCode,
- 0, metaState, 0, time, time);
+ event.initialize(InputEvent::nextId(), deviceId, AINPUT_SOURCE_KEYBOARD,
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC,
+ down ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, 0, keyCode, 0, metaState,
+ 0, time, time);
}
void KeyCharacterMap::addMetaKeys(Vector<KeyEvent>& outEvents,
diff --git a/libs/input/tests/InputEvent_test.cpp b/libs/input/tests/InputEvent_test.cpp
index cc2574de9a..704ea46fe9 100644
--- a/libs/input/tests/InputEvent_test.cpp
+++ b/libs/input/tests/InputEvent_test.cpp
@@ -27,7 +27,7 @@
namespace android {
// Default display id.
-static constexpr ui::LogicalDisplayId DISPLAY_ID = ui::ADISPLAY_ID_DEFAULT;
+static constexpr ui::LogicalDisplayId DISPLAY_ID = ui::LogicalDisplayId::DEFAULT;
static constexpr float EPSILON = MotionEvent::ROUNDING_PRECISION;
@@ -858,8 +858,8 @@ MotionEvent createMotionEvent(int32_t source, uint32_t action, float x, float y,
pointerCoords.back().setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, dy);
nsecs_t eventTime = systemTime(SYSTEM_TIME_MONOTONIC);
MotionEvent event;
- event.initialize(InputEvent::nextId(), /* deviceId */ 1, source,
- /* displayId */ ui::ADISPLAY_ID_DEFAULT, INVALID_HMAC, action,
+ event.initialize(InputEvent::nextId(), /* deviceId */ 1, source, ui::LogicalDisplayId::DEFAULT,
+ INVALID_HMAC, action,
/* actionButton */ 0, /* flags */ 0, /* edgeFlags */ 0, AMETA_NONE,
/* buttonState */ 0, MotionClassification::NONE, transform,
/* xPrecision */ 0, /* yPrecision */ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
diff --git a/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp b/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp
index 7ae1cd8444..70529bbd39 100644
--- a/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp
+++ b/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp
@@ -55,7 +55,7 @@ struct PublishMotionArgs {
const int32_t eventId;
const int32_t deviceId = 1;
const uint32_t source = AINPUT_SOURCE_TOUCHSCREEN;
- const ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_DEFAULT;
+ const ui::LogicalDisplayId displayId = ui::LogicalDisplayId::DEFAULT;
const int32_t actionButton = 0;
const int32_t edgeFlags = AMOTION_EVENT_EDGE_FLAG_TOP;
const int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON;
@@ -445,7 +445,7 @@ void InputPublisherAndConsumerNoResamplingTest::publishAndConsumeKeyEvent() {
int32_t eventId = InputEvent::nextId();
constexpr int32_t deviceId = 1;
constexpr uint32_t source = AINPUT_SOURCE_KEYBOARD;
- constexpr ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_DEFAULT;
+ constexpr ui::LogicalDisplayId displayId = ui::LogicalDisplayId::DEFAULT;
constexpr std::array<uint8_t, 32> hmac = {31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21,
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
@@ -737,10 +737,10 @@ TEST_F(InputPublisherAndConsumerNoResamplingTest,
ui::Transform identityTransform;
status =
- mPublisher->publishMotionEvent(0, InputEvent::nextId(), 0, 0, ui::ADISPLAY_ID_DEFAULT,
- INVALID_HMAC, 0, 0, 0, 0, 0, 0,
- MotionClassification::NONE, identityTransform, 0, 0,
- AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ mPublisher->publishMotionEvent(0, InputEvent::nextId(), 0, 0,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, 0, 0, 0, 0,
+ 0, 0, MotionClassification::NONE, identityTransform, 0,
+ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
0, 0, pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE";
@@ -755,10 +755,10 @@ TEST_F(InputPublisherAndConsumerNoResamplingTest,
ui::Transform identityTransform;
status =
- mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0, ui::ADISPLAY_ID_DEFAULT,
- INVALID_HMAC, 0, 0, 0, 0, 0, 0,
- MotionClassification::NONE, identityTransform, 0, 0,
- AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, 0, 0, 0, 0,
+ 0, 0, MotionClassification::NONE, identityTransform, 0,
+ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
0, 0, pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE";
@@ -777,10 +777,10 @@ TEST_F(InputPublisherAndConsumerNoResamplingTest,
ui::Transform identityTransform;
status =
- mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0, ui::ADISPLAY_ID_DEFAULT,
- INVALID_HMAC, 0, 0, 0, 0, 0, 0,
- MotionClassification::NONE, identityTransform, 0, 0,
- AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, 0, 0, 0, 0,
+ 0, 0, MotionClassification::NONE, identityTransform, 0,
+ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
0, 0, pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE";
diff --git a/libs/input/tests/InputPublisherAndConsumer_test.cpp b/libs/input/tests/InputPublisherAndConsumer_test.cpp
index d0dbe2ad31..48512f7c6e 100644
--- a/libs/input/tests/InputPublisherAndConsumer_test.cpp
+++ b/libs/input/tests/InputPublisherAndConsumer_test.cpp
@@ -48,7 +48,7 @@ struct PublishMotionArgs {
const int32_t eventId;
const int32_t deviceId = 1;
const uint32_t source = AINPUT_SOURCE_TOUCHSCREEN;
- const ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_DEFAULT;
+ const ui::LogicalDisplayId displayId = ui::LogicalDisplayId::DEFAULT;
const int32_t actionButton = 0;
const int32_t edgeFlags = AMOTION_EVENT_EDGE_FLAG_TOP;
const int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON;
@@ -262,7 +262,7 @@ void InputPublisherAndConsumerTest::publishAndConsumeKeyEvent() {
int32_t eventId = InputEvent::nextId();
constexpr int32_t deviceId = 1;
constexpr uint32_t source = AINPUT_SOURCE_KEYBOARD;
- constexpr ui::LogicalDisplayId displayId = ui::ADISPLAY_ID_DEFAULT;
+ constexpr ui::LogicalDisplayId displayId = ui::LogicalDisplayId::DEFAULT;
constexpr std::array<uint8_t, 32> hmac = {31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21,
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10,
9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
@@ -622,10 +622,10 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenSequenceNumberIsZer
ui::Transform identityTransform;
status =
- mPublisher->publishMotionEvent(0, InputEvent::nextId(), 0, 0, ui::ADISPLAY_ID_DEFAULT,
- INVALID_HMAC, 0, 0, 0, 0, 0, 0,
- MotionClassification::NONE, identityTransform, 0, 0,
- AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ mPublisher->publishMotionEvent(0, InputEvent::nextId(), 0, 0,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, 0, 0, 0, 0,
+ 0, 0, MotionClassification::NONE, identityTransform, 0,
+ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
0, 0, pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE";
@@ -639,10 +639,10 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessTha
ui::Transform identityTransform;
status =
- mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0, ui::ADISPLAY_ID_DEFAULT,
- INVALID_HMAC, 0, 0, 0, 0, 0, 0,
- MotionClassification::NONE, identityTransform, 0, 0,
- AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, 0, 0, 0, 0,
+ 0, 0, MotionClassification::NONE, identityTransform, 0,
+ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
0, 0, pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE";
@@ -661,10 +661,10 @@ TEST_F(InputPublisherAndConsumerTest,
ui::Transform identityTransform;
status =
- mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0, ui::ADISPLAY_ID_DEFAULT,
- INVALID_HMAC, 0, 0, 0, 0, 0, 0,
- MotionClassification::NONE, identityTransform, 0, 0,
- AMOTION_EVENT_INVALID_CURSOR_POSITION,
+ mPublisher->publishMotionEvent(1, InputEvent::nextId(), 0, 0,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, 0, 0, 0, 0,
+ 0, 0, MotionClassification::NONE, identityTransform, 0,
+ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
0, 0, pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE";
diff --git a/libs/input/tests/MotionPredictor_test.cpp b/libs/input/tests/MotionPredictor_test.cpp
index 1c9f0c7399..d077760757 100644
--- a/libs/input/tests/MotionPredictor_test.cpp
+++ b/libs/input/tests/MotionPredictor_test.cpp
@@ -58,9 +58,10 @@ static MotionEvent getMotionEvent(int32_t action, float x, float y,
}
ui::Transform identityTransform;
- event.initialize(InputEvent::nextId(), deviceId, AINPUT_SOURCE_STYLUS, ui::ADISPLAY_ID_DEFAULT,
- {0}, action, /*actionButton=*/0, /*flags=*/0, AMOTION_EVENT_EDGE_FLAG_NONE,
- AMETA_NONE, /*buttonState=*/0, MotionClassification::NONE, identityTransform,
+ event.initialize(InputEvent::nextId(), deviceId, AINPUT_SOURCE_STYLUS,
+ ui::LogicalDisplayId::DEFAULT, {0}, action, /*actionButton=*/0, /*flags=*/0,
+ AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, /*buttonState=*/0,
+ MotionClassification::NONE, identityTransform,
/*xPrecision=*/0.1,
/*yPrecision=*/0.2, /*xCursorPosition=*/280, /*yCursorPosition=*/540,
identityTransform, /*downTime=*/100, eventTime.count(), pointerCount,
diff --git a/libs/input/tests/TouchResampling_test.cpp b/libs/input/tests/TouchResampling_test.cpp
index 1694cadfbe..2dc9fdb7f1 100644
--- a/libs/input/tests/TouchResampling_test.cpp
+++ b/libs/input/tests/TouchResampling_test.cpp
@@ -84,11 +84,11 @@ status_t TouchResamplingTest::publishSimpleMotionEventWithCoords(
ADD_FAILURE() << "Downtime should be equal to 0 (hardcoded for convenience)";
}
return mPublisher->publishMotionEvent(mSeq++, InputEvent::nextId(), /*deviceId=*/1,
- AINPUT_SOURCE_TOUCHSCREEN,
- /*displayId=*/ui::ADISPLAY_ID_DEFAULT, INVALID_HMAC,
- action, /*actionButton=*/0, /*flags=*/0, /*edgeFlags=*/0,
- AMETA_NONE, /*buttonState=*/0, MotionClassification::NONE,
- identityTransform, /*xPrecision=*/0, /*yPrecision=*/0,
+ AINPUT_SOURCE_TOUCHSCREEN, ui::LogicalDisplayId::DEFAULT,
+ INVALID_HMAC, action, /*actionButton=*/0, /*flags=*/0,
+ /*edgeFlags=*/0, AMETA_NONE, /*buttonState=*/0,
+ MotionClassification::NONE, identityTransform,
+ /*xPrecision=*/0, /*yPrecision=*/0,
AMOTION_EVENT_INVALID_CURSOR_POSITION,
AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform,
downTime, eventTime, properties.size(), properties.data(),
diff --git a/libs/input/tests/VelocityTracker_test.cpp b/libs/input/tests/VelocityTracker_test.cpp
index b4c4e1286d..f50a3cdb99 100644
--- a/libs/input/tests/VelocityTracker_test.cpp
+++ b/libs/input/tests/VelocityTracker_test.cpp
@@ -33,7 +33,7 @@ using android::base::StringPrintf;
namespace android {
-constexpr ui::LogicalDisplayId DISPLAY_ID = ui::ADISPLAY_ID_DEFAULT; // default display id
+constexpr ui::LogicalDisplayId DISPLAY_ID = ui::LogicalDisplayId::DEFAULT; // default display id
constexpr int32_t DEFAULT_POINTER_ID = 0; // pointer ID used for manually defined tests
@@ -155,7 +155,7 @@ static std::vector<MotionEvent> createAxisScrollMotionEventStream(
MotionEvent event;
ui::Transform identityTransform;
event.initialize(InputEvent::nextId(), /*deviceId=*/5, AINPUT_SOURCE_ROTARY_ENCODER,
- ui::ADISPLAY_ID_NONE, INVALID_HMAC, AMOTION_EVENT_ACTION_SCROLL,
+ ui::LogicalDisplayId::INVALID, INVALID_HMAC, AMOTION_EVENT_ACTION_SCROLL,
/*actionButton=*/0, /*flags=*/0, AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE,
/*buttonState=*/0, MotionClassification::NONE, identityTransform,
/*xPrecision=*/0, /*yPrecision=*/0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
diff --git a/libs/input/tests/VerifiedInputEvent_test.cpp b/libs/input/tests/VerifiedInputEvent_test.cpp
index 40cfaaeb05..df5fe9d2d0 100644
--- a/libs/input/tests/VerifiedInputEvent_test.cpp
+++ b/libs/input/tests/VerifiedInputEvent_test.cpp
@@ -23,7 +23,7 @@ namespace android {
static KeyEvent getKeyEventWithFlags(int32_t flags) {
KeyEvent event;
event.initialize(InputEvent::nextId(), /*deviceId=*/2, AINPUT_SOURCE_GAMEPAD,
- ui::ADISPLAY_ID_DEFAULT, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, flags,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, flags,
AKEYCODE_BUTTON_X, /*scanCode=*/121, AMETA_ALT_ON, /*repeatCount=*/1,
/*downTime=*/1000, /*eventTime=*/2000);
return event;
@@ -44,7 +44,7 @@ static MotionEvent getMotionEventWithFlags(int32_t flags) {
transform.set({2, 0, 4, 0, 3, 5, 0, 0, 1});
ui::Transform identity;
event.initialize(InputEvent::nextId(), /*deviceId=*/0, AINPUT_SOURCE_MOUSE,
- ui::ADISPLAY_ID_DEFAULT, INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN,
+ ui::LogicalDisplayId::DEFAULT, INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN,
/*actionButton=*/0, flags, AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE,
/*buttonState=*/0, MotionClassification::NONE, transform, /*xPrecision=*/0.1,
/*yPrecision=*/0.2,
diff --git a/libs/ui/include/ui/LogicalDisplayId.h b/libs/ui/include/ui/LogicalDisplayId.h
index 3e504e7101..d745758f0c 100644
--- a/libs/ui/include/ui/LogicalDisplayId.h
+++ b/libs/ui/include/ui/LogicalDisplayId.h
@@ -35,10 +35,20 @@ struct LogicalDisplayId : ftl::Constructible<LogicalDisplayId, int32_t>,
constexpr bool isValid() const { return val() >= 0; }
std::string toString() const { return std::to_string(val()); }
+
+ static const LogicalDisplayId INVALID;
+ static const LogicalDisplayId DEFAULT;
};
-constexpr LogicalDisplayId ADISPLAY_ID_NONE{-1};
-constexpr LogicalDisplayId ADISPLAY_ID_DEFAULT{0};
+constexpr inline LogicalDisplayId LogicalDisplayId::INVALID{-1};
+constexpr inline LogicalDisplayId LogicalDisplayId::DEFAULT{0};
+
+/**
+ * Deprecated! Use LogicalDisplayId::INVALID / LogicalDisplayId::DEFAULT instead.
+ * TODO(b/339106983): remove these.
+ */
+[[deprecated]] constexpr LogicalDisplayId ADISPLAY_ID_NONE{-1};
+[[deprecated]] constexpr LogicalDisplayId ADISPLAY_ID_DEFAULT{0};
inline std::ostream& operator<<(std::ostream& stream, LogicalDisplayId displayId) {
return stream << displayId.val();