From 995270f01175234d0615a0e1900576f142a3b4ad Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Fri, 26 Oct 2012 16:10:43 -0700 Subject: [PATCH] Keyguard - prevent slider intercept when we don't want it Integrate from proto app When calling code deliberately hides the slider, block drags of the slider that may begin shortly after. This prevents the case where edge dragging a widget can accidentally catch the slider instead. Change-Id: I7e8e1ad4afbea0abeeb08161ddeb938c858fc4a5 --- .../impl/keyguard/SlidingChallengeLayout.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java b/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java index f2e125bfde22a..506b79d208df9 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java @@ -481,6 +481,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout switch (action) { case MotionEvent.ACTION_DOWN: mGestureStartY = ev.getY(); + mBlockDrag = false; break; case MotionEvent.ACTION_CANCEL: @@ -533,6 +534,11 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout final int action = ev.getActionMasked(); switch (action) { + case MotionEvent.ACTION_DOWN: + mBlockDrag = false; + mGestureStartY = ev.getY(); + break; + case MotionEvent.ACTION_CANCEL: if (mDragging) { showChallenge(0); @@ -855,19 +861,17 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout return mChallengeView.getBottom(); } - /** - * The top edge of the challenge if it were fully opened. - */ - private int getChallengeOpenedTop() { - return getLayoutBottom() - ((mChallengeView == null) ? 0 : mChallengeView.getHeight()); - } - /** * Show or hide the challenge view, animating it if necessary. * @param show true to show, false to hide */ public void showChallenge(boolean show) { showChallenge(show, 0); + if (!show) { + // Block any drags in progress so that callers can use this to disable dragging + // for other touch interactions. + mBlockDrag = true; + } } private void showChallenge(int velocity) {