am 9629f637: am 9c98b859: Merge "Update stylus gesture to access quick settings to use the new buttons" into mnc-dev
* commit '9629f637b79d85f27efa224b208d8b3cfd2591a4':
Update stylus gesture to access quick settings to use the new buttons
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 094b9b5..10191ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -773,14 +773,7 @@
&& mQsExpansionEnabled) {
mTwoFingerQsExpandPossible = true;
}
- 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)
+ if (mTwoFingerQsExpandPossible && isOpenQsEvent(event)
&& event.getY(event.getActionIndex()) < mStatusBarMinHeight) {
MetricsLogger.count(mContext, COUNTER_PANEL_OPEN_QS, 1);
mQsExpandImmediate = true;
@@ -799,6 +792,24 @@
|| y <= mQsContainer.getY() + mQsContainer.getHeight());
}
+ private boolean isOpenQsEvent(MotionEvent event) {
+ final int pointerCount = event.getPointerCount();
+ final int action = event.getActionMasked();
+
+ final boolean twoFingerDrag = action == MotionEvent.ACTION_POINTER_DOWN
+ && pointerCount == 2;
+
+ final boolean stylusButtonClickDrag = action == MotionEvent.ACTION_DOWN
+ && (event.isButtonPressed(MotionEvent.BUTTON_STYLUS_PRIMARY)
+ || event.isButtonPressed(MotionEvent.BUTTON_STYLUS_SECONDARY));
+
+ final boolean mouseButtonClickDrag = action == MotionEvent.ACTION_DOWN
+ && (event.isButtonPressed(MotionEvent.BUTTON_SECONDARY)
+ || event.isButtonPressed(MotionEvent.BUTTON_TERTIARY));
+
+ return twoFingerDrag || stylusButtonClickDrag || mouseButtonClickDrag;
+ }
+
private void handleQsDown(MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN
&& shouldQuickSettingsIntercept(event.getX(), event.getY(), -1)) {