summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-08-25 19:13:06 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-08-25 19:13:06 +0000
commit851c191932af07f72b5f33666a2802772cb04e54 (patch)
treea923843f3f37e98b6a5d4a45759c00fb02ce607e /services/inputflinger/InputManager.cpp
parent931a8975c473eeb38d50de19dfb5c414d74f0e58 (diff)
parentb56e92c4a63663cbadf9f5b7958f8e0521a8296e (diff)
Merge "Introduce PointerChoreographer stage in C++" into main
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r--services/inputflinger/InputManager.cpp22
1 files changed, 21 insertions, 1 deletions
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<IInputFlingerRust> createInputFlingerRust() {
* 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 @@ InputManager::InputManager(const sp<InputReaderPolicyInterface>& readerPolicy,
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 @@ 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) {