Add initial API for stylus and mouse buttons.

Added the concept of pointer properties in a MotionEvent.
This is currently used to track the pointer tool type to enable
applications to distinguish finger touches from a stylus.

Button states are also reported to application as part of touch events.

There are no new actions for detecting changes in button states.
The application should instead query the button state from the
MotionEvent and take appropriate action as needed.

A good time to check the button state is on ACTION_DOWN.

As a side-effect, applications that do not support multiple buttons
will treat primary, secondary and tertiary buttons identically
for all touch events.

The back button on the mouse is mapped to KEYCODE_BACK
and the forward button is mapped to KEYCODE_FORWARD.

Added basic plumbing for the secondary mouse button to invoke
the context menu, particularly in lists.

Added clamp and split methods on MotionEvent to take care of
common filtering operations so we don't have them scattered
in multiple places across the framework.

Bug: 4260011
Change-Id: Ie992b4d4e00c8f2e76b961da0a902145b27f6d83
diff --git a/services/input/PointerController.h b/services/input/PointerController.h
index b9184ac..c7435ee 100644
--- a/services/input/PointerController.h
+++ b/services/input/PointerController.h
@@ -53,10 +53,10 @@
     virtual void move(float deltaX, float deltaY) = 0;
 
     /* Sets a mask that indicates which buttons are pressed. */
-    virtual void setButtonState(uint32_t buttonState) = 0;
+    virtual void setButtonState(int32_t buttonState) = 0;
 
     /* Gets a mask that indicates which buttons are pressed. */
-    virtual uint32_t getButtonState() const = 0;
+    virtual int32_t getButtonState() const = 0;
 
     /* Sets the absolute location of the pointer. */
     virtual void setPosition(float x, float y) = 0;
@@ -183,8 +183,8 @@
     virtual bool getBounds(float* outMinX, float* outMinY,
             float* outMaxX, float* outMaxY) const;
     virtual void move(float deltaX, float deltaY);
-    virtual void setButtonState(uint32_t buttonState);
-    virtual uint32_t getButtonState() const;
+    virtual void setButtonState(int32_t buttonState);
+    virtual int32_t getButtonState() const;
     virtual void setPosition(float x, float y);
     virtual void getPosition(float* outX, float* outY) const;
     virtual void fade();
@@ -258,7 +258,7 @@
         SpriteIcon pointerIcon;
         bool pointerIconChanged;
 
-        uint32_t buttonState;
+        int32_t buttonState;
 
         Vector<Spot*> spots;
         Vector<sp<Sprite> > recycledSprites;