diff options
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r-- | services/inputflinger/InputManager.cpp | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index a50e5c70f7..e68946d734 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -31,25 +31,6 @@ namespace android { -static int32_t exceptionCodeFromStatusT(status_t status) { - switch (status) { - case OK: - return binder::Status::EX_NONE; - case INVALID_OPERATION: - return binder::Status::EX_UNSUPPORTED_OPERATION; - case BAD_VALUE: - case BAD_TYPE: - case NAME_NOT_FOUND: - return binder::Status::EX_ILLEGAL_ARGUMENT; - case NO_INIT: - return binder::Status::EX_ILLEGAL_STATE; - case PERMISSION_DENIED: - return binder::Status::EX_SECURITY; - default: - return binder::Status::EX_TRANSACTION_FAILED; - } -} - InputManager::InputManager( const sp<InputReaderPolicyInterface>& readerPolicy, const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { @@ -112,15 +93,16 @@ 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; } }; -binder::Status InputManager::setInputWindows( - const std::vector<InputWindowInfo>& infos, +void InputManager::setInputWindows(const std::vector<InputWindowInfo>& infos, const sp<ISetInputWindowsListener>& setInputWindowsListener) { std::unordered_map<int32_t, std::vector<sp<InputWindowHandle>>> handlesPerDisplay; @@ -134,45 +116,26 @@ binder::Status InputManager::setInputWindows( if (setInputWindowsListener) { setInputWindowsListener->onSetInputWindowsFinished(); } - return binder::Status::ok(); } // Used by tests only. -binder::Status InputManager::createInputChannel(const std::string& name, InputChannel* outChannel) { +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 binder::Status::ok(); - } - - base::Result<std::unique_ptr<InputChannel>> channel = mDispatcher->createInputChannel(name); - if (!channel.ok()) { - return binder::Status::fromExceptionCode(exceptionCodeFromStatusT(channel.error().code()), - channel.error().message().c_str()); + return; } - (*channel)->copyTo(*outChannel); - return binder::Status::ok(); -} - -binder::Status InputManager::removeInputChannel(const sp<IBinder>& connectionToken) { - mDispatcher->removeInputChannel(connectionToken); - return binder::Status::ok(); + mDispatcher->registerInputChannel(channel); } -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; +void InputManager::unregisterInputChannel(const sp<InputChannel>& channel) { + mDispatcher->unregisterInputChannel(channel); } -binder::Status InputManager::setFocusedWindow(const FocusRequest& request) { - mDispatcher->setFocusedWindow(request); - return binder::Status::ok(); +void InputManager::setMotionClassifierEnabled(bool enabled) { + mClassifier->setMotionClassifierEnabled(enabled); } } // namespace android |