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
This commit is contained in:
Beverly
2021-08-26 12:19:57 -04:00
committed by Beverly Tai
parent e454d516ec
commit 374f321fca
2 changed files with 15 additions and 6 deletions

View File

@@ -501,8 +501,10 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
if (!wasClickableOnDownEvent()) { if (!wasClickableOnDownEvent()) {
return; 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( mVibrator.vibrate(
Process.myUid(), Process.myUid(),
getContext().getOpPackageName(), getContext().getOpPackageName(),
@@ -510,8 +512,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
"lockIcon-onLongPress", "lockIcon-onLongPress",
VIBRATION_SONIFICATION_ATTRIBUTES); VIBRATION_SONIFICATION_ATTRIBUTES);
} }
mDetectedLongPress = true;
onAffordanceClick();
} }
public boolean onSingleTapUp(MotionEvent e) { public boolean onSingleTapUp(MotionEvent e) {
@@ -535,9 +535,14 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
return mDownDetected; 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)) { if (mFalsingManager.isFalseTouch(LOCK_ICON)) {
return; return false;
} }
// pre-emptively set to true to hide view // pre-emptively set to true to hide view
@@ -547,6 +552,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
} }
updateVisibility(); updateVisibility();
mKeyguardViewController.showBouncer(/* scrim */ true); mKeyguardViewController.showBouncer(/* scrim */ true);
return true;
} }
}); });

View File

@@ -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_PRIMARY_DEVIANCE;
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_ZIGZAG_Y_SECONDARY_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.BRIGHTNESS_SLIDER;
import static com.android.systemui.classifier.Classifier.LOCK_ICON;
import static com.android.systemui.classifier.Classifier.SHADE_DRAG; import static com.android.systemui.classifier.Classifier.SHADE_DRAG;
import android.graphics.Point; import android.graphics.Point;
@@ -89,7 +90,9 @@ class ZigZagClassifier extends FalsingClassifier {
Result calculateFalsingResult( Result calculateFalsingResult(
@Classifier.InteractionType int interactionType, @Classifier.InteractionType int interactionType,
double historyBelief, double historyConfidence) { 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); return Result.passed(0);
} }