summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2024-01-11 16:48:44 -0800
committer Siarhei Vishniakou <svv@google.com> 2024-01-30 11:13:42 -0800
commit8d66013c673bb8e3e8876907f0ad80c91580a443 (patch)
treef304e90cbd51f00645dfd8c96bb513d9bb937a28 /services/inputflinger/InputManager.cpp
parentca103c0ad43e964d46be8de5fb1313292655c98c (diff)
Use aidl-defined InputChannel for parceling
Currently, InputChannel is a manually-written parcelable. In this CL, we introduce an aidl-defined InputChannel, which eventually could also be used in Java as well. Now, whenever an InputChannel needs to be written to parcel, we first create the new android.os.InputChannel and then write that object to parcel. Eventually, we can convert the Java side of InputChannel to use this mechanism, as well. Bug: 161009324 Test: adb shell monkey 1000 Test: atest libgui_test Change-Id: Ib44c5ff02b3c77e0425b59a76195ed100e187317
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r--services/inputflinger/InputManager.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 4863513eb5..823df67d16 100644
--- a/services/inputflinger/InputManager.cpp
+++ b/services/inputflinger/InputManager.cpp
@@ -260,13 +260,16 @@ void InputManager::dump(std::string& dump) {
}
// Used by tests only.
-binder::Status InputManager::createInputChannel(const std::string& name, InputChannel* outChannel) {
+binder::Status InputManager::createInputChannel(const std::string& name,
+ android::os::InputChannelCore* outChannel) {
IPCThreadState* ipc = IPCThreadState::self();
- const int uid = ipc->getCallingUid();
+ const uid_t 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();
+ LOG(ERROR) << __func__ << " can only be called by SHELL or ROOT users, "
+ << "but was called from UID " << uid;
+ return binder::Status::
+ fromExceptionCode(EX_SECURITY,
+ "This uid is not allowed to call createInputChannel");
}
base::Result<std::unique_ptr<InputChannel>> channel = mDispatcher->createInputChannel(name);