OSDN Git Service

Merge "Provide a way for a stylus to access the quick settings menu" into mnc-dev
authorMady Mellor <madym@google.com>
Mon, 11 May 2015 17:28:45 +0000 (17:28 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Mon, 11 May 2015 17:28:46 +0000 (17:28 +0000)
1  2 
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java

@@@ -758,10 -735,15 +758,16 @@@ public class NotificationPanelView exte
                  && mQsExpansionEnabled) {
              mTwoFingerQsExpandPossible = true;
          }
-         if (mTwoFingerQsExpandPossible && event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN
-                 && event.getPointerCount() == 2
+         final int pointerCount = event.getPointerCount();
+         final boolean twoFingerDrag = action == MotionEvent.ACTION_POINTER_DOWN
+                 && pointerCount == 2;
+         final boolean stylusClickDrag = action == MotionEvent.ACTION_DOWN
+                 && pointerCount == 1 && event.getToolType(0) == MotionEvent.TOOL_TYPE_STYLUS
+                 && (event.isButtonPressed(MotionEvent.BUTTON_SECONDARY)
+                         || event.isButtonPressed(MotionEvent.BUTTON_TERTIARY));
+         if (mTwoFingerQsExpandPossible && (twoFingerDrag || stylusClickDrag)
                  && event.getY(event.getActionIndex()) < mStatusBarMinHeight) {
 +            MetricsLogger.count(mContext, COUNTER_PANEL_OPEN_QS, 1);
              mQsExpandImmediate = true;
              requestPanelHeightUpdate();