Merge "Add accessors for WebViewFactory.UseExperimentalWebView"
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index 78389c5..345a39e 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -142,7 +142,7 @@
                 || isSystemImeThatHasEnglishKeyboardSubtype(imi);
     }
 
-    private static boolean containsSubtypeOf(InputMethodInfo imi, String language, String mode) {
+    public static boolean containsSubtypeOf(InputMethodInfo imi, String language, String mode) {
         final int N = imi.getSubtypeCount();
         for (int i = 0; i < N; ++i) {
             if (!imi.getSubtypeAt(i).getLocale().startsWith(language)) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index ada30ac..3946d1c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -354,6 +354,7 @@
             if (mPopup != null) {
                 mPopup.dismiss();
             }
+            ((RecentsActivity) mContext).moveTaskToBack(true);
         }
     }
 
diff --git a/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java b/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java
index 6e8c841..4ff9315 100644
--- a/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java
+++ b/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java
@@ -38,7 +38,7 @@
     private static final int SWIPE_FROM_RIGHT = 3;
 
     private final int mSwipeStartThreshold;
-    private final int mSwipeEndThreshold;
+    private final int mSwipeDistanceThreshold;
     private final Callbacks mCallbacks;
     private final int[] mDownPointerId = new int[MAX_TRACKED_POINTERS];
     private final float[] mDownX = new float[MAX_TRACKED_POINTERS];
@@ -55,7 +55,9 @@
         mCallbacks = checkNull("callbacks", callbacks);
         mSwipeStartThreshold = checkNull("context", context).getResources()
                 .getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
-        mSwipeEndThreshold = mSwipeStartThreshold * 2;
+        mSwipeDistanceThreshold = mSwipeStartThreshold;
+        if (DEBUG) Slog.d(TAG,  "mSwipeStartThreshold=" + mSwipeStartThreshold
+                + " mSwipeDistanceThreshold=" + mSwipeDistanceThreshold);
     }
 
     private static <T> T checkNull(String name, T arg) {
@@ -169,17 +171,17 @@
         if (DEBUG) Slog.d(TAG, "pointer " + mDownPointerId[i]
                 + " moved (" + fromX + "->" + x + "," + fromY + "->" + y + ") in " + elapsed);
         if (fromY <= mSwipeStartThreshold
-                && y > fromY + mSwipeEndThreshold
+                && y > fromY + mSwipeDistanceThreshold
                 && elapsed < SWIPE_TIMEOUT_MS) {
             return SWIPE_FROM_TOP;
         }
         if (fromY >= screenHeight - mSwipeStartThreshold
-                && y < fromY - mSwipeEndThreshold
+                && y < fromY - mSwipeDistanceThreshold
                 && elapsed < SWIPE_TIMEOUT_MS) {
             return SWIPE_FROM_BOTTOM;
         }
         if (fromX >= screenWidth - mSwipeStartThreshold
-                && x < fromX - mSwipeEndThreshold
+                && x < fromX - mSwipeDistanceThreshold
                 && elapsed < SWIPE_TIMEOUT_MS) {
             return SWIPE_FROM_RIGHT;
         }
diff --git a/tests/TtsTests/src/com/android/speech/tts/TextToSpeechTests.java b/tests/TtsTests/src/com/android/speech/tts/TextToSpeechTests.java
index b736e9f..9c2cf41 100644
--- a/tests/TtsTests/src/com/android/speech/tts/TextToSpeechTests.java
+++ b/tests/TtsTests/src/com/android/speech/tts/TextToSpeechTests.java
@@ -70,6 +70,8 @@
         // Test 1 :Tests that calls to onLoadLanguage( ) are delegated through to the
         // service without any caching or intermediate steps.
         mTts.setLanguage(new Locale("eng", "USA", "variant"));
+        LittleMock.verify(delegate, LittleMock.times(1)).onIsLanguageAvailable(
+                "eng", "USA", "variant");
         LittleMock.verify(delegate, LittleMock.times(1)).onLoadLanguage(
                 "eng", "USA", "variant");
     }
@@ -82,6 +84,8 @@
         // Test 2 : Tests that when the language is successfully set
         // like above (returns LANG_COUNTRY_AVAILABLE). That the
         // request language changes from that point on.
+        LittleMock.doReturn(TextToSpeech.LANG_COUNTRY_AVAILABLE).when(delegate).onIsLanguageAvailable(
+                "eng", "USA", "variant");
         LittleMock.doReturn(TextToSpeech.LANG_COUNTRY_AVAILABLE).when(delegate).onLoadLanguage(
                 "eng", "USA", "variant");
         mTts.setLanguage(new Locale("eng", "USA", "variant"));
@@ -103,6 +107,8 @@
         // TEST 3 : Tests that the language that is set does not change when the
         // engine reports it could not load the specified language.
         LittleMock.doReturn(TextToSpeech.LANG_NOT_SUPPORTED).when(
+                delegate).onIsLanguageAvailable("fra", "FRA", "");
+        LittleMock.doReturn(TextToSpeech.LANG_NOT_SUPPORTED).when(
                 delegate).onLoadLanguage("fra", "FRA", "");
         mTts.setLanguage(Locale.FRANCE);
         blockingCallSpeak("le fou barre", delegate);
@@ -116,38 +122,6 @@
         assertEquals("", req2.getValue().getVariant());
     }
 
-
-    public void testGetLanguage_invalidReturnValues() {
-        IDelegate delegate = LittleMock.mock(IDelegate.class);
-        MockableTextToSpeechService.setMocker(delegate);
-
-        // Test1: Simple end to end test. Ensure that bad return values
-        // are dealt with appropriately.
-        LittleMock.doReturn(null).when(delegate).onGetLanguage();
-        Locale returnVal = mTts.getLanguage();
-        assertNull(returnVal);
-
-
-        // Bad value 2. An array of length < 3.
-        LittleMock.doReturn(new String[] {"eng", "usa"}).when(delegate).onGetLanguage();
-        returnVal = mTts.getLanguage();
-        assertNull(returnVal);
-    }
-
-    public void testGetLanguage_validReturnValues() {
-        IDelegate delegate = LittleMock.mock(IDelegate.class);
-        MockableTextToSpeechService.setMocker(delegate);
-
-        // A correct value.
-        LittleMock.doReturn(new String[] {"eng", "usa", ""}).when(delegate).onGetLanguage();
-        Locale returnVal = mTts.getLanguage();
-
-        // Note: This is not the same as Locale.US . Well tough luck for
-        // being the only component of the entire framework that standardized
-        // three letter country and language codes.
-        assertEquals(new Locale("eng", "USA", ""), returnVal);
-    }
-
     public void testIsLanguageAvailable() {
         IDelegate delegate = LittleMock.mock(IDelegate.class);
         MockableTextToSpeechService.setMocker(delegate);