From 5c8a026133d5bbcb6f416952937a7a810bccc8b1 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 3 Oct 2018 16:30:44 -0700 Subject: Replace InputWindowInfo#inputChannel with an IBinder token. The IBinder token is now being used as the UUID for InputWindows. We can pass it around without the channel to avoid unnecessary FD parcelling, duping, and other juggling. Test: Existing tests pass. Bug: 80101428 Bug: 113136004 Bug: 111440400 Change-Id: I8eba3fa05f249b7dfcb5c3d9817241cbfe9ab76c --- libs/input/InputWindow.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'libs/input/InputWindow.cpp') diff --git a/libs/input/InputWindow.cpp b/libs/input/InputWindow.cpp index f82437e1bf..96646dc6f8 100644 --- a/libs/input/InputWindow.cpp +++ b/libs/input/InputWindow.cpp @@ -65,12 +65,12 @@ bool InputWindowInfo::overlaps(const InputWindowInfo* other) const { } status_t InputWindowInfo::write(Parcel& output) const { - if (inputChannel == nullptr) { + if (token == nullptr) { output.writeInt32(0); return OK; } output.writeInt32(1); - status_t s = inputChannel->write(output); + status_t s = output.writeStrongBinder(token); if (s != OK) return s; output.writeString8(String8(name.c_str())); @@ -102,15 +102,14 @@ InputWindowInfo InputWindowInfo::read(const Parcel& from) { if (from.readInt32() == 0) { return ret; - } - sp inputChannel = new InputChannel(); - status_t s = inputChannel->read(from); - if (s != OK) { + + sp token = from.readStrongBinder(); + if (token == nullptr) { return ret; } - ret.inputChannel = inputChannel; + ret.token = token; ret.name = from.readString8().c_str(); ret.layoutParamsFlags = from.readInt32(); ret.layoutParamsType = from.readInt32(); @@ -149,11 +148,11 @@ InputWindowHandle::~InputWindowHandle() { } void InputWindowHandle::releaseChannel() { - mInfo.inputChannel.clear(); + mInfo.token.clear(); } -sp InputWindowHandle::getInputChannel() const { - return mInfo.inputChannel; +sp InputWindowHandle::getToken() const { + return mInfo.token; } } // namespace android -- cgit v1.2.3-59-g8ed1b