Allow touch if some pointers are MT_TOOL_PALM

We would cancel all touch when we recevied MT_TOOL_PALM because it
becomes accidental touch, and that would break user gesture when
another non-palm pointer is still active.

- Send ACTION_POINTER_UP with AKEY_EVENT_FLAG_CANCELED when recevie
  MT_TOOL_PALM if at least 2 pointers are active.
- Send ACTION_CANEL when receive MT_TOOL_PALM if only one pointer.
- Add test caseis for touch cancel scenarios, to test it would keep
  dispatching non-palm event.

Test: atest inputflinger_tests
Bug: 137221719
Change-Id: Ife35a692c71e45159bfcc771317dff47fa764dda
diff --git a/include/input/Input.h b/include/input/Input.h
index 40d655f..9525bcb 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -87,6 +87,13 @@
 constexpr int32_t VERIFIED_MOTION_EVENT_FLAGS =
         AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED | AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
 
+/**
+ * This flag indicates that the point up event has been canceled.
+ * Typically this is used for palm event when the user has accidental touches.
+ * TODO: Adjust flag to public api
+ */
+constexpr int32_t AMOTION_EVENT_FLAG_CANCELED = 0x20;
+
 enum {
     /* Used when a motion event is not associated with any display.
      * Typically used for non-pointer events. */