diff options
| author | 2018-10-03 16:30:44 -0700 | |
|---|---|---|
| committer | 2018-11-27 12:39:33 -0800 | |
| commit | 5c8a026133d5bbcb6f416952937a7a810bccc8b1 (patch) | |
| tree | e1541cab029b32e38506ab24107ce80621edb4df /libs/input/InputWindow.cpp | |
| parent | 1c4c5599696d049b112c40d629f8c74bb612b01f (diff) | |
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
Diffstat (limited to 'libs/input/InputWindow.cpp')
| -rw-r--r-- | libs/input/InputWindow.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
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> inputChannel = new InputChannel(); - status_t s = inputChannel->read(from); - if (s != OK) { + + sp<IBinder> 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<InputChannel> InputWindowHandle::getInputChannel() const { - return mInfo.inputChannel; +sp<IBinder> InputWindowHandle::getToken() const { + return mInfo.token; } } // namespace android |