sanders: KeyHandler: Don't allow multiple calls for fp gestures
This commit is contained in:
@@ -108,6 +108,7 @@ public class KeyHandler implements DeviceKeyHandler {
|
||||
private Handler mHandler;
|
||||
private int fpTapCounts = 0;
|
||||
private boolean fpTapPending = false;
|
||||
private boolean fpGesturePending = false;
|
||||
private SettingsObserver mSettingsObserver;
|
||||
private Runnable doubleTapRunnable = new Runnable() {
|
||||
public void run() {
|
||||
@@ -129,6 +130,11 @@ public class KeyHandler implements DeviceKeyHandler {
|
||||
resetDoubleTapOnFP();
|
||||
}
|
||||
};
|
||||
private Runnable fpGestureRunnable = new Runnable() {
|
||||
public void run() {
|
||||
resetFPGestureDelay();
|
||||
}
|
||||
};
|
||||
|
||||
public KeyHandler(Context context) {
|
||||
mContext = context;
|
||||
@@ -476,6 +482,16 @@ public class KeyHandler implements DeviceKeyHandler {
|
||||
if (event.getAction() != KeyEvent.ACTION_UP) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isFPScanCode){
|
||||
if (fpGesturePending) {
|
||||
return false;
|
||||
} else {
|
||||
resetFPGestureDelay();
|
||||
fpGesturePending = true;
|
||||
mHandler.postDelayed(fpGestureRunnable, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (scanCode != FP_TAP_SCANCODE) {
|
||||
resetDoubleTapOnFP();
|
||||
@@ -734,6 +750,11 @@ public class KeyHandler implements DeviceKeyHandler {
|
||||
}
|
||||
|
||||
|
||||
private void resetFPGestureDelay() {
|
||||
fpGesturePending = false;
|
||||
mHandler.removeCallbacks(fpGestureRunnable);
|
||||
}
|
||||
|
||||
private void fireScreenOffAction(int action) {
|
||||
boolean haptic = Settings.System.getInt(mContext.getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) != 0;
|
||||
if (haptic && (action == ACTION_CAMERA || action == ACTION_FLASHLIGHT)) {
|
||||
|
||||
Reference in New Issue
Block a user