diff options
author | 2022-08-16 11:49:27 -0700 | |
---|---|---|
committer | 2022-08-16 11:49:27 -0700 | |
commit | 91192c8103e78895c57d9da1fc04c8695898580f (patch) | |
tree | 9a4deff758bed03ccc5ff838dc55f467c303d762 /services/inputflinger/InputManager.cpp | |
parent | 896cdca96956b6f14e262380b34a0b04e1214b50 (diff) | |
parent | a7459772bbc558b8b13df09de8b0cea156d81870 (diff) |
DO NOT MERGE - Merge Android 13
Bug: 242648940
Merged-In: Ia3eae81cc26b28b0d25dc5f5c6cd04ec8c1bafdf
Change-Id: Icd8e5ea85bfed76d58c81368d94dd1f6101fc087
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r-- | services/inputflinger/InputManager.cpp | 35 |
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. |