Loading packages/SystemUI/src/com/android/systemui/ExpandHelper.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -86,7 +86,8 @@ public class ExpandHelper implements Gefingerpoken { private float mInitialTouchSpan; private float mInitialTouchSpan; private float mLastFocusY; private float mLastFocusY; private float mLastSpanY; private float mLastSpanY; private int mTouchSlop; private final int mTouchSlop; private final float mSlopMultiplier; private float mLastMotionY; private float mLastMotionY; private float mPullGestureMinXSpan; private float mPullGestureMinXSpan; private Callback mCallback; private Callback mCallback; Loading Loading @@ -177,6 +178,7 @@ public class ExpandHelper implements Gefingerpoken { final ViewConfiguration configuration = ViewConfiguration.get(mContext); final ViewConfiguration configuration = ViewConfiguration.get(mContext); mTouchSlop = configuration.getScaledTouchSlop(); mTouchSlop = configuration.getScaledTouchSlop(); mSlopMultiplier = configuration.getAmbiguousGestureMultiplier(); mSGD = new ScaleGestureDetector(context, mScaleGestureListener); mSGD = new ScaleGestureDetector(context, mScaleGestureListener); mFlingAnimationUtils = new FlingAnimationUtils(mContext.getResources().getDisplayMetrics(), mFlingAnimationUtils = new FlingAnimationUtils(mContext.getResources().getDisplayMetrics(), Loading Loading @@ -258,6 +260,13 @@ public class ExpandHelper implements Gefingerpoken { mScrollAdapter = adapter; mScrollAdapter = adapter; } } private float getTouchSlop(MotionEvent event) { // Adjust the touch slop if another gesture may be being performed. return event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mSlopMultiplier : mTouchSlop; } @Override @Override public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { if (!isEnabled()) { if (!isEnabled()) { Loading Loading @@ -303,7 +312,7 @@ public class ExpandHelper implements Gefingerpoken { if (mWatchingForPull) { if (mWatchingForPull) { final float yDiff = ev.getRawY() - mInitialTouchY; final float yDiff = ev.getRawY() - mInitialTouchY; final float xDiff = ev.getRawX() - mInitialTouchX; final float xDiff = ev.getRawX() - mInitialTouchX; if (yDiff > mTouchSlop && yDiff > Math.abs(xDiff)) { if (yDiff > getTouchSlop(ev) && yDiff > Math.abs(xDiff)) { if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); mWatchingForPull = false; mWatchingForPull = false; if (mResizedView != null && !isFullyExpanded(mResizedView)) { if (mResizedView != null && !isFullyExpanded(mResizedView)) { Loading Loading @@ -431,7 +440,7 @@ public class ExpandHelper implements Gefingerpoken { if (mWatchingForPull) { if (mWatchingForPull) { final float yDiff = ev.getRawY() - mInitialTouchY; final float yDiff = ev.getRawY() - mInitialTouchY; final float xDiff = ev.getRawX() - mInitialTouchX; final float xDiff = ev.getRawX() - mInitialTouchX; if (yDiff > mTouchSlop && yDiff > Math.abs(xDiff)) { if (yDiff > getTouchSlop(ev) && yDiff > Math.abs(xDiff)) { if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); mWatchingForPull = false; mWatchingForPull = false; if (mResizedView != null && !isFullyExpanded(mResizedView)) { if (mResizedView != null && !isFullyExpanded(mResizedView)) { Loading packages/SystemUI/src/com/android/systemui/SwipeHelper.java +39 −30 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class SwipeHelper implements Gefingerpoken { private final FlingAnimationUtils mFlingAnimationUtils; private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; private float mPagingTouchSlop; private final float mSlopMultiplier; private final Callback mCallback; private final Callback mCallback; private final int mSwipeDirection; private final int mSwipeDirection; private final VelocityTracker mVelocityTracker; private final VelocityTracker mVelocityTracker; Loading @@ -84,11 +85,28 @@ public class SwipeHelper implements Gefingerpoken { private float mTranslation = 0; private float mTranslation = 0; private boolean mMenuRowIntercepting; private boolean mMenuRowIntercepting; private boolean mLongPressSent; private Runnable mWatchLongPress; private final long mLongPressTimeout; private final long mLongPressTimeout; private boolean mLongPressSent; private final float[] mDownLocation = new float[2]; private final Runnable mPerformLongPress = new Runnable() { private final int[] mViewOffset = new int[2]; @Override public void run() { if (mCurrView != null && !mLongPressSent) { mLongPressSent = true; if (mCurrView instanceof ExpandableNotificationRow) { mCurrView.getLocationOnScreen(mViewOffset); final int x = (int) mDownLocation[0] - mViewOffset[0]; final int y = (int) mDownLocation[1] - mViewOffset[1]; mCurrView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); ((ExpandableNotificationRow) mCurrView).doLongClickCallback(x, y); } } } }; final private int[] mTmpPos = new int[2]; private final int mFalsingThreshold; private final int mFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mDisableHwLayers; private boolean mDisableHwLayers; Loading @@ -102,7 +120,9 @@ public class SwipeHelper implements Gefingerpoken { mHandler = new Handler(); mHandler = new Handler(); mSwipeDirection = swipeDirection; mSwipeDirection = swipeDirection; mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker = VelocityTracker.obtain(); mPagingTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop(); final ViewConfiguration configuration = ViewConfiguration.get(context); mPagingTouchSlop = configuration.getScaledPagingTouchSlop(); mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier(); // Extra long-press! // Extra long-press! mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); Loading Loading @@ -255,10 +275,7 @@ public class SwipeHelper implements Gefingerpoken { } } public void cancelLongPress() { public void cancelLongPress() { if (mWatchLongPress != null) { mHandler.removeCallbacks(mPerformLongPress); mHandler.removeCallbacks(mWatchLongPress); mWatchLongPress = null; } } } @Override @Override Loading Loading @@ -287,27 +304,9 @@ public class SwipeHelper implements Gefingerpoken { mInitialTouchPos = getPos(ev); mInitialTouchPos = getPos(ev); mPerpendicularInitialTouchPos = getPerpendicularPos(ev); mPerpendicularInitialTouchPos = getPerpendicularPos(ev); mTranslation = getTranslation(mCurrView); mTranslation = getTranslation(mCurrView); if (mWatchLongPress == null) { mDownLocation[0] = ev.getRawX(); mWatchLongPress = new Runnable() { mDownLocation[1] = ev.getRawY(); @Override mHandler.postDelayed(mPerformLongPress, mLongPressTimeout); public void run() { if (mCurrView != null && !mLongPressSent) { mLongPressSent = true; mCurrView.getLocationOnScreen(mTmpPos); final int x = (int) ev.getRawX() - mTmpPos[0]; final int y = (int) ev.getRawY() - mTmpPos[1]; if (mCurrView instanceof ExpandableNotificationRow) { mCurrView.sendAccessibilityEvent( AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); ExpandableNotificationRow currRow = (ExpandableNotificationRow) mCurrView; currRow.doLongClickCallback(x, y); } } } }; } mHandler.postDelayed(mWatchLongPress, mLongPressTimeout); } } break; break; Loading @@ -318,7 +317,12 @@ public class SwipeHelper implements Gefingerpoken { float perpendicularPos = getPerpendicularPos(ev); float perpendicularPos = getPerpendicularPos(ev); float delta = pos - mInitialTouchPos; float delta = pos - mInitialTouchPos; float deltaPerpendicular = perpendicularPos - mPerpendicularInitialTouchPos; float deltaPerpendicular = perpendicularPos - mPerpendicularInitialTouchPos; if (Math.abs(delta) > mPagingTouchSlop // Adjust the touch slop if another gesture may be being performed. final float pagingTouchSlop = ev.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mPagingTouchSlop * mSlopMultiplier : mPagingTouchSlop; if (Math.abs(delta) > pagingTouchSlop && Math.abs(delta) > Math.abs(deltaPerpendicular)) { && Math.abs(delta) > Math.abs(deltaPerpendicular)) { if (mCallback.canChildBeDragged(mCurrView)) { if (mCallback.canChildBeDragged(mCurrView)) { mCallback.onBeginDrag(mCurrView); mCallback.onBeginDrag(mCurrView); Loading @@ -327,6 +331,11 @@ public class SwipeHelper implements Gefingerpoken { mTranslation = getTranslation(mCurrView); mTranslation = getTranslation(mCurrView); } } cancelLongPress(); cancelLongPress(); } else if (ev.getClassification() == MotionEvent.CLASSIFICATION_DEEP_PRESS && mHandler.hasCallbacks(mPerformLongPress)) { // Accelerate the long press signal. cancelLongPress(); mPerformLongPress.run(); } } } } break; break; Loading packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +11 −3 Original line number Original line Diff line number Diff line Loading @@ -48,7 +48,8 @@ public class DragDownHelper implements Gefingerpoken { private float mInitialTouchX; private float mInitialTouchX; private float mInitialTouchY; private float mInitialTouchY; private boolean mDraggingDown; private boolean mDraggingDown; private float mTouchSlop; private final float mTouchSlop; private final float mSlopMultiplier; private DragDownCallback mDragDownCallback; private DragDownCallback mDragDownCallback; private View mHost; private View mHost; private final int[] mTemp2 = new int[2]; private final int[] mTemp2 = new int[2]; Loading @@ -62,7 +63,9 @@ public class DragDownHelper implements Gefingerpoken { FalsingManager falsingManager) { FalsingManager falsingManager) { mMinDragDistance = context.getResources().getDimensionPixelSize( mMinDragDistance = context.getResources().getDimensionPixelSize( R.dimen.keyguard_drag_down_min_distance); R.dimen.keyguard_drag_down_min_distance); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier(); mCallback = callback; mCallback = callback; mDragDownCallback = dragDownCallback; mDragDownCallback = dragDownCallback; mHost = host; mHost = host; Loading @@ -85,7 +88,12 @@ public class DragDownHelper implements Gefingerpoken { case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: final float h = y - mInitialTouchY; final float h = y - mInitialTouchY; if (h > mTouchSlop && h > Math.abs(x - mInitialTouchX)) { // Adjust the touch slop if another gesture may be being performed. final float touchSlop = event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mSlopMultiplier : mTouchSlop; if (h > touchSlop && h > Math.abs(x - mInitialTouchX)) { mFalsingManager.onNotificatonStartDraggingDown(); mFalsingManager.onNotificatonStartDraggingDown(); mDraggingDown = true; mDraggingDown = true; captureStartingChild(mInitialTouchX, mInitialTouchY); captureStartingChild(mInitialTouchX, mInitialTouchY); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +22 −10 Original line number Original line Diff line number Diff line Loading @@ -222,6 +222,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private boolean mIsScrollerBoundSet; private boolean mIsScrollerBoundSet; private Runnable mFinishScrollingCallback; private Runnable mFinishScrollingCallback; private int mTouchSlop; private int mTouchSlop; private float mSlopMultiplier; private int mMinimumVelocity; private int mMinimumVelocity; private int mMaximumVelocity; private int mMaximumVelocity; private int mOverflingDistance; private int mOverflingDistance; Loading Loading @@ -1022,6 +1023,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd setClipChildren(false); setClipChildren(false); final ViewConfiguration configuration = ViewConfiguration.get(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mTouchSlop = configuration.getScaledTouchSlop(); mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverflingDistance = configuration.getScaledOverflingDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); Loading Loading @@ -3744,15 +3746,23 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mLongPressListener = listener; mLongPressListener = listener; } } private float getTouchSlop(MotionEvent event) { // Adjust the touch slop if another gesture may be being performed. return event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mSlopMultiplier : mTouchSlop; } @Override @Override @ShadeViewRefactor(RefactorComponent.INPUT) @ShadeViewRefactor(RefactorComponent.INPUT) public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent ev) { NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); boolean isCancelOrUp = ev.getActionMasked() == MotionEvent.ACTION_CANCEL boolean isCancelOrUp = ev.getActionMasked() == MotionEvent.ACTION_CANCEL || ev.getActionMasked() == MotionEvent.ACTION_UP; || ev.getActionMasked() == MotionEvent.ACTION_UP; handleEmptySpaceClick(ev); handleEmptySpaceClick(ev); boolean expandWantsIt = false; boolean expandWantsIt = false; boolean swipingInProgress = mSwipingInProgress; boolean swipingInProgress = mSwipingInProgress; if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion) { if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion && guts == null) { if (isCancelOrUp) { if (isCancelOrUp) { mExpandHelper.onlyObserveMovements(false); mExpandHelper.onlyObserveMovements(false); } } Loading @@ -3778,7 +3788,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } } // Check if we need to clear any snooze leavebehinds // Check if we need to clear any snooze leavebehinds NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); if (guts != null && !NotificationSwipeHelper.isTouchInView(ev, guts) if (guts != null && !NotificationSwipeHelper.isTouchInView(ev, guts) && guts.getGutsContent() instanceof NotificationSnooze) { && guts.getGutsContent() instanceof NotificationSnooze) { NotificationSnooze ns = (NotificationSnooze) guts.getGutsContent(); NotificationSnooze ns = (NotificationSnooze) guts.getGutsContent(); Loading Loading @@ -3891,12 +3900,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd int deltaY = mLastMotionY - y; int deltaY = mLastMotionY - y; final int xDiff = Math.abs(x - mDownX); final int xDiff = Math.abs(x - mDownX); final int yDiff = Math.abs(deltaY); final int yDiff = Math.abs(deltaY); if (!mIsBeingDragged && yDiff > mTouchSlop && yDiff > xDiff) { final float touchSlop = getTouchSlop(ev); if (!mIsBeingDragged && yDiff > touchSlop && yDiff > xDiff) { setIsBeingDragged(true); setIsBeingDragged(true); if (deltaY > 0) { if (deltaY > 0) { deltaY -= mTouchSlop; deltaY -= touchSlop; } else { } else { deltaY += mTouchSlop; deltaY += touchSlop; } } } } if (mIsBeingDragged) { if (mIsBeingDragged) { Loading Loading @@ -4046,9 +4056,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { initDownStates(ev); initDownStates(ev); handleEmptySpaceClick(ev); handleEmptySpaceClick(ev); NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); boolean expandWantsIt = false; boolean expandWantsIt = false; boolean swipingInProgress = mSwipingInProgress; boolean swipingInProgress = mSwipingInProgress; if (!swipingInProgress && !mOnlyScrollingInThisMotion) { if (!swipingInProgress && !mOnlyScrollingInThisMotion && guts == null) { expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev); expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev); } } boolean scrollWantsIt = false; boolean scrollWantsIt = false; Loading @@ -4065,7 +4077,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } } // Check if we need to clear any snooze leavebehinds // Check if we need to clear any snooze leavebehinds boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP; boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP; NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); if (!NotificationSwipeHelper.isTouchInView(ev, guts) && isUp && !swipeWantsIt && if (!NotificationSwipeHelper.isTouchInView(ev, guts) && isUp && !swipeWantsIt && !expandWantsIt && !scrollWantsIt) { !expandWantsIt && !scrollWantsIt) { mCheckForLeavebehind = false; mCheckForLeavebehind = false; Loading @@ -4083,8 +4094,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private void handleEmptySpaceClick(MotionEvent ev) { private void handleEmptySpaceClick(MotionEvent ev) { switch (ev.getActionMasked()) { switch (ev.getActionMasked()) { case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: if (mTouchIsClick && (Math.abs(ev.getY() - mInitialTouchY) > mTouchSlop final float touchSlop = getTouchSlop(ev); || Math.abs(ev.getX() - mInitialTouchX) > mTouchSlop)) { if (mTouchIsClick && (Math.abs(ev.getY() - mInitialTouchY) > touchSlop || Math.abs(ev.getX() - mInitialTouchX) > touchSlop)) { mTouchIsClick = false; mTouchIsClick = false; } } break; break; Loading Loading @@ -4168,7 +4180,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd final int x = (int) ev.getX(pointerIndex); final int x = (int) ev.getX(pointerIndex); final int yDiff = Math.abs(y - mLastMotionY); final int yDiff = Math.abs(y - mLastMotionY); final int xDiff = Math.abs(x - mDownX); final int xDiff = Math.abs(x - mDownX); if (yDiff > mTouchSlop && yDiff > xDiff) { if (yDiff > getTouchSlop(ev) && yDiff > xDiff) { setIsBeingDragged(true); setIsBeingDragged(true); mLastMotionY = y; mLastMotionY = y; mDownX = x; mDownX = x; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -1021,7 +1021,8 @@ public class NotificationPanelViewController extends PanelViewController { trackMovement(event); trackMovement(event); return true; return true; } } if (Math.abs(h) > mTouchSlop && Math.abs(h) > Math.abs(x - mInitialTouchX) if (Math.abs(h) > getTouchSlop(event) && Math.abs(h) > Math.abs(x - mInitialTouchX) && shouldQuickSettingsIntercept(mInitialTouchX, mInitialTouchY, h)) { && shouldQuickSettingsIntercept(mInitialTouchX, mInitialTouchY, h)) { mQsTracking = true; mQsTracking = true; onQsExpansionStarted(); onQsExpansionStarted(); Loading Loading
packages/SystemUI/src/com/android/systemui/ExpandHelper.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -86,7 +86,8 @@ public class ExpandHelper implements Gefingerpoken { private float mInitialTouchSpan; private float mInitialTouchSpan; private float mLastFocusY; private float mLastFocusY; private float mLastSpanY; private float mLastSpanY; private int mTouchSlop; private final int mTouchSlop; private final float mSlopMultiplier; private float mLastMotionY; private float mLastMotionY; private float mPullGestureMinXSpan; private float mPullGestureMinXSpan; private Callback mCallback; private Callback mCallback; Loading Loading @@ -177,6 +178,7 @@ public class ExpandHelper implements Gefingerpoken { final ViewConfiguration configuration = ViewConfiguration.get(mContext); final ViewConfiguration configuration = ViewConfiguration.get(mContext); mTouchSlop = configuration.getScaledTouchSlop(); mTouchSlop = configuration.getScaledTouchSlop(); mSlopMultiplier = configuration.getAmbiguousGestureMultiplier(); mSGD = new ScaleGestureDetector(context, mScaleGestureListener); mSGD = new ScaleGestureDetector(context, mScaleGestureListener); mFlingAnimationUtils = new FlingAnimationUtils(mContext.getResources().getDisplayMetrics(), mFlingAnimationUtils = new FlingAnimationUtils(mContext.getResources().getDisplayMetrics(), Loading Loading @@ -258,6 +260,13 @@ public class ExpandHelper implements Gefingerpoken { mScrollAdapter = adapter; mScrollAdapter = adapter; } } private float getTouchSlop(MotionEvent event) { // Adjust the touch slop if another gesture may be being performed. return event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mSlopMultiplier : mTouchSlop; } @Override @Override public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { if (!isEnabled()) { if (!isEnabled()) { Loading Loading @@ -303,7 +312,7 @@ public class ExpandHelper implements Gefingerpoken { if (mWatchingForPull) { if (mWatchingForPull) { final float yDiff = ev.getRawY() - mInitialTouchY; final float yDiff = ev.getRawY() - mInitialTouchY; final float xDiff = ev.getRawX() - mInitialTouchX; final float xDiff = ev.getRawX() - mInitialTouchX; if (yDiff > mTouchSlop && yDiff > Math.abs(xDiff)) { if (yDiff > getTouchSlop(ev) && yDiff > Math.abs(xDiff)) { if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); mWatchingForPull = false; mWatchingForPull = false; if (mResizedView != null && !isFullyExpanded(mResizedView)) { if (mResizedView != null && !isFullyExpanded(mResizedView)) { Loading Loading @@ -431,7 +440,7 @@ public class ExpandHelper implements Gefingerpoken { if (mWatchingForPull) { if (mWatchingForPull) { final float yDiff = ev.getRawY() - mInitialTouchY; final float yDiff = ev.getRawY() - mInitialTouchY; final float xDiff = ev.getRawX() - mInitialTouchX; final float xDiff = ev.getRawX() - mInitialTouchX; if (yDiff > mTouchSlop && yDiff > Math.abs(xDiff)) { if (yDiff > getTouchSlop(ev) && yDiff > Math.abs(xDiff)) { if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); mWatchingForPull = false; mWatchingForPull = false; if (mResizedView != null && !isFullyExpanded(mResizedView)) { if (mResizedView != null && !isFullyExpanded(mResizedView)) { Loading
packages/SystemUI/src/com/android/systemui/SwipeHelper.java +39 −30 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class SwipeHelper implements Gefingerpoken { private final FlingAnimationUtils mFlingAnimationUtils; private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; private float mPagingTouchSlop; private final float mSlopMultiplier; private final Callback mCallback; private final Callback mCallback; private final int mSwipeDirection; private final int mSwipeDirection; private final VelocityTracker mVelocityTracker; private final VelocityTracker mVelocityTracker; Loading @@ -84,11 +85,28 @@ public class SwipeHelper implements Gefingerpoken { private float mTranslation = 0; private float mTranslation = 0; private boolean mMenuRowIntercepting; private boolean mMenuRowIntercepting; private boolean mLongPressSent; private Runnable mWatchLongPress; private final long mLongPressTimeout; private final long mLongPressTimeout; private boolean mLongPressSent; private final float[] mDownLocation = new float[2]; private final Runnable mPerformLongPress = new Runnable() { private final int[] mViewOffset = new int[2]; @Override public void run() { if (mCurrView != null && !mLongPressSent) { mLongPressSent = true; if (mCurrView instanceof ExpandableNotificationRow) { mCurrView.getLocationOnScreen(mViewOffset); final int x = (int) mDownLocation[0] - mViewOffset[0]; final int y = (int) mDownLocation[1] - mViewOffset[1]; mCurrView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); ((ExpandableNotificationRow) mCurrView).doLongClickCallback(x, y); } } } }; final private int[] mTmpPos = new int[2]; private final int mFalsingThreshold; private final int mFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mDisableHwLayers; private boolean mDisableHwLayers; Loading @@ -102,7 +120,9 @@ public class SwipeHelper implements Gefingerpoken { mHandler = new Handler(); mHandler = new Handler(); mSwipeDirection = swipeDirection; mSwipeDirection = swipeDirection; mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker = VelocityTracker.obtain(); mPagingTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop(); final ViewConfiguration configuration = ViewConfiguration.get(context); mPagingTouchSlop = configuration.getScaledPagingTouchSlop(); mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier(); // Extra long-press! // Extra long-press! mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); Loading Loading @@ -255,10 +275,7 @@ public class SwipeHelper implements Gefingerpoken { } } public void cancelLongPress() { public void cancelLongPress() { if (mWatchLongPress != null) { mHandler.removeCallbacks(mPerformLongPress); mHandler.removeCallbacks(mWatchLongPress); mWatchLongPress = null; } } } @Override @Override Loading Loading @@ -287,27 +304,9 @@ public class SwipeHelper implements Gefingerpoken { mInitialTouchPos = getPos(ev); mInitialTouchPos = getPos(ev); mPerpendicularInitialTouchPos = getPerpendicularPos(ev); mPerpendicularInitialTouchPos = getPerpendicularPos(ev); mTranslation = getTranslation(mCurrView); mTranslation = getTranslation(mCurrView); if (mWatchLongPress == null) { mDownLocation[0] = ev.getRawX(); mWatchLongPress = new Runnable() { mDownLocation[1] = ev.getRawY(); @Override mHandler.postDelayed(mPerformLongPress, mLongPressTimeout); public void run() { if (mCurrView != null && !mLongPressSent) { mLongPressSent = true; mCurrView.getLocationOnScreen(mTmpPos); final int x = (int) ev.getRawX() - mTmpPos[0]; final int y = (int) ev.getRawY() - mTmpPos[1]; if (mCurrView instanceof ExpandableNotificationRow) { mCurrView.sendAccessibilityEvent( AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); ExpandableNotificationRow currRow = (ExpandableNotificationRow) mCurrView; currRow.doLongClickCallback(x, y); } } } }; } mHandler.postDelayed(mWatchLongPress, mLongPressTimeout); } } break; break; Loading @@ -318,7 +317,12 @@ public class SwipeHelper implements Gefingerpoken { float perpendicularPos = getPerpendicularPos(ev); float perpendicularPos = getPerpendicularPos(ev); float delta = pos - mInitialTouchPos; float delta = pos - mInitialTouchPos; float deltaPerpendicular = perpendicularPos - mPerpendicularInitialTouchPos; float deltaPerpendicular = perpendicularPos - mPerpendicularInitialTouchPos; if (Math.abs(delta) > mPagingTouchSlop // Adjust the touch slop if another gesture may be being performed. final float pagingTouchSlop = ev.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mPagingTouchSlop * mSlopMultiplier : mPagingTouchSlop; if (Math.abs(delta) > pagingTouchSlop && Math.abs(delta) > Math.abs(deltaPerpendicular)) { && Math.abs(delta) > Math.abs(deltaPerpendicular)) { if (mCallback.canChildBeDragged(mCurrView)) { if (mCallback.canChildBeDragged(mCurrView)) { mCallback.onBeginDrag(mCurrView); mCallback.onBeginDrag(mCurrView); Loading @@ -327,6 +331,11 @@ public class SwipeHelper implements Gefingerpoken { mTranslation = getTranslation(mCurrView); mTranslation = getTranslation(mCurrView); } } cancelLongPress(); cancelLongPress(); } else if (ev.getClassification() == MotionEvent.CLASSIFICATION_DEEP_PRESS && mHandler.hasCallbacks(mPerformLongPress)) { // Accelerate the long press signal. cancelLongPress(); mPerformLongPress.run(); } } } } break; break; Loading
packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +11 −3 Original line number Original line Diff line number Diff line Loading @@ -48,7 +48,8 @@ public class DragDownHelper implements Gefingerpoken { private float mInitialTouchX; private float mInitialTouchX; private float mInitialTouchY; private float mInitialTouchY; private boolean mDraggingDown; private boolean mDraggingDown; private float mTouchSlop; private final float mTouchSlop; private final float mSlopMultiplier; private DragDownCallback mDragDownCallback; private DragDownCallback mDragDownCallback; private View mHost; private View mHost; private final int[] mTemp2 = new int[2]; private final int[] mTemp2 = new int[2]; Loading @@ -62,7 +63,9 @@ public class DragDownHelper implements Gefingerpoken { FalsingManager falsingManager) { FalsingManager falsingManager) { mMinDragDistance = context.getResources().getDimensionPixelSize( mMinDragDistance = context.getResources().getDimensionPixelSize( R.dimen.keyguard_drag_down_min_distance); R.dimen.keyguard_drag_down_min_distance); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier(); mCallback = callback; mCallback = callback; mDragDownCallback = dragDownCallback; mDragDownCallback = dragDownCallback; mHost = host; mHost = host; Loading @@ -85,7 +88,12 @@ public class DragDownHelper implements Gefingerpoken { case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: final float h = y - mInitialTouchY; final float h = y - mInitialTouchY; if (h > mTouchSlop && h > Math.abs(x - mInitialTouchX)) { // Adjust the touch slop if another gesture may be being performed. final float touchSlop = event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mSlopMultiplier : mTouchSlop; if (h > touchSlop && h > Math.abs(x - mInitialTouchX)) { mFalsingManager.onNotificatonStartDraggingDown(); mFalsingManager.onNotificatonStartDraggingDown(); mDraggingDown = true; mDraggingDown = true; captureStartingChild(mInitialTouchX, mInitialTouchY); captureStartingChild(mInitialTouchX, mInitialTouchY); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +22 −10 Original line number Original line Diff line number Diff line Loading @@ -222,6 +222,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private boolean mIsScrollerBoundSet; private boolean mIsScrollerBoundSet; private Runnable mFinishScrollingCallback; private Runnable mFinishScrollingCallback; private int mTouchSlop; private int mTouchSlop; private float mSlopMultiplier; private int mMinimumVelocity; private int mMinimumVelocity; private int mMaximumVelocity; private int mMaximumVelocity; private int mOverflingDistance; private int mOverflingDistance; Loading Loading @@ -1022,6 +1023,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd setClipChildren(false); setClipChildren(false); final ViewConfiguration configuration = ViewConfiguration.get(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mTouchSlop = configuration.getScaledTouchSlop(); mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverflingDistance = configuration.getScaledOverflingDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); Loading Loading @@ -3744,15 +3746,23 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mLongPressListener = listener; mLongPressListener = listener; } } private float getTouchSlop(MotionEvent event) { // Adjust the touch slop if another gesture may be being performed. return event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mSlopMultiplier : mTouchSlop; } @Override @Override @ShadeViewRefactor(RefactorComponent.INPUT) @ShadeViewRefactor(RefactorComponent.INPUT) public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent ev) { NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); boolean isCancelOrUp = ev.getActionMasked() == MotionEvent.ACTION_CANCEL boolean isCancelOrUp = ev.getActionMasked() == MotionEvent.ACTION_CANCEL || ev.getActionMasked() == MotionEvent.ACTION_UP; || ev.getActionMasked() == MotionEvent.ACTION_UP; handleEmptySpaceClick(ev); handleEmptySpaceClick(ev); boolean expandWantsIt = false; boolean expandWantsIt = false; boolean swipingInProgress = mSwipingInProgress; boolean swipingInProgress = mSwipingInProgress; if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion) { if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion && guts == null) { if (isCancelOrUp) { if (isCancelOrUp) { mExpandHelper.onlyObserveMovements(false); mExpandHelper.onlyObserveMovements(false); } } Loading @@ -3778,7 +3788,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } } // Check if we need to clear any snooze leavebehinds // Check if we need to clear any snooze leavebehinds NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); if (guts != null && !NotificationSwipeHelper.isTouchInView(ev, guts) if (guts != null && !NotificationSwipeHelper.isTouchInView(ev, guts) && guts.getGutsContent() instanceof NotificationSnooze) { && guts.getGutsContent() instanceof NotificationSnooze) { NotificationSnooze ns = (NotificationSnooze) guts.getGutsContent(); NotificationSnooze ns = (NotificationSnooze) guts.getGutsContent(); Loading Loading @@ -3891,12 +3900,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd int deltaY = mLastMotionY - y; int deltaY = mLastMotionY - y; final int xDiff = Math.abs(x - mDownX); final int xDiff = Math.abs(x - mDownX); final int yDiff = Math.abs(deltaY); final int yDiff = Math.abs(deltaY); if (!mIsBeingDragged && yDiff > mTouchSlop && yDiff > xDiff) { final float touchSlop = getTouchSlop(ev); if (!mIsBeingDragged && yDiff > touchSlop && yDiff > xDiff) { setIsBeingDragged(true); setIsBeingDragged(true); if (deltaY > 0) { if (deltaY > 0) { deltaY -= mTouchSlop; deltaY -= touchSlop; } else { } else { deltaY += mTouchSlop; deltaY += touchSlop; } } } } if (mIsBeingDragged) { if (mIsBeingDragged) { Loading Loading @@ -4046,9 +4056,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { initDownStates(ev); initDownStates(ev); handleEmptySpaceClick(ev); handleEmptySpaceClick(ev); NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); boolean expandWantsIt = false; boolean expandWantsIt = false; boolean swipingInProgress = mSwipingInProgress; boolean swipingInProgress = mSwipingInProgress; if (!swipingInProgress && !mOnlyScrollingInThisMotion) { if (!swipingInProgress && !mOnlyScrollingInThisMotion && guts == null) { expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev); expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev); } } boolean scrollWantsIt = false; boolean scrollWantsIt = false; Loading @@ -4065,7 +4077,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } } // Check if we need to clear any snooze leavebehinds // Check if we need to clear any snooze leavebehinds boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP; boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP; NotificationGuts guts = mNotificationGutsManager.getExposedGuts(); if (!NotificationSwipeHelper.isTouchInView(ev, guts) && isUp && !swipeWantsIt && if (!NotificationSwipeHelper.isTouchInView(ev, guts) && isUp && !swipeWantsIt && !expandWantsIt && !scrollWantsIt) { !expandWantsIt && !scrollWantsIt) { mCheckForLeavebehind = false; mCheckForLeavebehind = false; Loading @@ -4083,8 +4094,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private void handleEmptySpaceClick(MotionEvent ev) { private void handleEmptySpaceClick(MotionEvent ev) { switch (ev.getActionMasked()) { switch (ev.getActionMasked()) { case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: if (mTouchIsClick && (Math.abs(ev.getY() - mInitialTouchY) > mTouchSlop final float touchSlop = getTouchSlop(ev); || Math.abs(ev.getX() - mInitialTouchX) > mTouchSlop)) { if (mTouchIsClick && (Math.abs(ev.getY() - mInitialTouchY) > touchSlop || Math.abs(ev.getX() - mInitialTouchX) > touchSlop)) { mTouchIsClick = false; mTouchIsClick = false; } } break; break; Loading Loading @@ -4168,7 +4180,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd final int x = (int) ev.getX(pointerIndex); final int x = (int) ev.getX(pointerIndex); final int yDiff = Math.abs(y - mLastMotionY); final int yDiff = Math.abs(y - mLastMotionY); final int xDiff = Math.abs(x - mDownX); final int xDiff = Math.abs(x - mDownX); if (yDiff > mTouchSlop && yDiff > xDiff) { if (yDiff > getTouchSlop(ev) && yDiff > xDiff) { setIsBeingDragged(true); setIsBeingDragged(true); mLastMotionY = y; mLastMotionY = y; mDownX = x; mDownX = x; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -1021,7 +1021,8 @@ public class NotificationPanelViewController extends PanelViewController { trackMovement(event); trackMovement(event); return true; return true; } } if (Math.abs(h) > mTouchSlop && Math.abs(h) > Math.abs(x - mInitialTouchX) if (Math.abs(h) > getTouchSlop(event) && Math.abs(h) > Math.abs(x - mInitialTouchX) && shouldQuickSettingsIntercept(mInitialTouchX, mInitialTouchY, h)) { && shouldQuickSettingsIntercept(mInitialTouchX, mInitialTouchY, h)) { mQsTracking = true; mQsTracking = true; onQsExpansionStarted(); onQsExpansionStarted(); Loading