From b56e92c4a63663cbadf9f5b7958f8e0521a8296e Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Fri, 9 Jun 2023 23:40:37 +0000 Subject: 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 --- services/inputflinger/InputManager.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'services/inputflinger/InputManager.cpp') diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index 0733a1c7c6..0567a32550 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -38,6 +38,9 @@ namespace { 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 @@ std::shared_ptr createInputFlingerRust() { * The event flow is via the "InputListener" interface, as follows: * InputReader * -> UnwantedInteractionBlocker + * -> PointerChoreographer * -> InputProcessor * -> InputDeviceMetricsCollector * -> InputDispatcher */ InputManager::InputManager(const sp& readerPolicy, - InputDispatcherPolicyInterface& dispatcherPolicy) { + InputDispatcherPolicyInterface& dispatcherPolicy, + PointerChoreographerPolicyInterface& choreographerPolicy) { mInputFlingerRust = createInputFlingerRust(); mDispatcher = createInputDispatcher(dispatcherPolicy); @@ -135,6 +140,13 @@ InputManager::InputManager(const sp& readerPolicy, mTracingStages.emplace_back( std::make_unique("InputProcessor", *mProcessor)); + if (ENABLE_POINTER_CHOREOGRAPHER) { + mChoreographer = + std::make_unique(*mTracingStages.back(), choreographerPolicy); + mTracingStages.emplace_back( + std::make_unique("PointerChoreographer", *mChoreographer)); + } + mBlocker = std::make_unique(*mTracingStages.back()); mTracingStages.emplace_back( std::make_unique("UnwantedInteractionBlocker", *mBlocker)); @@ -186,6 +198,10 @@ InputReaderInterface& InputManager::getReader() { return *mReader; } +PointerChoreographerInterface& InputManager::getChoreographer() { + return *mChoreographer; +} + InputProcessorInterface& InputManager::getProcessor() { return *mProcessor; } @@ -210,6 +226,10 @@ void InputManager::dump(std::string& dump) { 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) { -- cgit v1.2.3-59-g8ed1b