Skip to content

Commit dc08142

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Keyguard - fix overzealous sliding security view" into jb-mr1-lockscreen-dev
2 parents 7f0458e + 9c2c77f commit dc08142

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.android.internal.policy.impl.keyguard;
1818

19+
import com.android.internal.R;
20+
1921
import android.animation.Animator;
2022
import android.animation.AnimatorListenerAdapter;
2123
import android.animation.ObjectAnimator;
@@ -29,7 +31,6 @@
2931
import android.util.AttributeSet;
3032
import android.util.FloatProperty;
3133
import android.util.Log;
32-
import android.util.MathUtils;
3334
import android.util.Property;
3435
import android.view.MotionEvent;
3536
import android.view.VelocityTracker;
@@ -40,8 +41,6 @@
4041
import android.view.animation.Interpolator;
4142
import 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

Comments
 (0)