From 015cb700cb3ddfc4d3bb084513f3651128182bc1 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 21 Sep 2020 22:44:44 +0000 Subject: Revert "Let InputFlinger create the server InputChannel" Revert submission 12594832-hide_server_input_channel Reason for revert: Reverted Changes: I7033caf10:Use new create/removeInputChannel(). I35f768c8a:Let InputFlinger create the server InputChannel Bug: 169083114 Bug: 169088136 Change-Id: Ib6945129936006682cd03cea614fbdfd4f5fa008 --- services/inputflinger/InputManager.cpp | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'services/inputflinger/InputManager.cpp') 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& readerPolicy, const sp& 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> 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& connectionToken) { - mDispatcher->removeInputChannel(connectionToken); +binder::Status InputManager::unregisterInputChannel(const sp& connectionToken) { + mDispatcher->unregisterInputChannel(connectionToken); return binder::Status::ok(); } -- cgit v1.2.3-59-g8ed1b