InputDispatcher: Implement stylus interceptor
A stylus interceptor is a window that receives all stylus events within
its touchable bounds, while letting all other events be dispatched to
windows behind it. This makes it possible for the framework to create a
stylus interceptor on top of another app to implement handwriting
recognition.
The feature has no effect when the window flag FLAG_NOT_TOUCHABLE is
not set.
The feature has no effect when the window is not a trusted overlay.
Test: atest inputflinger_tests
Change-Id: Id4833840aa3088d21333d3ea08beffbded4debbc
diff --git a/libs/gui/WindowInfo.cpp b/libs/gui/WindowInfo.cpp
index e92be01..8d356aa 100644
--- a/libs/gui/WindowInfo.cpp
+++ b/libs/gui/WindowInfo.cpp
@@ -47,6 +47,10 @@
return inputFeatures.test(Feature::SPY);
}
+bool WindowInfo::interceptsStylus() const {
+ return inputFeatures.test(Feature::INTERCEPTS_STYLUS);
+}
+
bool WindowInfo::overlaps(const WindowInfo* other) const {
return frameLeft < other->frameRight && frameRight > other->frameLeft &&
frameTop < other->frameBottom && frameBottom > other->frameTop;
diff --git a/libs/gui/include/gui/WindowInfo.h b/libs/gui/include/gui/WindowInfo.h
index 808afe4..0273717 100644
--- a/libs/gui/include/gui/WindowInfo.h
+++ b/libs/gui/include/gui/WindowInfo.h
@@ -138,6 +138,7 @@
DROP_INPUT = 1u << 3,
DROP_INPUT_IF_OBSCURED = 1u << 4,
SPY = 1u << 5,
+ INTERCEPTS_STYLUS = 1u << 6,
};
/* These values are filled in by the WM and passed through SurfaceFlinger
@@ -218,6 +219,8 @@
bool isSpy() const;
+ bool interceptsStylus() const;
+
bool overlaps(const WindowInfo* other) const;
bool operator==(const WindowInfo& inputChannel) const;