summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
diff options
context:
space:
mode:
authorDave Mankoff <mankoff@google.com>2021-03-04 10:52:04 -0500
committerDave Mankoff <mankoff@google.com>2021-03-10 16:42:23 -0500
commit03c717447d007ccd5ce8c202af600483cc182523 (patch)
treeb0af8a09d411cdb7435c7d216863df20544b618e /packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
parent8d0f3a0c3c735d9ad9fb7173ccce847f1dc89e1f (diff)
Add continuous falsing to keyguard.
With this change, taps outside of the bouncer inputs increase the FalsingManager's belief that erroneous taps are happening. If the belief becomes strong enough, the bouncer will be retracted. Special attention is given to ensure that actual password inputs are not recorded by the falsing manager. Valid button and pattern inputs do not have their motion events recorded, but do _decrease_ the FalsingManager's belief in pocket dialing. Thus, a few bad taps mixed with good taps will not retract the bouncer. Test: atest SystemUITests && manual Bug: 172655679 Change-Id: Iac8d2a2f41764f3c1cccb66b9d332c489cabca77
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java59
1 files changed, 2 insertions, 57 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
index 4af580df09ea..a580663cfa91 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
@@ -26,7 +26,6 @@ import android.os.AsyncTask;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.view.KeyEvent;
-import android.view.MotionEvent;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternChecker;
@@ -35,13 +34,9 @@ import com.android.internal.widget.LockscreenCredential;
import com.android.keyguard.EmergencyButton.EmergencyButtonCallback;
import com.android.keyguard.KeyguardAbsKeyInputView.KeyDownListener;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
-import com.android.systemui.Gefingerpoken;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingClassifier;
import com.android.systemui.classifier.FalsingCollector;
-import com.android.systemui.classifier.SingleTapClassifier;
-
-import java.util.Arrays;
public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView>
extends KeyguardInputViewController<T> {
@@ -49,7 +44,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
private final LockPatternUtils mLockPatternUtils;
private final LatencyTracker mLatencyTracker;
private final FalsingCollector mFalsingCollector;
- private final SingleTapClassifier mSingleTapClassifier;
private CountDownTimer mCountdownTimer;
protected KeyguardMessageAreaController mMessageAreaController;
private boolean mDismissing;
@@ -73,61 +67,18 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
}
};
- private final Gefingerpoken mGlobalTouchListener = new Gefingerpoken() {
- private MotionEvent mTouchDown;
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- mFalsingCollector.avoidGesture();
- // Do just a bit of our own falsing. People should only be tapping on the input, not
- // swiping.
- if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
- if (mTouchDown != null) {
- mTouchDown.recycle();
- mTouchDown = null;
- }
- mTouchDown = MotionEvent.obtain(ev);
- } else if (mTouchDown != null) {
- FalsingClassifier.Result tapResult =
- mSingleTapClassifier.isTap(Arrays.asList(mTouchDown, ev));
- if (tapResult.isFalse()
- || ev.getActionMasked() == MotionEvent.ACTION_UP
- || ev.getActionMasked() == MotionEvent.ACTION_CANCEL) {
- // TODO: if we've gotten too false, retract input.
- if (tapResult.isFalse()) {
- mFalsingCollector.updateFalseConfidence(tapResult);
- } else {
- // The classifier returns 0 confidence when a tap is detected.
- // We can be more sure that the tap was intentional here.
- mFalsingCollector.updateFalseConfidence(
- FalsingClassifier.Result.passed(0.6));
- }
- mTouchDown.recycle();
- mTouchDown = null;
- }
- }
- return false;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return false;
- }
- };
-
protected KeyguardAbsKeyInputViewController(T view,
KeyguardUpdateMonitor keyguardUpdateMonitor,
SecurityMode securityMode,
LockPatternUtils lockPatternUtils,
KeyguardSecurityCallback keyguardSecurityCallback,
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
- LatencyTracker latencyTracker, FalsingCollector falsingCollector,
- SingleTapClassifier singleTapClassifier) {
+ LatencyTracker latencyTracker, FalsingCollector falsingCollector) {
super(view, securityMode, keyguardSecurityCallback);
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils;
mLatencyTracker = latencyTracker;
mFalsingCollector = falsingCollector;
- mSingleTapClassifier = singleTapClassifier;
KeyguardMessageArea kma = KeyguardMessageArea.findSecurityMessageDisplay(mView);
mMessageAreaController = messageAreaControllerFactory.create(kma);
}
@@ -142,7 +93,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
@Override
protected void onViewAttached() {
super.onViewAttached();
- mView.addMotionEventListener(mGlobalTouchListener);
mView.setKeyDownListener(mKeyDownListener);
mView.setEnableHaptics(mLockPatternUtils.isTactileFeedbackEnabled());
EmergencyButton button = mView.findViewById(R.id.emergency_call_button);
@@ -152,12 +102,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
}
@Override
- protected void onViewDetached() {
- super.onViewDetached();
- mView.removeMotionEventListener(mGlobalTouchListener);
- }
-
- @Override
public void reset() {
// start fresh
mDismissing = false;
@@ -316,6 +260,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
}
protected void onUserInput() {
+ mFalsingCollector.updateFalseConfidence(FalsingClassifier.Result.passed(0.6));
getKeyguardSecurityCallback().userActivity();
getKeyguardSecurityCallback().onUserInput();
mMessageAreaController.setMessage("");