Merge "Exempt (0-opacity & NOT_TOUCHABLE) windows from occlusion detection"
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index ab25e2b..d175484 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -2192,6 +2192,15 @@
auto otherInfo = otherHandle->getInfo();
if (!otherInfo->visible) {
return false;
+ } else if (otherInfo->alpha == 0 &&
+ otherInfo->flags.test(InputWindowInfo::Flag::NOT_TOUCHABLE)) {
+ // Those act as if they were invisible, so we don't need to flag them.
+ // We do want to potentially flag touchable windows even if they have 0
+ // opacity, since they can consume touches and alter the effects of the
+ // user interaction (eg. apps that rely on
+ // FLAG_WINDOW_IS_PARTIALLY_OBSCURED should still be told about those
+ // windows), hence we also check for FLAG_NOT_TOUCHABLE.
+ return false;
} else if (info->ownerUid == otherInfo->ownerUid) {
// If ownerUid is the same we don't generate occlusion events as there
// is no security boundary within an uid.