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 Handler mHandler;
|
||||||
private int fpTapCounts = 0;
|
private int fpTapCounts = 0;
|
||||||
private boolean fpTapPending = false;
|
private boolean fpTapPending = false;
|
||||||
|
private boolean fpGesturePending = false;
|
||||||
private SettingsObserver mSettingsObserver;
|
private SettingsObserver mSettingsObserver;
|
||||||
private Runnable doubleTapRunnable = new Runnable() {
|
private Runnable doubleTapRunnable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -129,6 +130,11 @@ public class KeyHandler implements DeviceKeyHandler {
|
|||||||
resetDoubleTapOnFP();
|
resetDoubleTapOnFP();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private Runnable fpGestureRunnable = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
resetFPGestureDelay();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public KeyHandler(Context context) {
|
public KeyHandler(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -477,6 +483,16 @@ public class KeyHandler implements DeviceKeyHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFPScanCode){
|
||||||
|
if (fpGesturePending) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
resetFPGestureDelay();
|
||||||
|
fpGesturePending = true;
|
||||||
|
mHandler.postDelayed(fpGestureRunnable, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (scanCode != FP_TAP_SCANCODE) {
|
if (scanCode != FP_TAP_SCANCODE) {
|
||||||
resetDoubleTapOnFP();
|
resetDoubleTapOnFP();
|
||||||
}
|
}
|
||||||
@@ -734,6 +750,11 @@ public class KeyHandler implements DeviceKeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void resetFPGestureDelay() {
|
||||||
|
fpGesturePending = false;
|
||||||
|
mHandler.removeCallbacks(fpGestureRunnable);
|
||||||
|
}
|
||||||
|
|
||||||
private void fireScreenOffAction(int action) {
|
private void fireScreenOffAction(int action) {
|
||||||
boolean haptic = Settings.System.getInt(mContext.getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) != 0;
|
boolean haptic = Settings.System.getInt(mContext.getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) != 0;
|
||||||
if (haptic && (action == ACTION_CAMERA || action == ACTION_FLASHLIGHT)) {
|
if (haptic && (action == ACTION_CAMERA || action == ACTION_FLASHLIGHT)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user