Use BTN_TOUCH or BTN_TOOL_* to determine if touch active.
Bug: 5064702

Should not include stylus buttons in the condition.

Change-Id: If4d78a875b77da8bd59672d6fdbf5353004d0023
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 8786c24..dacc73f 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1170,9 +1170,8 @@
     return AMOTION_EVENT_TOOL_TYPE_UNKNOWN;
 }
 
-bool TouchButtonAccumulator::isActive() const {
-    return mBtnTouch || mBtnToolFinger || mBtnToolPen
-            || mBtnToolRubber || mBtnStylus || mBtnStylus2;
+bool TouchButtonAccumulator::isToolActive() const {
+    return mBtnTouch || mBtnToolFinger || mBtnToolPen || mBtnToolRubber;
 }
 
 bool TouchButtonAccumulator::isHovering() const {
@@ -5144,7 +5143,7 @@
     mCurrentRawPointerData.clear();
     mCurrentButtonState = 0;
 
-    if (mTouchButtonAccumulator.isActive()) {
+    if (mTouchButtonAccumulator.isToolActive()) {
         mCurrentRawPointerData.pointerCount = 1;
         mCurrentRawPointerData.idToIndex[0] = 0;
 
@@ -5168,11 +5167,11 @@
             outPointer.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
         }
         outPointer.isHovering = isHovering;
-
-        mCurrentButtonState = mTouchButtonAccumulator.getButtonState()
-                | mCursorButtonAccumulator.getButtonState();
     }
 
+    mCurrentButtonState = mTouchButtonAccumulator.getButtonState()
+            | mCursorButtonAccumulator.getButtonState();
+
     syncTouch(when, true);
 }