Mock InputDevice in the InputMapper unit tests

This makes the InputMapperUnitTest subclasses easier to test, as the
tests will not have to rely on the behavior of actual InputDevice
implementation.

Unfortunately, this means InputDevice must now be a virtual class to
allow its mocked subclass to define its behavior for the methods that we
want to change. In this CL, we take the approach of only marking the
methods that we need to customize as virtual to avoid the overhead of
vtable lookups at runtime.

An alternative approach would be to introduce a type parameter to
InputDeviceContext to allow us to specify a different InputDevice
implementation in the tests. This would eliminate any addtional runtime
overheads resulting from vtable lookups. However, this would mean every
InputMapper class would need to have this new type parameter, adding
verbosity and complextity to the codebase. For this reason, the virtual
member approach was preferred.

Bug: 354270482
Bug: 353128452
Test: atest inputflinger_tests
Flag: EXEMPT refactor
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:31d05c4c78e7924e4bb6dc45092e612a9c7d5bfb)
Merged-In: Id7e103e1f04812c92ee8ecfdfe1e75a9949efa9e
Change-Id: Id7e103e1f04812c92ee8ecfdfe1e75a9949efa9e
diff --git a/services/inputflinger/reader/include/InputDevice.h b/services/inputflinger/reader/include/InputDevice.h
index 2a7e262..200c878 100644
--- a/services/inputflinger/reader/include/InputDevice.h
+++ b/services/inputflinger/reader/include/InputDevice.h
@@ -43,7 +43,7 @@
 public:
     InputDevice(InputReaderContext* context, int32_t id, int32_t generation,
                 const InputDeviceIdentifier& identifier);
-    ~InputDevice();
+    virtual ~InputDevice();
 
     inline InputReaderContext* getContext() { return mContext; }
     inline int32_t getId() const { return mId; }
@@ -56,7 +56,7 @@
     }
     inline const std::string getLocation() const { return mIdentifier.location; }
     inline ftl::Flags<InputDeviceClass> getClasses() const { return mClasses; }
-    inline uint32_t getSources() const { return mSources; }
+    inline virtual uint32_t getSources() const { return mSources; }
     inline bool hasEventHubDevices() const { return !mDevices.empty(); }
 
     inline bool isExternal() { return mIsExternal; }
@@ -132,7 +132,7 @@
 
     [[nodiscard]] NotifyDeviceResetArgs notifyReset(nsecs_t when);
 
-    inline const PropertyMap& getConfiguration() { return mConfiguration; }
+    inline virtual const PropertyMap& getConfiguration() const { return mConfiguration; }
     inline EventHubInterface* getEventHub() { return mContext->getEventHub(); }
 
     std::optional<ui::LogicalDisplayId> getAssociatedDisplayId();