Merge "Disable invoking VoiceIME using swipe right action" into gingerbread
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
index dafbb66..eeccb96 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
@@ -33,6 +33,7 @@
 import android.inputmethodservice.Keyboard.Key;
 import android.os.Handler;
 import android.os.Message;
+import android.os.SystemClock;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.TypedValue;
@@ -1157,7 +1158,7 @@
         mMiniKeyboardPopup.showAtLocation(this, Gravity.NO_GRAVITY, x, y);
 
         // Inject down event on the key to mini keyboard.
-        long eventTime = System.currentTimeMillis();
+        long eventTime = SystemClock.uptimeMillis();
         mMiniKeyboardPopupTime = eventTime;
         MotionEvent downEvent = generateMiniKeyboardMotionEvent(MotionEvent.ACTION_DOWN, popupKey.x
                 + popupKey.width / 2, popupKey.y + popupKey.height / 2, eventTime);
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index 6772d53..fe4c685 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -25,14 +25,14 @@
     /**
      * The list of unicode values for each keystroke (including surrounding keys)
      */
-    private ArrayList<int[]> mCodes;
+    private final ArrayList<int[]> mCodes;
     
     /**
      * The word chosen from the candidate list, until it is committed.
      */
     private String mPreferredWord;
     
-    private StringBuilder mTypedWord;
+    private final StringBuilder mTypedWord;
 
     private int mCapsCount;
 
@@ -116,11 +116,14 @@
      * Delete the last keystroke as a result of hitting backspace.
      */
     public void deleteLast() {
-        mCodes.remove(mCodes.size() - 1);
-        final int lastPos = mTypedWord.length() - 1;
-        char last = mTypedWord.charAt(lastPos);
-        mTypedWord.deleteCharAt(lastPos);
-        if (Character.isUpperCase(last)) mCapsCount--;
+        final int codesSize = mCodes.size();
+        if (codesSize > 0) {
+            mCodes.remove(codesSize - 1);
+            final int lastPos = mTypedWord.length() - 1;
+            char last = mTypedWord.charAt(lastPos);
+            mTypedWord.deleteCharAt(lastPos);
+            if (Character.isUpperCase(last)) mCapsCount--;
+        }
     }
 
     /**
@@ -132,15 +135,6 @@
         if (wordSize == 0) {
             return null;
         }
-//        StringBuffer sb = new StringBuffer(wordSize);
-//        for (int i = 0; i < wordSize; i++) {
-//            char c = (char) mCodes.get(i)[0];
-//            if (i == 0 && mIsCapitalized) {
-//                c = Character.toUpperCase(c);
-//            }
-//            sb.append(c);
-//        }
-//        return sb;
         return mTypedWord;
     }