summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2018-08-08 16:13:02 -0700
committer Rob Carr <racarr@google.com> 2018-09-26 13:01:45 -0700
commit4de9afb77f14eec8429b3f8b5a464e8f84589a33 (patch)
tree858e3d3d069fafe4cce183895b78841a21ab6a2b
parente1db3206087b23ef99ea3252f741ce80149602a9 (diff)
InputChannel JNI: Use libinput implementation of read/write.
InputChannel now has parcelling implementations built in and we don't need to duplicate it here anymore. Bug: 80101428 Bug: 113136004 Bug: 111440400 Change-Id: Ide3e8a6416dc1babc3be6d520fc6646cc4d378b1
-rw-r--r--core/jni/android_view_InputChannel.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp
index 0a90b97d55ef..2f179078aed8 100644
--- a/core/jni/android_view_InputChannel.cpp
+++ b/core/jni/android_view_InputChannel.cpp
@@ -202,17 +202,9 @@ static void android_view_InputChannel_nativeReadFromParcel(JNIEnv* env, jobject
if (parcel) {
bool isInitialized = parcel->readInt32();
if (isInitialized) {
- String8 name = parcel->readString8();
- int rawFd = parcel->readFileDescriptor();
- int dupFd = dup(rawFd);
- if (dupFd < 0) {
- ALOGE("Error %d dup channel fd %d.", errno, rawFd);
- jniThrowRuntimeException(env,
- "Could not read input channel file descriptors from parcel.");
- return;
- }
-
- InputChannel* inputChannel = new InputChannel(name.string(), dupFd);
+ InputChannel* inputChannel = new InputChannel();
+ inputChannel->read(*parcel);
+
NativeInputChannel* nativeInputChannel = new NativeInputChannel(inputChannel);
android_view_InputChannel_setNativeInputChannel(env, obj, nativeInputChannel);
@@ -230,8 +222,7 @@ static void android_view_InputChannel_nativeWriteToParcel(JNIEnv* env, jobject o
sp<InputChannel> inputChannel = nativeInputChannel->getInputChannel();
parcel->writeInt32(1);
- parcel->writeString8(String8(inputChannel->getName().c_str()));
- parcel->writeDupFileDescriptor(inputChannel->getFd());
+ inputChannel->write(*parcel);
} else {
parcel->writeInt32(0);
}