Move displayid into InputEvent

There are certain use cases where key events should be associated with a
particular display. Refactor KeyEvent and MotionEvent to have an
associated display id.

Remove "hasAssociatedDisplay" variable from KeyboardInputMapper,
it just used to mirror "isOrientationAware".

If the keyboard is orientation aware (= it is physically attached to a
display, and therefore rotates together with that display), then
associate that keyboard with the internal viewport. Otherwise, the key
events are not associated with any particular display.

Remaining to do:
- make mInternalDisplay, mExternalDisplay, mVirtualDisplays into a
single vector with type (internal, external, virtual)
- have getDisplayViewport return std::optional (will require deep
changes)

Bug: 64258305
Test: atest inputflinger_tests libinput_tests

Change-Id: I4fe145e74cb59310efaa55bfc9dc3c2b3bd997e3
diff --git a/include/input/Input.h b/include/input/Input.h
index 15c86eb..7c4379e 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -302,12 +302,18 @@
 
     inline void setSource(int32_t source) { mSource = source; }
 
+    inline int32_t getDisplayId() const { return mDisplayId; }
+
+    inline void setDisplayId(int32_t displayId) { mDisplayId = displayId; }
+
+
 protected:
-    void initialize(int32_t deviceId, int32_t source);
+    void initialize(int32_t deviceId, int32_t source, int32_t displayId);
     void initialize(const InputEvent& from);
 
     int32_t mDeviceId;
     int32_t mSource;
+    int32_t mDisplayId;
 };
 
 /*
@@ -343,6 +349,7 @@
     void initialize(
             int32_t deviceId,
             int32_t source,
+            int32_t displayId,
             int32_t action,
             int32_t flags,
             int32_t keyCode,
@@ -373,10 +380,6 @@
 
     virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; }
 
-    inline int32_t getDisplayId() const { return mDisplayId; }
-
-    inline void setDisplayId(int32_t displayId) { mDisplayId = displayId; }
-
     inline int32_t getAction() const { return mAction; }
 
     inline int32_t getActionMasked() const { return mAction & AMOTION_EVENT_ACTION_MASK; }
@@ -614,7 +617,6 @@
     static int32_t getAxisFromLabel(const char* label);
 
 protected:
-    int32_t mDisplayId;
     int32_t mAction;
     int32_t mActionButton;
     int32_t mFlags;