summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
author Roshan Pius <rpius@google.com> 2020-09-21 22:48:19 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-09-21 22:48:19 +0000
commit17a515291e69b79f7592f8b532f4c8e40a36600a (patch)
tree1056d191346528d67b0583c02dd34a41e4df453b /services/inputflinger/InputManager.cpp
parent6856842f5de9df4860017db01f8f08968cf18a90 (diff)
parent015cb700cb3ddfc4d3bb084513f3651128182bc1 (diff)
Merge "Revert "Let InputFlinger create the server InputChannel""
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r--services/inputflinger/InputManager.cpp32
1 files changed, 4 insertions, 28 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 3d995899d0..8af9bcba89 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) {
@@ -138,7 +119,7 @@ binder::Status InputManager::setInputWindows(
}
// Used by tests only.
-binder::Status InputManager::createInputChannel(const std::string& name, InputChannel* outChannel) {
+binder::Status InputManager::registerInputChannel(const InputChannel& channel) {
IPCThreadState* ipc = IPCThreadState::self();
const int uid = ipc->getCallingUid();
if (uid != AID_SHELL && uid != AID_ROOT) {
@@ -147,17 +128,12 @@ binder::Status InputManager::createInputChannel(const std::string& name, InputCh
return binder::Status::ok();
}
- base::Result<std::unique_ptr<InputChannel>> channel = mDispatcher->createInputChannel(name);
- if (!channel) {
- return binder::Status::fromExceptionCode(exceptionCodeFromStatusT(channel.error().code()),
- channel.error().message().c_str());
- }
- (*channel)->copyTo(*outChannel);
+ mDispatcher->registerInputChannel(channel.dup());
return binder::Status::ok();
}
-binder::Status InputManager::removeInputChannel(const sp<IBinder>& connectionToken) {
- mDispatcher->removeInputChannel(connectionToken);
+binder::Status InputManager::unregisterInputChannel(const sp<IBinder>& connectionToken) {
+ mDispatcher->unregisterInputChannel(connectionToken);
return binder::Status::ok();
}