summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeverly <beverlyt@google.com>2021-08-26 12:19:57 -0400
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-09-20 22:31:29 +0000
commit1d12061ff58b998d3ac8f901dbf5c03c541486d3 (patch)
tree4780c351a806be26fc14386a5fd667a7d507d886
parentd6ea4600743c304b0a6dc1ee7e4d38ac1b822960 (diff)
downloadbase-1d12061ff58b998d3ac8f901dbf5c03c541486d3.tar.gz
Remove ZigZagClassifer from lock-icon longpress falsing algo
If the touch leaves the lock icon area, we already drop the touch. Therefore, we don't also need to also take into consideration the ZigZagClassifier for the lock icon. Also, only play the longpress vibration if we will be bringing up the bouncer. If the FalsingManager think we're falsing, there's no reason to play the longpress vibration. Test: manually longpress lock icon on device with udfps capability (after lockdown or reboot) and observe longpress consistently brings up the bouncer Fixes: 197271526 Change-Id: Ic9fa82a549599e48d281b4db69c04627803c6c5a Merged-In: Ic9fa82a549599e48d281b4db69c04627803c6c5a (cherry picked from commit 374f321fca4572401911f1493122600140e918eb) (cherry picked from commit e77ab2c10955bf553673cf4c471f0336d96790d5)
-rw-r--r--packages/SystemUI/src/com/android/keyguard/LockIconViewController.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/classifier/ZigZagClassifier.java5
2 files changed, 15 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
index 509ac8a6d9fe..8f34e5d0c764 100644
--- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
@@ -497,8 +497,10 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
if (!wasClickableOnDownEvent()) {
return;
}
+ mDetectedLongPress = true;
- if (mVibrator != null) {
+ if (onAffordanceClick() && mVibrator != null) {
+ // only vibrate if the click went through and wasn't intercepted by falsing
mVibrator.vibrate(
Process.myUid(),
getContext().getOpPackageName(),
@@ -506,8 +508,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
"lockIcon-onLongPress",
VIBRATION_SONIFICATION_ATTRIBUTES);
}
- mDetectedLongPress = true;
- onAffordanceClick();
}
public boolean onSingleTapUp(MotionEvent e) {
@@ -531,15 +531,21 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
return mDownDetected;
}
- private void onAffordanceClick() {
+ /**
+ * Whether we tried to launch the affordance.
+ *
+ * If falsing intercepts the click, returns false.
+ */
+ private boolean onAffordanceClick() {
if (mFalsingManager.isFalseTouch(LOCK_ICON)) {
- return;
+ return false;
}
// pre-emptively set to true to hide view
mIsBouncerShowing = true;
updateVisibility();
mKeyguardViewController.showBouncer(/* scrim */ true);
+ return true;
}
});
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/ZigZagClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/ZigZagClassifier.java
index e1349f2aba6d..40c28fab51b8 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/ZigZagClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/ZigZagClassifier.java
@@ -21,6 +21,7 @@ import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHT
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_ZIGZAG_Y_PRIMARY_DEVIANCE;
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_ZIGZAG_Y_SECONDARY_DEVIANCE;
import static com.android.systemui.classifier.Classifier.BRIGHTNESS_SLIDER;
+import static com.android.systemui.classifier.Classifier.LOCK_ICON;
import static com.android.systemui.classifier.Classifier.SHADE_DRAG;
import android.graphics.Point;
@@ -89,7 +90,9 @@ class ZigZagClassifier extends FalsingClassifier {
Result calculateFalsingResult(
@Classifier.InteractionType int interactionType,
double historyBelief, double historyConfidence) {
- if (interactionType == BRIGHTNESS_SLIDER || interactionType == SHADE_DRAG) {
+ if (interactionType == BRIGHTNESS_SLIDER
+ || interactionType == SHADE_DRAG
+ || interactionType == LOCK_ICON) {
return Result.passed(0);
}