InputDispatcher: Fix support for INPUT_FEATURE_NO_INPUT_CHANNEL
In preparation for an occlusion detection fix, we are going to begin
sending windows with NO_INPUT_CHANNEL to InputFlinger. There are 3
obstacles we address here:
1. InputDispatcher ignores windows with no InputChannel when updating
input windows. We modify the code to allow such windows if they have
INPUT_FEATURE_NO_INPUT_CHANNEL.
2. The parcelling code currently has an optimization to avoid sending the rest
of the fields if token is null. We rebase this optimization on
whether or not a name is set.
3. InputWindowHandle::getName checks if there is a token to consider the window
invalid. We instead check if a name is set.
Bug: 152064592
Test: Existing tests pass
Change-Id: I8a85f46b6c44866c7f73daafa5e8ff4c9251c366
diff --git a/libs/input/InputWindow.cpp b/libs/input/InputWindow.cpp
index 03ca459..6e4c97d 100644
--- a/libs/input/InputWindow.cpp
+++ b/libs/input/InputWindow.cpp
@@ -65,7 +65,7 @@
}
status_t InputWindowInfo::write(Parcel& output) const {
- if (token == nullptr) {
+ if (name.empty()) {
output.writeInt32(0);
return OK;
}
@@ -110,12 +110,7 @@
return ret;
}
- sp<IBinder> token = from.readStrongBinder();
- if (token == nullptr) {
- return ret;
- }
-
- ret.token = token;
+ ret.token = from.readStrongBinder();
ret.id = from.readInt32();
ret.name = from.readString8().c_str();
ret.layoutParamsFlags = from.readInt32();