Merge "Fix typo"
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java
index 41da2aa..af10e75 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java
@@ -21,17 +21,14 @@
 import android.media.AudioManager;
 import android.os.SystemClock;
 import android.provider.Settings;
-import android.support.v4.view.MotionEventCompat;
 import android.util.Log;
 import android.view.MotionEvent;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
 import android.view.inputmethod.EditorInfo;
 
-import com.android.inputmethod.compat.AccessibilityManagerCompatUtils;
 import com.android.inputmethod.compat.AudioManagerCompatWrapper;
 import com.android.inputmethod.compat.InputTypeCompatUtils;
-import com.android.inputmethod.compat.MotionEventCompatUtils;
 import com.android.inputmethod.compat.SettingsSecureCompatUtils;
 import com.android.inputmethod.latin.R;
 
@@ -93,7 +90,7 @@
     public boolean isTouchExplorationEnabled() {
         return ENABLE_ACCESSIBILITY
                 && mAccessibilityManager.isEnabled()
-                && AccessibilityManagerCompatUtils.isTouchExplorationEnabled(mAccessibilityManager);
+                && mAccessibilityManager.isTouchExplorationEnabled();
     }
 
     /**
@@ -107,9 +104,9 @@
     public boolean isTouchExplorationEvent(MotionEvent event) {
         final int action = event.getAction();
 
-        return action == MotionEventCompatUtils.ACTION_HOVER_ENTER
-                || action == MotionEventCompatUtils.ACTION_HOVER_EXIT
-                || action == MotionEventCompat.ACTION_HOVER_MOVE;
+        return action == MotionEvent.ACTION_HOVER_ENTER
+                || action == MotionEvent.ACTION_HOVER_EXIT
+                || action == MotionEvent.ACTION_HOVER_MOVE;
     }
 
     /**
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
index 2401d93..c85a551 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
@@ -21,15 +21,12 @@
 import android.graphics.Paint;
 import android.inputmethodservice.InputMethodService;
 import android.support.v4.view.AccessibilityDelegateCompat;
-import android.support.v4.view.MotionEventCompat;
 import android.support.v4.view.ViewCompat;
 import android.support.v4.view.accessibility.AccessibilityEventCompat;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.accessibility.AccessibilityEvent;
 
-import com.android.inputmethod.compat.MotionEventCompatUtils;
-import com.android.inputmethod.compat.ViewParentCompatUtils;
 import com.android.inputmethod.keyboard.Key;
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.keyboard.KeyboardId;
@@ -136,10 +133,10 @@
         mLastHoverKey = key;
 
         switch (event.getAction()) {
-        case MotionEventCompatUtils.ACTION_HOVER_ENTER:
-        case MotionEventCompatUtils.ACTION_HOVER_EXIT:
+        case MotionEvent.ACTION_HOVER_ENTER:
+        case MotionEvent.ACTION_HOVER_EXIT:
             return onHoverKey(key, event);
-        case MotionEventCompat.ACTION_HOVER_MOVE:
+        case MotionEvent.ACTION_HOVER_MOVE:
             if (key != previousKey) {
                 return onTransitionKey(key, previousKey, event);
             } else {
@@ -163,13 +160,13 @@
     private boolean onTransitionKey(Key currentKey, Key previousKey, MotionEvent event) {
         final int savedAction = event.getAction();
 
-        event.setAction(MotionEventCompatUtils.ACTION_HOVER_EXIT);
+        event.setAction(MotionEvent.ACTION_HOVER_EXIT);
         onHoverKey(previousKey, event);
 
-        event.setAction(MotionEventCompatUtils.ACTION_HOVER_ENTER);
+        event.setAction(MotionEvent.ACTION_HOVER_ENTER);
         onHoverKey(currentKey, event);
 
-        event.setAction(MotionEventCompat.ACTION_HOVER_MOVE);
+        event.setAction(MotionEvent.ACTION_HOVER_MOVE);
         final boolean handled = onHoverKey(currentKey, event);
 
         event.setAction(savedAction);
@@ -192,10 +189,10 @@
         }
 
         switch (event.getAction()) {
-        case MotionEventCompatUtils.ACTION_HOVER_ENTER:
+        case MotionEvent.ACTION_HOVER_ENTER:
             sendAccessibilityEventForKey(key, AccessibilityEventCompat.TYPE_VIEW_HOVER_ENTER);
             break;
-        case MotionEventCompatUtils.ACTION_HOVER_EXIT:
+        case MotionEvent.ACTION_HOVER_EXIT:
             sendAccessibilityEventForKey(key, AccessibilityEventCompat.TYPE_VIEW_HOVER_EXIT);
             break;
         }
@@ -214,7 +211,7 @@
         final AccessibilityEvent event = nodeProvider.createAccessibilityEvent(key, eventType);
 
         // Propagates the event up the view hierarchy.
-        ViewParentCompatUtils.requestSendAccessibilityEvent(mView.getParent(), mView, event);
+        mView.getParent().requestSendAccessibilityEvent(mView, event);
     }
 
     private class KeyboardFlickGestureDetector extends FlickGestureDetector {
diff --git a/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java b/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java
index eaa4ddf..e8ec376 100644
--- a/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java
+++ b/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java
@@ -18,11 +18,9 @@
 
 import android.content.Context;
 import android.os.Message;
-import android.support.v4.view.MotionEventCompat;
 import android.view.MotionEvent;
 import android.view.ViewConfiguration;
 
-import com.android.inputmethod.compat.MotionEventCompatUtils;
 import com.android.inputmethod.keyboard.PointerTracker;
 import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
 
@@ -32,10 +30,10 @@
  * A flick gesture is defined as a stream of hover events with the following
  * properties:
  * <ul>
- *   <li>Begins with a {@link MotionEventCompatUtils#ACTION_HOVER_ENTER} event
- *   <li>Contains any number of {@link MotionEventCompat#ACTION_HOVER_MOVE}
+ *   <li>Begins with a {@link MotionEvent#ACTION_HOVER_ENTER} event
+ *   <li>Contains any number of {@link MotionEvent#ACTION_HOVER_MOVE}
  *       events
- *   <li>Ends with a {@link MotionEventCompatUtils#ACTION_HOVER_EXIT} event
+ *   <li>Ends with a {@link MotionEvent#ACTION_HOVER_EXIT} event
  *   <li>Maximum duration of 250 milliseconds
  *   <li>Minimum distance between enter and exit points must be at least equal to
  *       scaled double tap slop (see
@@ -113,7 +111,7 @@
     public boolean onHoverEvent(MotionEvent event, AccessibleKeyboardViewProxy view,
             PointerTracker tracker) {
         // Always cache and consume the first hover event.
-        if (event.getAction() == MotionEventCompatUtils.ACTION_HOVER_ENTER) {
+        if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER) {
             mCachedView = view;
             mCachedTracker = tracker;
             mCachedHoverEnter = MotionEvent.obtain(event);
@@ -129,10 +127,10 @@
         final float distanceSquare = calculateDistanceSquare(mCachedHoverEnter, event);
 
         switch (event.getAction()) {
-        case MotionEventCompat.ACTION_HOVER_MOVE:
+        case MotionEvent.ACTION_HOVER_MOVE:
             // Consume all valid move events before timeout.
             return true;
-        case MotionEventCompatUtils.ACTION_HOVER_EXIT:
+        case MotionEvent.ACTION_HOVER_EXIT:
             // Ignore exit events outside the flick radius.
             if (distanceSquare < mFlickRadiusSquare) {
                 clearFlick(true);
@@ -171,10 +169,8 @@
      * Computes the direction of a flick gesture and forwards it to
      * {@link #onFlick(MotionEvent, MotionEvent, int)} for handling.
      *
-     * @param e1 The {@link MotionEventCompatUtils#ACTION_HOVER_ENTER} event
-     *            where the flick started.
-     * @param e2 The {@link MotionEventCompatUtils#ACTION_HOVER_EXIT} event
-     *            where the flick ended.
+     * @param e1 The {@link MotionEvent#ACTION_HOVER_ENTER} event where the flick started.
+     * @param e2 The {@link MotionEvent#ACTION_HOVER_EXIT} event where the flick ended.
      * @return {@code true} if the flick event was handled.
      */
     private boolean dispatchFlick(MotionEvent e1, MotionEvent e2) {
diff --git a/java/src/com/android/inputmethod/compat/AccessibilityManagerCompatUtils.java b/java/src/com/android/inputmethod/compat/AccessibilityManagerCompatUtils.java
deleted file mode 100644
index 41b6a07..0000000
--- a/java/src/com/android/inputmethod/compat/AccessibilityManagerCompatUtils.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.compat;
-
-import android.view.accessibility.AccessibilityManager;
-
-import java.lang.reflect.Method;
-
-public class AccessibilityManagerCompatUtils {
-    private static final Method METHOD_isTouchExplorationEnabled = CompatUtils.getMethod(
-            AccessibilityManager.class, "isTouchExplorationEnabled");
-
-    private AccessibilityManagerCompatUtils() {
-        // This class is non-instantiable.
-    }
-
-    public static boolean isTouchExplorationEnabled(AccessibilityManager receiver) {
-        return (Boolean) CompatUtils.invoke(receiver, false, METHOD_isTouchExplorationEnabled);
-    }
-}
diff --git a/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java b/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java
deleted file mode 100644
index 9a52301..0000000
--- a/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.compat;
-
-public class MotionEventCompatUtils {
-    // TODO: Remove after these are added to MotionEventCompat.
-    public static final int ACTION_HOVER_ENTER = 0x9;
-    public static final int ACTION_HOVER_EXIT = 0xA;
-}
diff --git a/java/src/com/android/inputmethod/compat/ViewParentCompatUtils.java b/java/src/com/android/inputmethod/compat/ViewParentCompatUtils.java
deleted file mode 100644
index d19bc3a..0000000
--- a/java/src/com/android/inputmethod/compat/ViewParentCompatUtils.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.compat;
-
-import android.view.View;
-import android.view.ViewParent;
-import android.view.accessibility.AccessibilityEvent;
-
-import java.lang.reflect.Method;
-
-public class ViewParentCompatUtils {
-    private static final Method METHOD_requestSendAccessibilityEvent = CompatUtils.getMethod(
-            ViewParent.class, "requestSendAccessibilityEvent", View.class,
-            AccessibilityEvent.class);
-
-    /**
-     * Called by a child to request from its parent to send an {@link AccessibilityEvent}.
-     * The child has already populated a record for itself in the event and is delegating
-     * to its parent to send the event. The parent can optionally add a record for itself.
-     * <p>
-     * Note: An accessibility event is fired by an individual view which populates the
-     *       event with a record for its state and requests from its parent to perform
-     *       the sending. The parent can optionally add a record for itself before
-     *       dispatching the request to its parent. A parent can also choose not to
-     *       respect the request for sending the event. The accessibility event is sent
-     *       by the topmost view in the view tree.</p>
-     *
-     * @param child The child which requests sending the event.
-     * @param event The event to be sent.
-     * @return True if the event was sent.
-     */
-    public static boolean requestSendAccessibilityEvent(
-            ViewParent receiver, View child, AccessibilityEvent event) {
-        return (Boolean) CompatUtils.invoke(
-                receiver, false, METHOD_requestSendAccessibilityEvent, child, event);
-    }
-}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index c1d11a0..b51dbb9 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -37,7 +37,6 @@
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.android.inputmethod.compat.FrameLayoutCompatUtils;
 import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
@@ -853,7 +852,7 @@
             windowContentView.addView(mPreviewPlacer);
         }
         mPreviewPlacer.addView(
-                keyPreview, FrameLayoutCompatUtils.newLayoutParam(mPreviewPlacer, 0, 0));
+                keyPreview, ViewLayoutUtils.newLayoutParam(mPreviewPlacer, 0, 0));
     }
 
     private void showKey(PointerTracker tracker) {
@@ -919,7 +918,7 @@
         previewText.getBackground().setState(
                 key.mMoreKeys != null ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
         previewText.setTextColor(params.mPreviewTextColor);
-        FrameLayoutCompatUtils.placeViewAt(
+        ViewLayoutUtils.placeViewAt(
                 previewText, previewX, previewY, previewWidth, previewHeight);
         previewText.setVisibility(VISIBLE);
     }
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 62bcf6c..e2af971 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -828,15 +828,13 @@
     }
 
     /**
-     * Receives hover events from the input framework. This method overrides
-     * View.dispatchHoverEvent(MotionEvent) on SDK version ICS or higher. On
-     * lower SDK versions, this method is never called.
+     * Receives hover events from the input framework.
      *
      * @param event The motion event to be dispatched.
      * @return {@code true} if the event was handled by the view, {@code false}
      *         otherwise
      */
-    //Should not annotate @override
+    @Override
     public boolean dispatchHoverEvent(MotionEvent event) {
         if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
             final PointerTracker tracker = PointerTracker.getPointerTracker(0, this);
diff --git a/java/src/com/android/inputmethod/compat/FrameLayoutCompatUtils.java b/java/src/com/android/inputmethod/keyboard/ViewLayoutUtils.java
similarity index 73%
rename from java/src/com/android/inputmethod/compat/FrameLayoutCompatUtils.java
rename to java/src/com/android/inputmethod/keyboard/ViewLayoutUtils.java
index 523bf7d..ee50470 100644
--- a/java/src/com/android/inputmethod/compat/FrameLayoutCompatUtils.java
+++ b/java/src/com/android/inputmethod/keyboard/ViewLayoutUtils.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.inputmethod.compat;
+package com.android.inputmethod.keyboard;
 
 import android.view.View;
 import android.view.ViewGroup;
@@ -22,20 +22,9 @@
 import android.widget.FrameLayout;
 import android.widget.RelativeLayout;
 
-public class FrameLayoutCompatUtils {
-    private static final boolean NEEDS_FRAME_LAYOUT_HACK = (
-            android.os.Build.VERSION.SDK_INT < 11 /* Honeycomb */);
-
-    public static ViewGroup getPlacer(ViewGroup container) {
-        if (NEEDS_FRAME_LAYOUT_HACK) {
-            // Insert RelativeLayout to be able to setMargin because pre-Honeycomb FrameLayout
-            // could not handle setMargin properly.
-            final ViewGroup placer = new RelativeLayout(container.getContext());
-            container.addView(placer);
-            return placer;
-        } else {
-            return container;
-        }
+public class ViewLayoutUtils {
+    private ViewLayoutUtils() {
+        // This utility class is not publicly instantiable.
     }
 
     public static MarginLayoutParams newLayoutParam(ViewGroup placer, int width, int height) {
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
index ca25354..1ad37b9 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
@@ -52,11 +52,11 @@
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.android.inputmethod.compat.FrameLayoutCompatUtils;
 import com.android.inputmethod.keyboard.KeyboardActionListener;
 import com.android.inputmethod.keyboard.KeyboardView;
 import com.android.inputmethod.keyboard.MoreKeysPanel;
 import com.android.inputmethod.keyboard.PointerTracker;
+import com.android.inputmethod.keyboard.ViewLayoutUtils;
 import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
@@ -416,7 +416,7 @@
                                 ViewGroup.LayoutParams.WRAP_CONTENT);
                         final int infoWidth = info.getMeasuredWidth();
                         final int y = info.getMeasuredHeight();
-                        FrameLayoutCompatUtils.placeViewAt(
+                        ViewLayoutUtils.placeViewAt(
                                 info, x - infoWidth, y, infoWidth, info.getMeasuredHeight());
                     }
                 }