FalsingManager: Only use for touchscreen input
Change-Id: I267974dd1f05fc17177aa189390ccde63a6b8fa9
Fixes: 29121607
Test: Try unlocking with a mouse, verify it works
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
index 913e781..a265a5e 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManager.java
@@ -28,6 +28,7 @@
import android.os.PowerManager;
import android.os.UserHandle;
import android.provider.Settings;
+import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.accessibility.AccessibilityManager;
@@ -74,6 +75,7 @@
private boolean mEnforceBouncer = false;
private boolean mBouncerOn = false;
private boolean mSessionActive = false;
+ private boolean mIsTouchScreen = true;
private int mState = StatusBarState.SHADE;
private boolean mScreenOn;
private boolean mShowingAod;
@@ -236,6 +238,11 @@
// already sufficiently prevents false unlocks.
return false;
}
+ if (!mIsTouchScreen) {
+ // Unlocking with input devices besides the touchscreen should already be sufficiently
+ // anti-falsed.
+ return false;
+ }
return mHumanInteractionClassifier.isFalseTouch();
}
@@ -450,6 +457,9 @@
}
public void onTouchEvent(MotionEvent event, int width, int height) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ mIsTouchScreen = event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN);
+ }
if (mSessionActive && !mBouncerOn) {
mDataCollector.onTouchEvent(event, width, height);
mHumanInteractionClassifier.onTouchEvent(event);