diff options
| author | 2019-10-02 17:08:26 -0700 | |
|---|---|---|
| committer | 2019-12-05 15:35:50 -0800 | |
| commit | 3608aadd736d28b9594dea54cd07cc628955b4e0 (patch) | |
| tree | 92807a4a88bc8b865386c6ebc5c7452d385a7009 /services/inputflinger/InputManager.cpp | |
| parent | 28efc19d395bca5c747d71d392dfbeccf42b00be (diff) | |
Let InputDispatcher handle its own thread
We move the threading logic from InputManger to InputDispatcher by
removing dispatchOnce() method from InputDispatcherInterface and adding
a start() and stop() method in its place.
Bug: 130819454
Test: atest inputflinger_tests
Test: Touch input works on crosshatch
Change-Id: I1d06be2330a2f8b9261fd5c5323a486d6aa544e8
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
| -rw-r--r-- | services/inputflinger/InputManager.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index 1043390f84..c7c61cf1ef 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -20,7 +20,6 @@ #include "InputManager.h" #include "InputDispatcherFactory.h" -#include "InputDispatcherThread.h" #include "InputReaderFactory.h" #include <binder/IPCThreadState.h> @@ -38,19 +37,14 @@ InputManager::InputManager( mDispatcher = createInputDispatcher(dispatcherPolicy); mClassifier = new InputClassifier(mDispatcher); mReader = createInputReader(readerPolicy, mClassifier); - initialize(); } InputManager::~InputManager() { stop(); } -void InputManager::initialize() { - mDispatcherThread = new InputDispatcherThread(mDispatcher); -} - status_t InputManager::start() { - status_t result = mDispatcherThread->run("InputDispatcher", PRIORITY_URGENT_DISPLAY); + status_t result = mDispatcher->start(); if (result) { ALOGE("Could not start InputDispatcher thread due to error %d.", result); return result; @@ -60,7 +54,7 @@ status_t InputManager::start() { if (result) { ALOGE("Could not start InputReader due to error %d.", result); - mDispatcherThread->requestExit(); + mDispatcher->stop(); return result; } @@ -68,17 +62,21 @@ status_t InputManager::start() { } status_t InputManager::stop() { + status_t status = OK; + status_t result = mReader->stop(); if (result) { ALOGW("Could not stop InputReader due to error %d.", result); + status = result; } - result = mDispatcherThread->requestExitAndWait(); + result = mDispatcher->stop(); if (result) { ALOGW("Could not stop InputDispatcher thread due to error %d.", result); + status = result; } - return OK; + return status; } sp<InputReaderInterface> InputManager::getReader() { |