summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2022-06-29 21:21:49 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-06-29 21:21:49 +0000
commit618c76e5c04f99f2e295fcd2ffcb896476a68f38 (patch)
treedb84b827307260c3e1e05d5d30a08c08d427e158 /services/inputflinger/InputManager.cpp
parent31afdea9a497881604f2395b7a870d4ee21497c6 (diff)
parent552bdbb3f7e423c4047ed209917a12f8cadf86e9 (diff)
Merge "Merge tm-dev-plus-aosp-without-vendor@8763363" into stage-aosp-master
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.