Modify pilferpointers API to selectively cancel pointers
Behavior changes:
- Pilfer pointers only cancels relevant pointers (If a pointer
is used by the window calling pilferPointers(), only then,
we need to send ACTION_CANCEL/POINTER_UP to other windows using
that particular pointer)
- Any pointers not used by the window calling pilferPointers()
will remain unaffected and the windows using them will keep
receiving the events
- Any future Pointer down events will go to other windows if and
only if the "the pilfering window" that called pilferPointers() do
not need that pointer for its gesture detection (the pointer down
occurs outside the touchable bounds of the pilfering window)
Bug: 220109830
Test: atest inputflinger_tests
Change-Id: Idc59ae06352560fefd7274bc043bd6e72d5e7710
diff --git a/services/inputflinger/dispatcher/InputState.h b/services/inputflinger/dispatcher/InputState.h
index 74ae21f..77a6db1 100644
--- a/services/inputflinger/dispatcher/InputState.h
+++ b/services/inputflinger/dispatcher/InputState.h
@@ -22,7 +22,8 @@
#include <utils/Timers.h>
-namespace android::inputdispatcher {
+namespace android {
+namespace inputdispatcher {
static constexpr int32_t INVALID_POINTER_INDEX = -1;
@@ -125,8 +126,13 @@
static bool shouldCancelKey(const KeyMemento& memento, const CancelationOptions& options);
static bool shouldCancelMotion(const MotionMemento& memento, const CancelationOptions& options);
+
+ // Synthesizes pointer cancel events for a particular set of pointers.
+ std::vector<std::unique_ptr<MotionEntry>> synthesizeCancelationEventsForPointers(
+ const MotionMemento& memento, const BitSet32 pointerIds, nsecs_t currentTime);
};
-} // namespace android::inputdispatcher
+} // namespace inputdispatcher
+} // namespace android
#endif // _UI_INPUT_INPUTDISPATCHER_INPUTSTATE_H