Let InputReaderContext hold a single PointerController
InputMappers obtain the pointer controller directly from the policy,
which, when we support multiple pointer controller, makes it natural to
have one pointer controller for an input device.
Rather than that, we want to build a system that makes it more natural
to have one pointer per display. To give more control over the
management of pointers, we make it so that InputReaderContext is
responsible for managing the pointer controller.
Bug: 146385350
Test: atest inputflinger_tests
Change-Id: I0b9276ed4a7f55f04f910dd484ecc7f767b8723b
diff --git a/services/inputflinger/reader/include/InputReader.h b/services/inputflinger/reader/include/InputReader.h
index 31d82f1..ca1a081 100644
--- a/services/inputflinger/reader/include/InputReader.h
+++ b/services/inputflinger/reader/include/InputReader.h
@@ -23,6 +23,7 @@
#include "InputReaderContext.h"
#include "InputThread.h"
+#include <PointerControllerInterface.h>
#include <utils/Condition.h>
#include <utils/Mutex.h>
@@ -102,6 +103,7 @@
virtual void disableVirtualKeysUntil(nsecs_t time) override;
virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) override;
virtual void fadePointer() override;
+ virtual sp<PointerControllerInterface> getPointerController(int32_t deviceId) override;
virtual void requestTimeoutAtTime(nsecs_t when) override;
virtual int32_t bumpGeneration() override;
virtual void getExternalStylusDevices(std::vector<InputDeviceInfo>& outDevices) override;
@@ -159,6 +161,10 @@
void getExternalStylusDevicesLocked(std::vector<InputDeviceInfo>& outDevices);
void dispatchExternalStylusState(const StylusState& state);
+ // The PointerController that is shared among all the input devices that need it.
+ wp<PointerControllerInterface> mPointerController;
+ sp<PointerControllerInterface> getPointerControllerLocked(int32_t deviceId);
+ void updatePointerDisplayLocked();
void fadePointerLocked();
int32_t mGeneration;