diff options
author | 2018-09-24 13:18:43 -0700 | |
---|---|---|
committer | 2018-11-27 12:39:33 -0800 | |
commit | 1c4c5599696d049b112c40d629f8c74bb612b01f (patch) | |
tree | d0da6e66f155d1d5e3573e5f4c99d2781d97eb88 /services/inputflinger/InputManager.cpp | |
parent | 720e506fcab38d2f73b84630744ad100c5b6609d (diff) |
Add some tests for native input.
Test some important scenarios for input being driven by
SurfaceControl rather than the WindowManager.
Test: EndToEndNativeInputTest
Bug: 80101428
Bug: 113136004
Bug: 111440400
Change-Id: I46b302774a19c43d12680a8b7e2bb553dfcf4175
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r-- | services/inputflinger/InputManager.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index 388423ca20..cf3ca42d93 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -21,9 +21,13 @@ #include "InputManager.h" #include "InputReaderFactory.h" +#include <binder/IPCThreadState.h> + #include <log/log.h> #include <unordered_map> +#include <private/android_filesystem_config.h> + namespace android { InputManager::InputManager( @@ -118,4 +122,20 @@ void InputManager::setInputWindows(const Vector<InputWindowInfo>& infos) { } } +// Used by tests only. +void InputManager::registerInputChannel(const sp<InputChannel>& channel) { + IPCThreadState* ipc = IPCThreadState::self(); + const int uid = ipc->getCallingUid(); + if (uid != AID_SHELL && uid != AID_ROOT) { + ALOGE("Invalid attempt to register input channel over IPC" + "from non shell/root entity (PID: %d)", ipc->getCallingPid()); + return; + } + mDispatcher->registerInputChannel(channel, false); +} + +void InputManager::unregisterInputChannel(const sp<InputChannel>& channel) { + mDispatcher->unregisterInputChannel(channel); +} + } // namespace android |