1616
1717package com .android .internal .policy .impl .keyguard ;
1818
19+ import com .android .internal .R ;
20+
1921import android .animation .Animator ;
2022import android .animation .AnimatorListenerAdapter ;
2123import android .animation .ObjectAnimator ;
2931import android .util .AttributeSet ;
3032import android .util .FloatProperty ;
3133import android .util .Log ;
32- import android .util .MathUtils ;
3334import android .util .Property ;
3435import android .view .MotionEvent ;
3536import android .view .VelocityTracker ;
4041import android .view .animation .Interpolator ;
4142import android .widget .Scroller ;
4243
43- import com .android .internal .R ;
44-
4544/**
4645 * This layout handles interaction with the sliding security challenge views
4746 * that overlay/resize other keyguard contents.
@@ -53,7 +52,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
5352 // The drag handle is measured in dp above & below the top edge of the
5453 // challenge view; these parameters change based on whether the challenge
5554 // is open or closed.
56- private static final int DRAG_HANDLE_CLOSED_ABOVE = 64 ; // dp
55+ private static final int DRAG_HANDLE_CLOSED_ABOVE = 8 ; // dp
5756 private static final int DRAG_HANDLE_CLOSED_BELOW = 0 ; // dp
5857 private static final int DRAG_HANDLE_OPEN_ABOVE = 8 ; // dp
5958 private static final int DRAG_HANDLE_OPEN_BELOW = 0 ; // dp
@@ -581,18 +580,16 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
581580 final float x = ev .getX (i );
582581 final float y = ev .getY (i );
583582 if (!mIsBouncing && mActivePointerId == INVALID_POINTER
584- && ((isInDragHandle (x , y ) && MathUtils .sq (x - mGestureStartX )
585- + MathUtils .sq (y - mGestureStartY ) > mTouchSlopSquare )
586- || crossedDragHandle (x , y , mGestureStartY )
583+ && (crossedDragHandle (x , y , mGestureStartY )
587584 || (isInChallengeView (x , y ) &&
588- mScrollState == SCROLL_STATE_SETTLING ))) {
585+ mScrollState == SCROLL_STATE_SETTLING ))) {
589586 mActivePointerId = ev .getPointerId (i );
590587 mGestureStartX = x ;
591588 mGestureStartY = y ;
592589 mGestureStartChallengeBottom = getChallengeBottom ();
593590 mDragging = true ;
594591 mChallengeView .setLayerType (LAYER_TYPE_HARDWARE , null );
595- } else if (isInChallengeView (x , y )) {
592+ } else if (mChallengeShowing && isInChallengeView (x , y )) {
596593 mBlockDrag = true ;
597594 }
598595 }
@@ -767,11 +764,19 @@ private boolean isPointInView(float x, float y, View view) {
767764 }
768765
769766 private boolean crossedDragHandle (float x , float y , float initialY ) {
767+
770768 final int challengeTop = mChallengeView .getTop ();
771- return x >= 0 &&
772- x < getWidth () &&
773- initialY < (challengeTop - getDragHandleSizeAbove ()) &&
774- y > challengeTop + getDragHandleSizeBelow ();
769+ final boolean horizOk = x >= 0 && x < getWidth ();
770+
771+ final boolean vertOk ;
772+ if (mChallengeShowing ) {
773+ vertOk = initialY < (challengeTop - getDragHandleSizeAbove ()) &&
774+ y > challengeTop + getDragHandleSizeBelow ();
775+ } else {
776+ vertOk = initialY > challengeTop + getDragHandleSizeBelow () &&
777+ y < challengeTop - getDragHandleSizeAbove ();
778+ }
779+ return horizOk && vertOk ;
775780 }
776781
777782 @ Override
0 commit comments