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/CancelationOptions.h b/services/inputflinger/dispatcher/CancelationOptions.h
index 99e2108..fec5f83 100644
--- a/services/inputflinger/dispatcher/CancelationOptions.h
+++ b/services/inputflinger/dispatcher/CancelationOptions.h
@@ -17,9 +17,11 @@
 #ifndef _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
 #define _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H
 
+#include <utils/BitSet.h>
 #include <optional>
 
-namespace android::inputdispatcher {
+namespace android {
+namespace inputdispatcher {
 
 /* Specifies which events are to be canceled and why. */
 struct CancelationOptions {
@@ -45,9 +47,13 @@
     // The specific display id of events to cancel, or nullopt to cancel events on any display.
     std::optional<int32_t> displayId = std::nullopt;
 
+    // The specific pointers to cancel, or nullopt to cancel all pointer events
+    std::optional<BitSet32> pointerIds = std::nullopt;
+
     CancelationOptions(Mode mode, const char* reason) : mode(mode), reason(reason) {}
 };
 
-} // namespace android::inputdispatcher
+} // namespace inputdispatcher
+} // namespace android
 
 #endif // _UI_INPUT_INPUTDISPATCHER_CANCELLATIONOPTIONS_H