diff options
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 |