diff options
author | Dave Mankoff <mankoff@google.com> | 2020-12-09 11:44:47 -0500 |
---|---|---|
committer | Dave Mankoff <mankoff@google.com> | 2021-01-05 15:55:22 -0500 |
commit | 8848abd1b5690ab922254ce5401bb6691f771548 (patch) | |
tree | db5dc756861713c8db645656cb60aacf8c27c898 /packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java | |
parent | 246e924066a726e94f0564ff5f687180f02a0b1c (diff) |
Add ability to ignore gestures in FalsingManager
This gives other parts of the system the ability to temporarily
override the falsing manager, telling it to ignore a given gesture.
The intent is to give other parts of the system a chance to include
their own falsing information (such as whether a button was tapped or
not), giving the FalsingManager more context about what is going on.
As of right now, their is no way to feedback this context-aware
falsing information back to the FalsingManager. An API for this is
still being explored.
Bug: 172655679
Test: atest SystemUITests && manual
Change-Id: I87ee94a2386622ebff7580346325ae07e3bb5f5d
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java index 4d0ebfffbe04..df8709c12442 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java @@ -25,12 +25,15 @@ import android.view.View.OnTouchListener; import com.android.internal.util.LatencyTracker; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; +import com.android.systemui.Gefingerpoken; import com.android.systemui.R; +import com.android.systemui.classifier.FalsingCollector; public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinBasedInputView> extends KeyguardAbsKeyInputViewController<T> { private final LiftToActivateListener mLiftToActivateListener; + private final FalsingCollector mFalsingCollector; protected PasswordTextView mPasswordEntry; private final OnKeyListener mOnKeyListener = (v, keyCode, event) -> { @@ -40,13 +43,26 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB return false; }; - private final OnTouchListener mOnTouchListener = (v, event) -> { + private final OnTouchListener mActionButtonTouchListener = (v, event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { mView.doHapticKeyClick(); } return false; }; + private final Gefingerpoken mGlobalTouchListener = new Gefingerpoken() { + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + mFalsingCollector.avoidGesture(); + return false; + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + return false; + } + }; + protected KeyguardPinBasedInputViewController(T view, KeyguardUpdateMonitor keyguardUpdateMonitor, SecurityMode securityMode, @@ -54,10 +70,12 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB KeyguardSecurityCallback keyguardSecurityCallback, KeyguardMessageAreaController.Factory messageAreaControllerFactory, LatencyTracker latencyTracker, - LiftToActivateListener liftToActivateListener) { + LiftToActivateListener liftToActivateListener, + FalsingCollector falsingCollector) { super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback, messageAreaControllerFactory, latencyTracker); mLiftToActivateListener = liftToActivateListener; + mFalsingCollector = falsingCollector; mPasswordEntry = mView.findViewById(mView.getPasswordTextViewId()); } @@ -65,11 +83,13 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB protected void onViewAttached() { super.onViewAttached(); + mView.addMotionEventListener(mGlobalTouchListener); + mPasswordEntry.setOnKeyListener(mOnKeyListener); mPasswordEntry.setUserActivityListener(this::onUserInput); View deleteButton = mView.findViewById(R.id.delete_button); - deleteButton.setOnTouchListener(mOnTouchListener); + deleteButton.setOnTouchListener(mActionButtonTouchListener); deleteButton.setOnClickListener(v -> { // check for time-based lockouts if (mPasswordEntry.isEnabled()) { @@ -87,7 +107,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB View okButton = mView.findViewById(R.id.key_enter); if (okButton != null) { - okButton.setOnTouchListener(mOnTouchListener); + okButton.setOnTouchListener(mActionButtonTouchListener); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { |