Introduce PointerChoreographer stage in C++
PointerChoreographer will be the new inputflinger component responsible
for managing the pointer icons drawn on the screen.
In this CL, we set up the PointerChoreographer InputListener stage,
which will be created when the choreographer is enabled.
Bug: 293587049
Bug: 278783893
Test: adb shell setprop persist.input.enable_pointer_choreographer 1;
boot
Change-Id: Ice610055ef7ffc44c7c3e1d3904715eabda31a86
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 0733a1c..0567a32 100644
--- a/services/inputflinger/InputManager.cpp
+++ b/services/inputflinger/InputManager.cpp
@@ -38,6 +38,9 @@
const bool ENABLE_INPUT_DEVICE_USAGE_METRICS =
sysprop::InputProperties::enable_input_device_usage_metrics().value_or(true);
+const bool ENABLE_POINTER_CHOREOGRAPHER =
+ sysprop::InputProperties::enable_pointer_choreographer().value_or(false);
+
int32_t exceptionCodeFromStatusT(status_t status) {
switch (status) {
case OK:
@@ -113,12 +116,14 @@
* The event flow is via the "InputListener" interface, as follows:
* InputReader
* -> UnwantedInteractionBlocker
+ * -> PointerChoreographer
* -> InputProcessor
* -> InputDeviceMetricsCollector
* -> InputDispatcher
*/
InputManager::InputManager(const sp<InputReaderPolicyInterface>& readerPolicy,
- InputDispatcherPolicyInterface& dispatcherPolicy) {
+ InputDispatcherPolicyInterface& dispatcherPolicy,
+ PointerChoreographerPolicyInterface& choreographerPolicy) {
mInputFlingerRust = createInputFlingerRust();
mDispatcher = createInputDispatcher(dispatcherPolicy);
@@ -135,6 +140,13 @@
mTracingStages.emplace_back(
std::make_unique<TracedInputListener>("InputProcessor", *mProcessor));
+ if (ENABLE_POINTER_CHOREOGRAPHER) {
+ mChoreographer =
+ std::make_unique<PointerChoreographer>(*mTracingStages.back(), choreographerPolicy);
+ mTracingStages.emplace_back(
+ std::make_unique<TracedInputListener>("PointerChoreographer", *mChoreographer));
+ }
+
mBlocker = std::make_unique<UnwantedInteractionBlocker>(*mTracingStages.back());
mTracingStages.emplace_back(
std::make_unique<TracedInputListener>("UnwantedInteractionBlocker", *mBlocker));
@@ -186,6 +198,10 @@
return *mReader;
}
+PointerChoreographerInterface& InputManager::getChoreographer() {
+ return *mChoreographer;
+}
+
InputProcessorInterface& InputManager::getProcessor() {
return *mProcessor;
}
@@ -210,6 +226,10 @@
dump += '\n';
mBlocker->dump(dump);
dump += '\n';
+ if (ENABLE_POINTER_CHOREOGRAPHER) {
+ mChoreographer->dump(dump);
+ dump += '\n';
+ }
mProcessor->dump(dump);
dump += '\n';
if (ENABLE_INPUT_DEVICE_USAGE_METRICS) {