Merge "Check for false touches when determining if the notif menu should be shown" into oc-dev

am: 70739fb812

Change-Id: Ie2014ee92ec3fb629801b18465ec42c36b6e2283
This commit is contained in:
Mady Mellor
2017-05-26 15:00:07 +00:00
committed by android-build-merger
4 changed files with 15 additions and 4 deletions

View File

@@ -49,6 +49,8 @@ public interface NotificationSwipeActionHelper {
public boolean isDismissGesture(MotionEvent ev); public boolean isDismissGesture(MotionEvent ev);
public boolean isFalseGesture(MotionEvent ev);
public boolean swipedFarEnough(float translation, float viewSize); public boolean swipedFarEnough(float translation, float viewSize);
public boolean swipedFastEnough(float translation, float velocity); public boolean swipedFastEnough(float translation, float velocity);

View File

@@ -653,15 +653,19 @@ public class SwipeHelper implements Gefingerpoken {
} }
public boolean isDismissGesture(MotionEvent ev) { public boolean isDismissGesture(MotionEvent ev) {
return ev.getActionMasked() == MotionEvent.ACTION_UP
&& !isFalseGesture(ev) && (swipedFastEnough() || swipedFarEnough())
&& mCallback.canChildBeDismissed(mCurrView);
}
public boolean isFalseGesture(MotionEvent ev) {
boolean falsingDetected = mCallback.isAntiFalsingNeeded(); boolean falsingDetected = mCallback.isAntiFalsingNeeded();
if (mFalsingManager.isClassiferEnabled()) { if (mFalsingManager.isClassiferEnabled()) {
falsingDetected = falsingDetected && mFalsingManager.isFalseTouch(); falsingDetected = falsingDetected && mFalsingManager.isFalseTouch();
} else { } else {
falsingDetected = falsingDetected && !mTouchAboveFalsingThreshold; falsingDetected = falsingDetected && !mTouchAboveFalsingThreshold;
} }
return !falsingDetected && (swipedFastEnough() || swipedFarEnough()) return falsingDetected;
&& ev.getActionMasked() == MotionEvent.ACTION_UP
&& mCallback.canChildBeDismissed(mCurrView);
} }
protected boolean swipedFastEnough() { protected boolean swipedFastEnough() {

View File

@@ -337,7 +337,8 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
} else { } else {
snapBack(animView, velocity); snapBack(animView, velocity);
} }
} else if ((swipedEnoughToShowMenu() && (!gestureFastEnough || showMenuForSlowOnGoing)) } else if (!mSwipeHelper.isFalseGesture(ev)
&& (swipedEnoughToShowMenu() && (!gestureFastEnough || showMenuForSlowOnGoing))
|| (gestureTowardsMenu && !mSwipeHelper.isDismissGesture(ev))) { || (gestureTowardsMenu && !mSwipeHelper.isDismissGesture(ev))) {
// Menu has not been snapped to previously and this is menu revealing gesture // Menu has not been snapped to previously and this is menu revealing gesture
showMenu(animView, menuSnapTarget, velocity); showMenu(animView, menuSnapTarget, velocity);

View File

@@ -4353,6 +4353,10 @@ public class NotificationStackScrollLayout extends ViewGroup
mStatusBar.setNotificationSnoozed(sbn, snoozeOption); mStatusBar.setNotificationSnoozed(sbn, snoozeOption);
} }
public boolean isFalseGesture(MotionEvent ev) {
return super.isFalseGesture(ev);
}
private void handleMenuCoveredOrDismissed() { private void handleMenuCoveredOrDismissed() {
if (mMenuExposedView != null && mMenuExposedView == mTranslatingParentView) { if (mMenuExposedView != null && mMenuExposedView == mTranslatingParentView) {
mMenuExposedView = null; mMenuExposedView = null;