Skip to content

Commit 1ec4646

Browse files
author
John Spurlock
committed
Block swipe up gesture if challenge non-interactive.
Change-Id: I0f9ba918c072261614011cd675e417e54296366f
1 parent 79417e8 commit 1ec4646

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
122122
private final Rect mTempRect = new Rect();
123123

124124
private boolean mHasGlowpad;
125+
private boolean mChallengeInteractive = true;
125126

126127
static final Property<SlidingChallengeLayout, Float> HANDLE_ALPHA =
127128
new FloatProperty<SlidingChallengeLayout>("handleAlpha") {
@@ -276,6 +277,7 @@ public void setHandleAlpha(float alpha) {
276277
}
277278

278279
public void setChallengeInteractive(boolean interactive) {
280+
mChallengeInteractive = interactive;
279281
if (mExpandChallengeView != null) {
280282
mExpandChallengeView.setEnabled(interactive);
281283
}
@@ -585,7 +587,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
585587
for (int i = 0; i < count; i++) {
586588
final float x = ev.getX(i);
587589
final float y = ev.getY(i);
588-
if (!mIsBouncing && mActivePointerId == INVALID_POINTER
590+
if (!mIsBouncing && mChallengeInteractive && mActivePointerId == INVALID_POINTER
589591
&& (crossedDragHandle(x, y, mGestureStartY)
590592
|| (isInChallengeView(x, y) &&
591593
mScrollState == SCROLL_STATE_SETTLING))) {
@@ -633,7 +635,7 @@ public boolean onTouchEvent(MotionEvent ev) {
633635
break;
634636

635637
case MotionEvent.ACTION_CANCEL:
636-
if (mDragging) {
638+
if (mDragging && mChallengeInteractive) {
637639
showChallenge(0);
638640
}
639641
resetTouch();
@@ -644,7 +646,7 @@ public boolean onTouchEvent(MotionEvent ev) {
644646
break;
645647
}
646648
case MotionEvent.ACTION_UP:
647-
if (mDragging) {
649+
if (mDragging && mChallengeInteractive) {
648650
mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
649651
showChallenge((int) mVelocityTracker.getYVelocity(mActivePointerId));
650652
}
@@ -660,7 +662,8 @@ public boolean onTouchEvent(MotionEvent ev) {
660662

661663
if ((isInDragHandle(x, y) || crossedDragHandle(x, y, mGestureStartY) ||
662664
(isInChallengeView(x, y) && mScrollState == SCROLL_STATE_SETTLING))
663-
&& mActivePointerId == INVALID_POINTER) {
665+
&& mActivePointerId == INVALID_POINTER
666+
&& mChallengeInteractive) {
664667
mGestureStartX = x;
665668
mGestureStartY = y;
666669
mActivePointerId = ev.getPointerId(i);

0 commit comments

Comments
 (0)