summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2022-08-16 19:08:21 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-08-16 19:08:21 +0000
commit44732cde9e19a005def5e110140963a5c2e2f5ae (patch)
tree9a4deff758bed03ccc5ff838dc55f467c303d762 /services/inputflinger/InputManager.cpp
parent896cdca96956b6f14e262380b34a0b04e1214b50 (diff)
parent91192c8103e78895c57d9da1fc04c8695898580f (diff)
Merge "DO NOT MERGE - Merge Android 13"
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r--services/inputflinger/InputManager.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 7b3658dfde..9767cd9b71 100644
--- a/services/inputflinger/InputManager.cpp
+++ b/services/inputflinger/InputManager.cpp
@@ -21,6 +21,7 @@
#include "InputManager.h"
#include "InputDispatcherFactory.h"
#include "InputReaderFactory.h"
+#include "UnwantedInteractionBlocker.h"
#include <binder/IPCThreadState.h>
@@ -32,8 +33,6 @@
namespace android {
using gui::FocusRequest;
-using gui::WindowInfo;
-using gui::WindowInfoHandle;
static int32_t exceptionCodeFromStatusT(status_t status) {
switch (status) {
@@ -54,12 +53,17 @@ static int32_t exceptionCodeFromStatusT(status_t status) {
}
}
+/**
+ * The event flow is via the "InputListener" interface, as follows:
+ * InputReader -> UnwantedInteractionBlocker -> InputClassifier -> InputDispatcher
+ */
InputManager::InputManager(
const sp<InputReaderPolicyInterface>& readerPolicy,
const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) {
mDispatcher = createInputDispatcher(dispatcherPolicy);
- mClassifier = new InputClassifier(mDispatcher);
- mReader = createInputReader(readerPolicy, mClassifier);
+ mClassifier = std::make_unique<InputClassifier>(*mDispatcher);
+ mBlocker = std::make_unique<UnwantedInteractionBlocker>(*mClassifier);
+ mReader = createInputReader(readerPolicy, *mBlocker);
}
InputManager::~InputManager() {
@@ -102,16 +106,27 @@ status_t InputManager::stop() {
return status;
}
-sp<InputReaderInterface> InputManager::getReader() {
- return mReader;
+InputReaderInterface& InputManager::getReader() {
+ return *mReader;
+}
+
+UnwantedInteractionBlockerInterface& InputManager::getUnwantedInteractionBlocker() {
+ return *mBlocker;
+}
+
+InputClassifierInterface& InputManager::getClassifier() {
+ return *mClassifier;
}
-sp<InputClassifierInterface> InputManager::getClassifier() {
- return mClassifier;
+InputDispatcherInterface& InputManager::getDispatcher() {
+ return *mDispatcher;
}
-sp<InputDispatcherInterface> InputManager::getDispatcher() {
- return mDispatcher;
+void InputManager::monitor() {
+ mReader->monitor();
+ mBlocker->monitor();
+ mClassifier->monitor();
+ mDispatcher->monitor();
}
// Used by tests only.