Add haptic feedback for caps lock

When long press triggers caps lock, the keyboard also triggers haptic
feedback.

This change also fixes trivial harmless bug in KeyboardSwitcher.

Bug: 5424681
Change-Id: I62706b49abd7be1dcebc3c5166ea03f426fc8c86
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 49e92fd..83871a6 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -649,7 +649,7 @@
     }
 
     public boolean isVibrateAndSoundFeedbackRequired() {
-        return mKeyboardView == null || !mKeyboardView.isInSlidingKeyInput();
+        return mKeyboardView != null && !mKeyboardView.isInSlidingKeyInput();
     }
 
     private int getPointerCount() {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 36e97af..892e5f5 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1259,6 +1259,7 @@
             break;
         case Keyboard.CODE_CAPSLOCK:
             switcher.toggleCapsLock();
+            vibrate();
             break;
         case Keyboard.CODE_SHORTCUT:
             mSubtypeSwitcher.switchToShortcutIME();