Renamed and moved InputWindow and related files

In preparation for the hierarchy listener interface, moved the
InputWindow structs into libgui and have libinput dependant on libgui.
Also renamed InputWindow to exclude Input since it will be used for more
generic purposes.

Test: Builds and flashes
Bug: 188792659

Change-Id: I24262cbc14d409c00273de0024a672394a959e5f
Merged-In: I24262cbc14d409c00273de0024a672394a959e5f
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index a63ec8f..1a142c9 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -30,7 +30,6 @@
         "android/os/IInputConstants.aidl",
         "android/os/InputEventInjectionResult.aidl",
         "android/os/InputEventInjectionSync.aidl",
-        "android/os/TouchOcclusionMode.aidl",
     ],
 }
 
@@ -69,26 +68,24 @@
 
     static_libs: [
         "libui-types",
+        "libgui_window_info_static",
     ],
 
     export_static_lib_headers: [
         "libui-types",
+        "libgui_window_info_static",
     ],
 
     target: {
         android: {
             srcs: [
                 "InputTransport.cpp",
-                "InputWindow.cpp",
-                "android/FocusRequest.aidl",
-                "android/InputApplicationInfo.aidl",
                 "android/os/BlockUntrustedTouchesMode.aidl",
                 "android/os/IInputConstants.aidl",
                 "android/os/IInputFlinger.aidl",
                 "android/os/InputEventInjectionResult.aidl",
                 "android/os/InputEventInjectionSync.aidl",
                 "android/os/ISetInputWindowsListener.aidl",
-                "android/os/TouchOcclusionMode.aidl",
             ],
 
             export_shared_lib_headers: ["libbinder"],
@@ -114,13 +111,9 @@
         linux_glibc: {
             srcs: [
                 "InputTransport.cpp",
-                "InputWindow.cpp",
-                "android/FocusRequest.aidl",
-                "android/InputApplicationInfo.aidl",
                 "android/os/IInputConstants.aidl",
                 "android/os/IInputFlinger.aidl",
                 "android/os/ISetInputWindowsListener.aidl",
-                "android/os/TouchOcclusionMode.aidl",
             ],
             static_libs: [
                 "libhostgraphics",
@@ -134,6 +127,9 @@
     aidl: {
         local_include_dirs: ["."],
         export_aidl_headers: true,
+        include_dirs: [
+            "frameworks/native/libs/gui",
+        ],
     },
 }
 
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 266d7a3..906e3e5 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include <android-base/stringprintf.h>
+#include <gui/constants.h>
 #include <input/Input.h>
 #include <input/InputDevice.h>
 #include <input/InputEventLabels.h>
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp
index 30c42a3..220c8e1 100644
--- a/libs/input/InputDevice.cpp
+++ b/libs/input/InputDevice.cpp
@@ -21,9 +21,9 @@
 #include <ctype.h>
 
 #include <android-base/stringprintf.h>
+#include <ftl/NamedEnum.h>
 #include <input/InputDevice.h>
 #include <input/InputEventLabels.h>
-#include <input/NamedEnum.h>
 
 using android::base::StringPrintf;
 
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index dd1c462..d6c1161 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -33,8 +33,8 @@
 #include <log/log.h>
 #include <utils/Trace.h>
 
+#include <ftl/NamedEnum.h>
 #include <input/InputTransport.h>
-#include <input/NamedEnum.h>
 
 using android::base::StringPrintf;
 
diff --git a/libs/input/InputWindow.cpp b/libs/input/InputWindow.cpp
deleted file mode 100644
index 9947720..0000000
--- a/libs/input/InputWindow.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <type_traits>
-#define LOG_TAG "InputWindow"
-#define LOG_NDEBUG 0
-
-#include <android-base/stringprintf.h>
-#include <binder/Parcel.h>
-#include <input/InputTransport.h>
-#include <input/InputWindow.h>
-
-#include <log/log.h>
-
-namespace android {
-
-
-// --- InputWindowInfo ---
-void InputWindowInfo::addTouchableRegion(const Rect& region) {
-    touchableRegion.orSelf(region);
-}
-
-bool InputWindowInfo::touchableRegionContainsPoint(int32_t x, int32_t y) const {
-    return touchableRegion.contains(x,y);
-}
-
-bool InputWindowInfo::frameContainsPoint(int32_t x, int32_t y) const {
-    return x >= frameLeft && x < frameRight
-            && y >= frameTop && y < frameBottom;
-}
-
-bool InputWindowInfo::supportsSplitTouch() const {
-    return flags.test(Flag::SPLIT_TOUCH);
-}
-
-bool InputWindowInfo::overlaps(const InputWindowInfo* other) const {
-    return frameLeft < other->frameRight && frameRight > other->frameLeft
-            && frameTop < other->frameBottom && frameBottom > other->frameTop;
-}
-
-bool InputWindowInfo::operator==(const InputWindowInfo& info) const {
-    return info.token == token && info.id == id && info.name == name && info.flags == flags &&
-            info.type == type && info.dispatchingTimeout == dispatchingTimeout &&
-            info.frameLeft == frameLeft && info.frameTop == frameTop &&
-            info.frameRight == frameRight && info.frameBottom == frameBottom &&
-            info.surfaceInset == surfaceInset && info.globalScaleFactor == globalScaleFactor &&
-            info.transform == transform && info.displayWidth == displayWidth &&
-            info.displayHeight == displayHeight &&
-            info.touchableRegion.hasSameRects(touchableRegion) && info.visible == visible &&
-            info.trustedOverlay == trustedOverlay && info.focusable == focusable &&
-            info.touchOcclusionMode == touchOcclusionMode && info.hasWallpaper == hasWallpaper &&
-            info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid &&
-            info.packageName == packageName && info.inputFeatures == inputFeatures &&
-            info.displayId == displayId && info.portalToDisplayId == portalToDisplayId &&
-            info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop &&
-            info.applicationInfo == applicationInfo;
-}
-
-status_t InputWindowInfo::writeToParcel(android::Parcel* parcel) const {
-    if (parcel == nullptr) {
-        ALOGE("%s: Null parcel", __func__);
-        return BAD_VALUE;
-    }
-    if (name.empty()) {
-        parcel->writeInt32(0);
-        return OK;
-    }
-    parcel->writeInt32(1);
-
-    // clang-format off
-    status_t status = parcel->writeStrongBinder(token) ?:
-        parcel->writeInt64(dispatchingTimeout.count()) ?:
-        parcel->writeInt32(id) ?:
-        parcel->writeUtf8AsUtf16(name) ?:
-        parcel->writeInt32(flags.get()) ?:
-        parcel->writeInt32(static_cast<std::underlying_type_t<InputWindowInfo::Type>>(type)) ?:
-        parcel->writeInt32(frameLeft) ?:
-        parcel->writeInt32(frameTop) ?:
-        parcel->writeInt32(frameRight) ?:
-        parcel->writeInt32(frameBottom) ?:
-        parcel->writeInt32(surfaceInset) ?:
-        parcel->writeFloat(globalScaleFactor) ?:
-        parcel->writeFloat(alpha) ?:
-        parcel->writeFloat(transform.dsdx()) ?:
-        parcel->writeFloat(transform.dtdx()) ?:
-        parcel->writeFloat(transform.tx()) ?:
-        parcel->writeFloat(transform.dtdy()) ?:
-        parcel->writeFloat(transform.dsdy()) ?:
-        parcel->writeFloat(transform.ty()) ?:
-        parcel->writeInt32(displayWidth) ?:
-        parcel->writeInt32(displayHeight) ?:
-        parcel->writeBool(visible) ?:
-        parcel->writeBool(focusable) ?:
-        parcel->writeBool(hasWallpaper) ?:
-        parcel->writeBool(paused) ?:
-        parcel->writeBool(trustedOverlay) ?:
-        parcel->writeInt32(static_cast<int32_t>(touchOcclusionMode)) ?:
-        parcel->writeInt32(ownerPid) ?:
-        parcel->writeInt32(ownerUid) ?:
-        parcel->writeUtf8AsUtf16(packageName) ?:
-        parcel->writeInt32(inputFeatures.get()) ?:
-        parcel->writeInt32(displayId) ?:
-        parcel->writeInt32(portalToDisplayId) ?:
-        applicationInfo.writeToParcel(parcel) ?:
-        parcel->write(touchableRegion) ?:
-        parcel->writeBool(replaceTouchableRegionWithCrop) ?:
-        parcel->writeStrongBinder(touchableRegionCropHandle.promote());
-    // clang-format on
-    return status;
-}
-
-status_t InputWindowInfo::readFromParcel(const android::Parcel* parcel) {
-    if (parcel == nullptr) {
-        ALOGE("%s: Null parcel", __func__);
-        return BAD_VALUE;
-    }
-    if (parcel->readInt32() == 0) {
-        return OK;
-    }
-
-    token = parcel->readStrongBinder();
-    dispatchingTimeout = static_cast<decltype(dispatchingTimeout)>(parcel->readInt64());
-    status_t status = parcel->readInt32(&id) ?: parcel->readUtf8FromUtf16(&name);
-    if (status != OK) {
-        return status;
-    }
-
-    flags = Flags<Flag>(parcel->readInt32());
-    type = static_cast<Type>(parcel->readInt32());
-    float dsdx, dtdx, tx, dtdy, dsdy, ty;
-    int32_t touchOcclusionModeInt;
-    // clang-format off
-    status = parcel->readInt32(&frameLeft) ?:
-        parcel->readInt32(&frameTop) ?:
-        parcel->readInt32(&frameRight) ?:
-        parcel->readInt32(&frameBottom) ?:
-        parcel->readInt32(&surfaceInset) ?:
-        parcel->readFloat(&globalScaleFactor) ?:
-        parcel->readFloat(&alpha) ?:
-        parcel->readFloat(&dsdx) ?:
-        parcel->readFloat(&dtdx) ?:
-        parcel->readFloat(&tx) ?:
-        parcel->readFloat(&dtdy) ?:
-        parcel->readFloat(&dsdy) ?:
-        parcel->readFloat(&ty) ?:
-        parcel->readInt32(&displayWidth) ?:
-        parcel->readInt32(&displayHeight) ?:
-        parcel->readBool(&visible) ?:
-        parcel->readBool(&focusable) ?:
-        parcel->readBool(&hasWallpaper) ?:
-        parcel->readBool(&paused) ?:
-        parcel->readBool(&trustedOverlay) ?:
-        parcel->readInt32(&touchOcclusionModeInt) ?:
-        parcel->readInt32(&ownerPid) ?:
-        parcel->readInt32(&ownerUid) ?:
-        parcel->readUtf8FromUtf16(&packageName);
-    // clang-format on
-
-    if (status != OK) {
-        return status;
-    }
-
-    touchOcclusionMode = static_cast<TouchOcclusionMode>(touchOcclusionModeInt);
-
-    inputFeatures = Flags<Feature>(parcel->readInt32());
-    status = parcel->readInt32(&displayId) ?:
-        parcel->readInt32(&portalToDisplayId) ?:
-        applicationInfo.readFromParcel(parcel) ?:
-        parcel->read(touchableRegion) ?:
-        parcel->readBool(&replaceTouchableRegionWithCrop);
-
-    if (status != OK) {
-        return status;
-    }
-
-    touchableRegionCropHandle = parcel->readStrongBinder();
-    transform.set({dsdx, dtdx, tx, dtdy, dsdy, ty, 0, 0, 1});
-
-    return OK;
-}
-
-// --- InputWindowHandle ---
-
-InputWindowHandle::InputWindowHandle() {}
-
-InputWindowHandle::~InputWindowHandle() {}
-
-InputWindowHandle::InputWindowHandle(const InputWindowHandle& other) : mInfo(other.mInfo) {}
-
-InputWindowHandle::InputWindowHandle(const InputWindowInfo& other) : mInfo(other) {}
-
-status_t InputWindowHandle::writeToParcel(android::Parcel* parcel) const {
-    return mInfo.writeToParcel(parcel);
-}
-
-status_t InputWindowHandle::readFromParcel(const android::Parcel* parcel) {
-    return mInfo.readFromParcel(parcel);
-}
-
-void InputWindowHandle::releaseChannel() {
-    mInfo.token.clear();
-}
-
-sp<IBinder> InputWindowHandle::getToken() const {
-    return mInfo.token;
-}
-
-void InputWindowHandle::updateFrom(sp<InputWindowHandle> handle) {
-    mInfo = handle->mInfo;
-}
-} // namespace android
diff --git a/libs/input/KeyCharacterMap.cpp b/libs/input/KeyCharacterMap.cpp
index 44f3f34..3baeb55 100644
--- a/libs/input/KeyCharacterMap.cpp
+++ b/libs/input/KeyCharacterMap.cpp
@@ -28,10 +28,11 @@
 #include <input/KeyCharacterMap.h>
 #include <input/Keyboard.h>
 
-#include <utils/Log.h>
+#include <gui/constants.h>
 #include <utils/Errors.h>
-#include <utils/Tokenizer.h>
+#include <utils/Log.h>
 #include <utils/Timers.h>
+#include <utils/Tokenizer.h>
 
 // Enables debug output for the parser.
 #define DEBUG_PARSER 0
diff --git a/libs/input/KeyLayoutMap.cpp b/libs/input/KeyLayoutMap.cpp
index fa5a541..c365ab0 100644
--- a/libs/input/KeyLayoutMap.cpp
+++ b/libs/input/KeyLayoutMap.cpp
@@ -19,10 +19,10 @@
 #include <stdlib.h>
 
 #include <android/keycodes.h>
+#include <ftl/NamedEnum.h>
 #include <input/InputEventLabels.h>
 #include <input/KeyLayoutMap.h>
 #include <input/Keyboard.h>
-#include <input/NamedEnum.h>
 #include <utils/Errors.h>
 #include <utils/Log.h>
 #include <utils/Timers.h>
diff --git a/libs/input/android/FocusRequest.aidl b/libs/input/android/FocusRequest.aidl
deleted file mode 100644
index 8812d34..0000000
--- a/libs/input/android/FocusRequest.aidl
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright (c) 2020, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android;
-
-/** @hide */
-parcelable FocusRequest {
-    /**
-     * Input channel token used to identify the window that should gain focus.
-     */
-    IBinder token;
-    @utf8InCpp String windowName;
-    /**
-     * The token that the caller expects currently to be focused. If the
-     * specified token does not match the currently focused window, this request will be dropped.
-     * If the specified focused token matches the currently focused window, the call will succeed.
-     * Set this to "null" if this call should succeed no matter what the currently focused token
-     * is.
-     */
-    @nullable IBinder focusedToken;
-    @utf8InCpp String focusedWindowName;
-    /**
-     * SYSTEM_TIME_MONOTONIC timestamp in nanos set by the client (wm) when requesting the focus
-     * change. This determines which request gets precedence if there is a focus change request
-     * from another source such as pointer down.
-     */
-    long timestamp;
-    /**
-     * Display id associated with this request.
-     */
-     int displayId;
-}
diff --git a/libs/input/android/InputApplicationInfo.aidl b/libs/input/android/InputApplicationInfo.aidl
deleted file mode 100644
index 9336039..0000000
--- a/libs/input/android/InputApplicationInfo.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) 2020, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android;
-
-parcelable InputApplicationInfo {
-    @nullable IBinder token;
-    @utf8InCpp String name;
-    long dispatchingTimeoutMillis;
-}
diff --git a/libs/input/android/InputWindowInfo.aidl b/libs/input/android/InputWindowInfo.aidl
deleted file mode 100644
index eeaf400..0000000
--- a/libs/input/android/InputWindowInfo.aidl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* //device/java/android/android/view/InputChannel.aidl
-**
-** Copyright 2020, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-package android;
-
-parcelable InputWindowInfo cpp_header "input/InputWindow.h";
diff --git a/libs/input/android/os/IInputFlinger.aidl b/libs/input/android/os/IInputFlinger.aidl
index 1771d19..43b262f 100644
--- a/libs/input/android/os/IInputFlinger.aidl
+++ b/libs/input/android/os/IInputFlinger.aidl
@@ -16,9 +16,9 @@
 
 package android.os;
 
-import android.FocusRequest;
 import android.InputChannel;
-import android.InputWindowInfo;
+import android.gui.FocusRequest;
+import android.gui.WindowInfo;
 import android.os.ISetInputWindowsListener;
 
 /** @hide */
@@ -28,7 +28,7 @@
     // ordering when needed.
     // SurfaceFlinger calls this only every VSync, so overflow of binder's oneway buffer
     // shouldn't be a concern.
-    oneway void setInputWindows(in InputWindowInfo[] inputHandles,
+    oneway void setInputWindows(in WindowInfo[] windowInfoHandles,
             in @nullable ISetInputWindowsListener setInputWindowsListener);
     InputChannel createInputChannel(in @utf8InCpp String name);
     void removeInputChannel(in IBinder connectionToken);
diff --git a/libs/input/android/os/TouchOcclusionMode.aidl b/libs/input/android/os/TouchOcclusionMode.aidl
deleted file mode 100644
index 106f159..0000000
--- a/libs/input/android/os/TouchOcclusionMode.aidl
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (c) 2020, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.os;
-
-
-/**
-  * Touch occlusion modes: These modes represent how windows are taken into
-  * consideration in order to decide whether to block obscured touches or
-  * not.
-  *
-  * @hide
-  */
-@Backing(type="int")
-enum TouchOcclusionMode {
-    /**
-      * Touches that pass through this window will be blocked if they are
-      * consumed by a different UID and this window is not trusted.
-      */
-    BLOCK_UNTRUSTED,
-
-    /**
-      * The window's opacity will be taken into consideration for touch
-      * occlusion rules if the touch passes through it and the window is not
-      * trusted.
-      */
-    USE_OPACITY,
-
-    /**
-      * The window won't count for touch occlusion rules if the touch passes
-      * through it.
-      */
-    ALLOW
-}
diff --git a/libs/input/tests/Android.bp b/libs/input/tests/Android.bp
index 6ffc6a8..18ab1cb 100644
--- a/libs/input/tests/Android.bp
+++ b/libs/input/tests/Android.bp
@@ -11,26 +11,24 @@
 cc_test {
     name: "libinput_tests",
     srcs: [
-        "NamedEnum_test.cpp",
-        "Flags_test.cpp",
         "IdGenerator_test.cpp",
         "InputChannel_test.cpp",
         "InputDevice_test.cpp",
         "InputEvent_test.cpp",
         "InputPublisherAndConsumer_test.cpp",
-        "InputWindow_test.cpp",
         "TouchVideoFrame_test.cpp",
         "VelocityTracker_test.cpp",
         "VerifiedInputEvent_test.cpp",
     ],
+    static_libs: [
+        "libgui_window_info_static",
+        "libinput",
+    ],
     cflags: [
         "-Wall",
         "-Wextra",
         "-Werror",
     ],
-    static_libs: [
-        "libinput",
-    ],
     shared_libs: [
         "libbase",
         "libbinder",
diff --git a/libs/input/tests/Flags_test.cpp b/libs/input/tests/Flags_test.cpp
deleted file mode 100644
index 6de030f..0000000
--- a/libs/input/tests/Flags_test.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include <input/Flags.h>
-
-#include <type_traits>
-
-namespace android::test {
-
-using namespace android::flag_operators;
-
-enum class TestFlags { ONE = 0x1, TWO = 0x2, THREE = 0x4 };
-
-TEST(Flags, Test) {
-    Flags<TestFlags> flags = TestFlags::ONE;
-    ASSERT_TRUE(flags.test(TestFlags::ONE));
-    ASSERT_FALSE(flags.test(TestFlags::TWO));
-    ASSERT_FALSE(flags.test(TestFlags::THREE));
-}
-
-TEST(Flags, Any) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
-    ASSERT_TRUE(flags.any(TestFlags::ONE));
-    ASSERT_TRUE(flags.any(TestFlags::TWO));
-    ASSERT_FALSE(flags.any(TestFlags::THREE));
-    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::TWO));
-    ASSERT_TRUE(flags.any(TestFlags::TWO | TestFlags::THREE));
-    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::THREE));
-    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));
-}
-
-TEST(Flags, All) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
-    ASSERT_TRUE(flags.all(TestFlags::ONE));
-    ASSERT_TRUE(flags.all(TestFlags::TWO));
-    ASSERT_FALSE(flags.all(TestFlags::THREE));
-    ASSERT_TRUE(flags.all(TestFlags::ONE | TestFlags::TWO));
-    ASSERT_FALSE(flags.all(TestFlags::TWO | TestFlags::THREE));
-    ASSERT_FALSE(flags.all(TestFlags::ONE | TestFlags::THREE));
-    ASSERT_FALSE(flags.all(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));
-}
-
-TEST(Flags, DefaultConstructor_hasNoFlagsSet) {
-    Flags<TestFlags> flags;
-    ASSERT_FALSE(flags.any(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));
-}
-
-TEST(Flags, NotOperator_onEmptyFlagsSetsAllFlags) {
-    Flags<TestFlags> flags;
-    flags = ~flags;
-    ASSERT_TRUE(flags.all(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));
-}
-
-TEST(Flags, NotOperator_onNonEmptyFlagsInvertsFlags) {
-    Flags<TestFlags> flags = TestFlags::TWO;
-    flags = ~flags;
-    ASSERT_TRUE(flags.all(TestFlags::ONE | TestFlags::THREE));
-    ASSERT_FALSE(flags.test(TestFlags::TWO));
-}
-
-TEST(Flags, OrOperator_withNewFlag) {
-    Flags<TestFlags> flags = TestFlags::ONE;
-    Flags<TestFlags> flags2 = flags | TestFlags::TWO;
-    ASSERT_FALSE(flags2.test(TestFlags::THREE));
-    ASSERT_TRUE(flags2.all(TestFlags::ONE | TestFlags::TWO));
-}
-
-TEST(Flags, OrOperator_withExistingFlag) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::THREE;
-    Flags<TestFlags> flags2 = flags | TestFlags::THREE;
-    ASSERT_FALSE(flags2.test(TestFlags::TWO));
-    ASSERT_TRUE(flags2.all(TestFlags::ONE | TestFlags::THREE));
-}
-
-TEST(Flags, OrEqualsOperator_withNewFlag) {
-    Flags<TestFlags> flags;
-    flags |= TestFlags::THREE;
-    ASSERT_TRUE(flags.test(TestFlags::THREE));
-    ASSERT_FALSE(flags.any(TestFlags::ONE | TestFlags::TWO));
-}
-
-TEST(Flags, OrEqualsOperator_withExistingFlag) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::THREE;
-    flags |= TestFlags::THREE;
-    ASSERT_TRUE(flags.all(TestFlags::ONE | TestFlags::THREE));
-    ASSERT_FALSE(flags.test(TestFlags::TWO));
-}
-
-TEST(Flags, AndOperator_withOneSetFlag) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::THREE;
-    Flags<TestFlags> andFlags = flags & TestFlags::THREE;
-    ASSERT_TRUE(andFlags.test(TestFlags::THREE));
-    ASSERT_FALSE(andFlags.any(TestFlags::ONE | TestFlags::TWO));
-}
-
-TEST(Flags, AndOperator_withMultipleSetFlags) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::THREE;
-    Flags<TestFlags> andFlags = flags & (TestFlags::ONE | TestFlags::THREE);
-    ASSERT_TRUE(andFlags.all(TestFlags::ONE | TestFlags::THREE));
-    ASSERT_FALSE(andFlags.test(TestFlags::TWO));
-}
-
-TEST(Flags, AndOperator_withNoSetFlags) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::THREE;
-    Flags<TestFlags> andFlags = flags & TestFlags::TWO;
-    ASSERT_FALSE(andFlags.any(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));
-}
-
-TEST(Flags, Equality) {
-    Flags<TestFlags> flags1 = TestFlags::ONE | TestFlags::TWO;
-    Flags<TestFlags> flags2 = TestFlags::ONE | TestFlags::TWO;
-    ASSERT_EQ(flags1, flags2);
-}
-
-TEST(Flags, Inequality) {
-    Flags<TestFlags> flags1 = TestFlags::ONE | TestFlags::TWO;
-    Flags<TestFlags> flags2 = TestFlags::ONE | TestFlags::THREE;
-    ASSERT_NE(flags1, flags2);
-}
-
-TEST(Flags, EqualsOperator) {
-    Flags<TestFlags> flags;
-    flags = TestFlags::ONE;
-    ASSERT_TRUE(flags.test(TestFlags::ONE));
-    ASSERT_FALSE(flags.any(TestFlags::TWO | TestFlags::THREE));
-}
-
-TEST(Flags, EqualsOperator_DontShareState) {
-    Flags<TestFlags> flags1 = TestFlags::ONE | TestFlags::TWO;
-    Flags<TestFlags> flags2 = flags1;
-    ASSERT_EQ(flags1, flags2);
-
-    flags1 &= TestFlags::TWO;
-    ASSERT_NE(flags1, flags2);
-}
-
-TEST(Flags, GetValue) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
-    ASSERT_EQ(flags.get(), 0x3);
-}
-
-TEST(Flags, String_NoFlags) {
-    Flags<TestFlags> flags;
-    ASSERT_EQ(flags.string(), "0x0");
-}
-
-TEST(Flags, String_KnownValues) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
-    ASSERT_EQ(flags.string(), "ONE | TWO");
-}
-
-TEST(Flags, String_UnknownValues) {
-    auto flags = Flags<TestFlags>(0b1011);
-    ASSERT_EQ(flags.string(), "ONE | TWO | 0x00000008");
-}
-
-TEST(FlagsIterator, IteratesOverAllFlags) {
-    Flags<TestFlags> flags1 = TestFlags::ONE | TestFlags::TWO;
-    Flags<TestFlags> flags2;
-    for (TestFlags f : flags1) {
-        flags2 |= f;
-    }
-    ASSERT_EQ(flags2, flags1);
-}
-
-TEST(FlagsIterator, IteratesInExpectedOrder) {
-    const std::vector<TestFlags> flagOrder = {TestFlags::ONE, TestFlags::TWO};
-    Flags<TestFlags> flags;
-    for (TestFlags f : flagOrder) {
-        flags |= f;
-    }
-
-    size_t idx = 0;
-    auto iter = flags.begin();
-    while (iter != flags.end() && idx < flagOrder.size()) {
-        // Make sure the order is what we expect
-        ASSERT_EQ(*iter, flagOrder[idx]);
-        iter++;
-        idx++;
-    }
-    ASSERT_EQ(iter, flags.end());
-}
-TEST(FlagsIterator, PostFixIncrement) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
-    auto iter = flags.begin();
-    ASSERT_EQ(*(iter++), TestFlags::ONE);
-    ASSERT_EQ(*iter, TestFlags::TWO);
-    ASSERT_EQ(*(iter++), TestFlags::TWO);
-    ASSERT_EQ(iter, flags.end());
-}
-
-TEST(FlagsIterator, PreFixIncrement) {
-    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
-    auto iter = flags.begin();
-    ASSERT_EQ(*++iter, TestFlags::TWO);
-    ASSERT_EQ(++iter, flags.end());
-}
-
-TEST(FlagNames, RuntimeFlagName) {
-    TestFlags f = TestFlags::ONE;
-    ASSERT_EQ(flag_name(f), "ONE");
-}
-
-TEST(FlagNames, RuntimeUnknownFlagName) {
-    TestFlags f = static_cast<TestFlags>(0x8);
-    ASSERT_EQ(flag_name(f), std::nullopt);
-}
-
-TEST(FlagNames, CompileTimeFlagName) {
-    static_assert(flag_name<TestFlags::TWO>() == "TWO");
-}
-
-} // namespace android::test
\ No newline at end of file
diff --git a/libs/input/tests/InputEvent_test.cpp b/libs/input/tests/InputEvent_test.cpp
index cfb5986..f1a26ec 100644
--- a/libs/input/tests/InputEvent_test.cpp
+++ b/libs/input/tests/InputEvent_test.cpp
@@ -20,6 +20,7 @@
 #include <attestation/HmacKeyManager.h>
 #include <binder/Parcel.h>
 #include <gtest/gtest.h>
+#include <gui/constants.h>
 #include <input/Input.h>
 
 namespace android {
@@ -271,9 +272,8 @@
                       AMOTION_EVENT_EDGE_FLAG_TOP, AMETA_ALT_ON, AMOTION_EVENT_BUTTON_PRIMARY,
                       MotionClassification::NONE, mTransform, 2.0f, 2.1f,
                       AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION,
-                      AMOTION_EVENT_INVALID_DISPLAY_SIZE, AMOTION_EVENT_INVALID_DISPLAY_SIZE,
-                      ARBITRARY_DOWN_TIME, ARBITRARY_EVENT_TIME, 2, pointerProperties,
-                      pointerCoords);
+                      INVALID_DISPLAY_SIZE, INVALID_DISPLAY_SIZE, ARBITRARY_DOWN_TIME,
+                      ARBITRARY_EVENT_TIME, 2, pointerProperties, pointerCoords);
 
     pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 110);
     pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 111);
@@ -593,9 +593,8 @@
                      AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/,
                      MotionClassification::NONE, identityTransform, 0 /*xPrecision*/,
                      0 /*yPrecision*/, 3 + RADIUS /*xCursorPosition*/, 2 /*yCursorPosition*/,
-                     AMOTION_EVENT_INVALID_DISPLAY_SIZE, AMOTION_EVENT_INVALID_DISPLAY_SIZE,
-                     0 /*downTime*/, 0 /*eventTime*/, pointerCount, pointerProperties,
-                     pointerCoords);
+                     INVALID_DISPLAY_SIZE, INVALID_DISPLAY_SIZE, 0 /*downTime*/, 0 /*eventTime*/,
+                     pointerCount, pointerProperties, pointerCoords);
     float originalRawX = 0 + 3;
     float originalRawY = -RADIUS + 2;
 
@@ -795,9 +794,9 @@
                          DISPLAY_ID, INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, 0, 0,
                          AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0, classification,
                          identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
-                         AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_DISPLAY_SIZE,
-                         AMOTION_EVENT_INVALID_DISPLAY_SIZE, 0 /*downTime*/, 0 /*eventTime*/,
-                         pointerCount, pointerProperties, pointerCoords);
+                         AMOTION_EVENT_INVALID_CURSOR_POSITION, INVALID_DISPLAY_SIZE,
+                         INVALID_DISPLAY_SIZE, 0 /*downTime*/, 0 /*eventTime*/, pointerCount,
+                         pointerProperties, pointerCoords);
         ASSERT_EQ(classification, event.getClassification());
     }
 }
@@ -817,10 +816,9 @@
     event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_MOUSE, DISPLAY_ID,
                      INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, 0, 0, AMOTION_EVENT_EDGE_FLAG_NONE,
                      AMETA_NONE, 0, MotionClassification::NONE, identityTransform, 0, 0,
-                     280 /*xCursorPosition*/, 540 /*yCursorPosition*/,
-                     AMOTION_EVENT_INVALID_DISPLAY_SIZE, AMOTION_EVENT_INVALID_DISPLAY_SIZE,
-                     0 /*downTime*/, 0 /*eventTime*/, pointerCount, pointerProperties,
-                     pointerCoords);
+                     280 /*xCursorPosition*/, 540 /*yCursorPosition*/, INVALID_DISPLAY_SIZE,
+                     INVALID_DISPLAY_SIZE, 0 /*downTime*/, 0 /*eventTime*/, pointerCount,
+                     pointerProperties, pointerCoords);
     event.offsetLocation(20, 60);
     ASSERT_EQ(280, event.getRawXCursorPosition());
     ASSERT_EQ(540, event.getRawYCursorPosition());
diff --git a/libs/input/tests/InputPublisherAndConsumer_test.cpp b/libs/input/tests/InputPublisherAndConsumer_test.cpp
index a2cfaa1..d0c337c 100644
--- a/libs/input/tests/InputPublisherAndConsumer_test.cpp
+++ b/libs/input/tests/InputPublisherAndConsumer_test.cpp
@@ -23,6 +23,7 @@
 #include <attestation/HmacKeyManager.h>
 #include <cutils/ashmem.h>
 #include <gtest/gtest.h>
+#include <gui/constants.h>
 #include <input/InputTransport.h>
 #include <utils/StopWatch.h>
 #include <utils/Timers.h>
diff --git a/libs/input/tests/InputWindow_test.cpp b/libs/input/tests/InputWindow_test.cpp
deleted file mode 100644
index 493f2f4..0000000
--- a/libs/input/tests/InputWindow_test.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-
-#include <binder/Binder.h>
-#include <binder/Parcel.h>
-
-#include <input/InputWindow.h>
-#include <input/InputTransport.h>
-
-using std::chrono_literals::operator""s;
-
-namespace android {
-namespace test {
-
-TEST(InputWindowInfo, ParcellingWithoutToken) {
-    InputWindowInfo i, i2;
-    i.token = nullptr;
-
-    Parcel p;
-    ASSERT_EQ(OK, i.writeToParcel(&p));
-    p.setDataPosition(0);
-    i2.readFromParcel(&p);
-    ASSERT_TRUE(i2.token == nullptr);
-}
-
-TEST(InputWindowInfo, Parcelling) {
-    sp<IBinder> touchableRegionCropHandle = new BBinder();
-    InputWindowInfo i;
-    i.token = new BBinder();
-    i.id = 1;
-    i.name = "Foobar";
-    i.flags = InputWindowInfo::Flag::SLIPPERY;
-    i.type = InputWindowInfo::Type::INPUT_METHOD;
-    i.dispatchingTimeout = 12s;
-    i.frameLeft = 93;
-    i.frameTop = 34;
-    i.frameRight = 16;
-    i.frameBottom = 19;
-    i.surfaceInset = 17;
-    i.globalScaleFactor = 0.3;
-    i.alpha = 0.7;
-    i.transform.set({0.4, -1, 100, 0.5, 0, 40, 0, 0, 1});
-    i.displayWidth = 1000;
-    i.displayHeight = 2000;
-    i.visible = false;
-    i.focusable = false;
-    i.hasWallpaper = false;
-    i.paused = false;
-    i.touchOcclusionMode = TouchOcclusionMode::ALLOW;
-    i.ownerPid = 19;
-    i.ownerUid = 24;
-    i.packageName = "com.example.package";
-    i.inputFeatures = InputWindowInfo::Feature::DISABLE_USER_ACTIVITY;
-    i.displayId = 34;
-    i.portalToDisplayId = 2;
-    i.replaceTouchableRegionWithCrop = true;
-    i.touchableRegionCropHandle = touchableRegionCropHandle;
-    i.applicationInfo.name = "ApplicationFooBar";
-    i.applicationInfo.token = new BBinder();
-    i.applicationInfo.dispatchingTimeoutMillis = 0x12345678ABCD;
-
-    Parcel p;
-    i.writeToParcel(&p);
-    p.setDataPosition(0);
-    InputWindowInfo i2;
-    i2.readFromParcel(&p);
-    ASSERT_EQ(i.token, i2.token);
-    ASSERT_EQ(i.id, i2.id);
-    ASSERT_EQ(i.name, i2.name);
-    ASSERT_EQ(i.flags, i2.flags);
-    ASSERT_EQ(i.type, i2.type);
-    ASSERT_EQ(i.dispatchingTimeout, i2.dispatchingTimeout);
-    ASSERT_EQ(i.frameLeft, i2.frameLeft);
-    ASSERT_EQ(i.frameTop, i2.frameTop);
-    ASSERT_EQ(i.frameRight, i2.frameRight);
-    ASSERT_EQ(i.frameBottom, i2.frameBottom);
-    ASSERT_EQ(i.surfaceInset, i2.surfaceInset);
-    ASSERT_EQ(i.globalScaleFactor, i2.globalScaleFactor);
-    ASSERT_EQ(i.alpha, i2.alpha);
-    ASSERT_EQ(i.transform, i2.transform);
-    ASSERT_EQ(i.displayWidth, i2.displayWidth);
-    ASSERT_EQ(i.displayHeight, i2.displayHeight);
-    ASSERT_EQ(i.visible, i2.visible);
-    ASSERT_EQ(i.focusable, i2.focusable);
-    ASSERT_EQ(i.hasWallpaper, i2.hasWallpaper);
-    ASSERT_EQ(i.paused, i2.paused);
-    ASSERT_EQ(i.touchOcclusionMode, i2.touchOcclusionMode);
-    ASSERT_EQ(i.ownerPid, i2.ownerPid);
-    ASSERT_EQ(i.ownerUid, i2.ownerUid);
-    ASSERT_EQ(i.packageName, i2.packageName);
-    ASSERT_EQ(i.inputFeatures, i2.inputFeatures);
-    ASSERT_EQ(i.displayId, i2.displayId);
-    ASSERT_EQ(i.portalToDisplayId, i2.portalToDisplayId);
-    ASSERT_EQ(i.replaceTouchableRegionWithCrop, i2.replaceTouchableRegionWithCrop);
-    ASSERT_EQ(i.touchableRegionCropHandle, i2.touchableRegionCropHandle);
-    ASSERT_EQ(i.applicationInfo, i2.applicationInfo);
-}
-
-TEST(InputApplicationInfo, Parcelling) {
-    InputApplicationInfo i;
-    i.token = new BBinder();
-    i.name = "ApplicationFooBar";
-    i.dispatchingTimeoutMillis = 0x12345678ABCD;
-
-    Parcel p;
-    ASSERT_EQ(i.writeToParcel(&p), OK);
-    p.setDataPosition(0);
-    InputApplicationInfo i2;
-    ASSERT_EQ(i2.readFromParcel(&p), OK);
-    ASSERT_EQ(i, i2);
-}
-
-} // namespace test
-} // namespace android
diff --git a/libs/input/tests/NamedEnum_test.cpp b/libs/input/tests/NamedEnum_test.cpp
deleted file mode 100644
index 74a0044..0000000
--- a/libs/input/tests/NamedEnum_test.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include <input/NamedEnum.h>
-
-namespace android {
-
-// Test enum class maximum enum value smaller than default maximum of 8.
-enum class TestEnums { ZERO = 0x0, ONE = 0x1, TWO = 0x2, THREE = 0x3, SEVEN = 0x7 };
-// Big enum contains enum values greater than default maximum of 8.
-enum class TestBigEnums { ZERO = 0x0, FIFTEEN = 0xF };
-
-// Declared to specialize the maximum enum since the enum size exceeds 8 by default.
-template <>
-constexpr size_t NamedEnum::max<TestBigEnums> = 16;
-
-namespace test {
-using android::TestBigEnums;
-using android::TestEnums;
-
-TEST(NamedEnum, RuntimeNamedEnum) {
-    TestEnums e = TestEnums::ZERO;
-    ASSERT_EQ(NamedEnum::enum_name(e), "ZERO");
-
-    e = TestEnums::ONE;
-    ASSERT_EQ(NamedEnum::enum_name(e), "ONE");
-
-    e = TestEnums::THREE;
-    ASSERT_EQ(NamedEnum::enum_name(e), "THREE");
-
-    e = TestEnums::SEVEN;
-    ASSERT_EQ(NamedEnum::enum_name(e), "SEVEN");
-}
-
-// Test big enum
-TEST(NamedEnum, RuntimeBigNamedEnum) {
-    TestBigEnums e = TestBigEnums::ZERO;
-    ASSERT_EQ(NamedEnum::enum_name(e), "ZERO");
-
-    e = TestBigEnums::FIFTEEN;
-    ASSERT_EQ(NamedEnum::enum_name(e), "FIFTEEN");
-}
-
-TEST(NamedEnum, RuntimeNamedEnumAsString) {
-    TestEnums e = TestEnums::ZERO;
-    ASSERT_EQ(NamedEnum::string(e), "ZERO");
-
-    e = TestEnums::ONE;
-    ASSERT_EQ(NamedEnum::string(e), "ONE");
-
-    e = TestEnums::THREE;
-    ASSERT_EQ(NamedEnum::string(e), "THREE");
-
-    e = TestEnums::SEVEN;
-    ASSERT_EQ(NamedEnum::string(e), "SEVEN");
-}
-
-TEST(NamedEnum, RuntimeBigNamedEnumAsString) {
-    TestBigEnums e = TestBigEnums::ZERO;
-    ASSERT_EQ(NamedEnum::string(e), "ZERO");
-
-    e = TestBigEnums::FIFTEEN;
-    ASSERT_EQ(NamedEnum::string(e), "FIFTEEN");
-}
-
-TEST(NamedEnum, RuntimeUnknownNamedEnum) {
-    TestEnums e = static_cast<TestEnums>(0x5);
-    ASSERT_EQ(NamedEnum::enum_name(e), std::nullopt);
-    e = static_cast<TestEnums>(0x9);
-    ASSERT_EQ(NamedEnum::enum_name(e), std::nullopt);
-}
-
-TEST(NamedEnum, RuntimeUnknownNamedEnumAsString) {
-    TestEnums e = static_cast<TestEnums>(0x5);
-    ASSERT_EQ(NamedEnum::string(e), "05");
-    e = static_cast<TestEnums>(0x9);
-    ASSERT_EQ(NamedEnum::string(e, "0x%08x"), "0x00000009");
-}
-
-TEST(NamedEnum, CompileTimeFlagName) {
-    static_assert(NamedEnum::enum_name<TestEnums::TWO>() == "TWO");
-    static_assert(NamedEnum::enum_name<TestEnums::THREE>() == "THREE");
-}
-
-} // namespace test
-
-} // namespace android
diff --git a/libs/input/tests/VelocityTracker_test.cpp b/libs/input/tests/VelocityTracker_test.cpp
index aefc2ec..8ae7dcc 100644
--- a/libs/input/tests/VelocityTracker_test.cpp
+++ b/libs/input/tests/VelocityTracker_test.cpp
@@ -23,6 +23,7 @@
 #include <android-base/stringprintf.h>
 #include <attestation/HmacKeyManager.h>
 #include <gtest/gtest.h>
+#include <gui/constants.h>
 #include <input/VelocityTracker.h>
 
 using namespace std::chrono_literals;
@@ -183,9 +184,9 @@
                          AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/,
                          MotionClassification::NONE, identityTransform, 0 /*xPrecision*/,
                          0 /*yPrecision*/, AMOTION_EVENT_INVALID_CURSOR_POSITION,
-                         AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_DISPLAY_SIZE,
-                         AMOTION_EVENT_INVALID_DISPLAY_SIZE, 0 /*downTime*/,
-                         entry.eventTime.count(), pointerCount, properties, coords);
+                         AMOTION_EVENT_INVALID_CURSOR_POSITION, INVALID_DISPLAY_SIZE,
+                         INVALID_DISPLAY_SIZE, 0 /*downTime*/, entry.eventTime.count(),
+                         pointerCount, properties, coords);
 
         events.emplace_back(event);
     }
diff --git a/libs/input/tests/VerifiedInputEvent_test.cpp b/libs/input/tests/VerifiedInputEvent_test.cpp
index f79098c..a0c9c17 100644
--- a/libs/input/tests/VerifiedInputEvent_test.cpp
+++ b/libs/input/tests/VerifiedInputEvent_test.cpp
@@ -16,6 +16,7 @@
 
 #include <attestation/HmacKeyManager.h>
 #include <gtest/gtest.h>
+#include <gui/constants.h>
 #include <input/Input.h>
 
 namespace android {
@@ -46,10 +47,9 @@
                      INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, 0 /*actionButton*/, flags,
                      AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/,
                      MotionClassification::NONE, transform, 0.1 /*xPrecision*/, 0.2 /*yPrecision*/,
-                     280 /*xCursorPosition*/, 540 /*yCursorPosition*/,
-                     AMOTION_EVENT_INVALID_DISPLAY_SIZE, AMOTION_EVENT_INVALID_DISPLAY_SIZE,
-                     100 /*downTime*/, 200 /*eventTime*/, pointerCount, pointerProperties,
-                     pointerCoords);
+                     280 /*xCursorPosition*/, 540 /*yCursorPosition*/, INVALID_DISPLAY_SIZE,
+                     INVALID_DISPLAY_SIZE, 100 /*downTime*/, 200 /*eventTime*/, pointerCount,
+                     pointerProperties, pointerCoords);
     return event;
 }