Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f44aeb66 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Fix haptic and audio feedback of caps-lock mode changing

Bug: 5435669
Change-Id: Ic1c1eb00d7e535a3ac602b9b505fd8bf43da5a8d
parent 381adec6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class Keyboard {
    public static final int CODE_DELETE = -5;
    public static final int CODE_SETTINGS = -6;
    public static final int CODE_SHORTCUT = -7;
    public static final int CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY = -98;
    // Code value representing the code is not specified.
    public static final int CODE_UNSPECIFIED = -99;

+6 −5
Original line number Diff line number Diff line
@@ -193,9 +193,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
                    // Detected a double tap on shift key. If we are in the ignoring double tap
                    // mode, it means we have already turned off caps lock in
                    // {@link KeyboardSwitcher#onReleaseShift} .
                    final boolean ignoringDoubleTap = mKeyTimerHandler.isIgnoringDoubleTap();
                    if (!ignoringDoubleTap)
                        onDoubleTapShiftKey(tracker);
                    onDoubleTapShiftKey(tracker, mKeyTimerHandler.isIgnoringDoubleTap());
                    return true;
                }
                // Otherwise these events should not be handled as double tap.
@@ -346,11 +344,14 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
        return onLongPress(parentKey, tracker);
    }

    private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker) {
    private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker,
            final boolean ignore) {
        // When shift key is double tapped, the first tap is correctly processed as usual tap. And
        // the second tap is treated as this double tap event, so that we need not mark tracker
        // calling setAlreadyProcessed() nor remove the tracker from mPointerQueue.
        mKeyboardActionListener.onCodeInput(Keyboard.CODE_CAPSLOCK, null, 0, 0);
        final int primaryCode = ignore ? Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY
                : Keyboard.CODE_CAPSLOCK;
        mKeyboardActionListener.onCodeInput(primaryCode, null, 0, 0);
    }

    // This default implementation returns a more keys panel.
+4 −0
Original line number Diff line number Diff line
@@ -1265,7 +1265,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
            break;
        case Keyboard.CODE_CAPSLOCK:
            switcher.toggleCapsLock();
            //$FALL-THROUGH$
        case Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY:
            // Dummy code for haptic and audio feedbacks.
            vibrate();
            playKeyClick(primaryCode);
            break;
        case Keyboard.CODE_SHORTCUT:
            mSubtypeSwitcher.switchToShortcutIME();