diff options
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r-- | services/inputflinger/InputManager.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index f2a0014da4..c5f60ade96 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -93,16 +93,15 @@ sp<InputDispatcherInterface> InputManager::getDispatcher() { class BinderWindowHandle : public InputWindowHandle { public: - BinderWindowHandle(const InputWindowInfo& info) { - mInfo = info; - } + BinderWindowHandle(const InputWindowInfo& info) { mInfo = info; } bool updateInfo() override { return true; } }; -void InputManager::setInputWindows(const std::vector<InputWindowInfo>& infos, +binder::Status InputManager::setInputWindows( + const std::vector<InputWindowInfo>& infos, const sp<ISetInputWindowsListener>& setInputWindowsListener) { std::unordered_map<int32_t, std::vector<sp<InputWindowHandle>>> handlesPerDisplay; @@ -116,22 +115,38 @@ void InputManager::setInputWindows(const std::vector<InputWindowInfo>& infos, if (setInputWindowsListener) { setInputWindowsListener->onSetInputWindowsFinished(); } + return binder::Status::ok(); } // Used by tests only. -void InputManager::registerInputChannel(const sp<InputChannel>& channel) { +binder::Status InputManager::registerInputChannel(const InputChannelInfo& info) { 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; + return binder::Status::ok(); } + android::base::unique_fd newFd(::dup(info.mFd)); + sp<InputChannel> channel = InputChannel::create(info.mName, std::move(newFd), info.mToken); mDispatcher->registerInputChannel(channel); + return binder::Status::ok(); } -void InputManager::unregisterInputChannel(const sp<InputChannel>& channel) { +binder::Status InputManager::unregisterInputChannel(const InputChannelInfo& info) { + android::base::unique_fd newFd(::dup(info.mFd)); + sp<InputChannel> channel = InputChannel::create(info.mName, std::move(newFd), info.mToken); mDispatcher->unregisterInputChannel(channel); + return binder::Status::ok(); +} + +status_t InputManager::dump(int fd, const Vector<String16>& args) { + std::string dump; + + dump += " InputFlinger dump\n"; + + ::write(fd, dump.c_str(), dump.size()); + return NO_ERROR; } } // namespace android |