Fix bug #7173351 API REVIEW: android.util.LocaleUtil

Change-Id: Iab501f3d61125a4f96e0e8d7ba1cf2029ac8c00a
diff --git a/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java b/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java
index 9c13fe1..30c78a8 100644
--- a/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigurationTest.java
@@ -22,7 +22,6 @@
 import android.content.res.Configuration;
 import android.os.Parcel;
 import android.test.AndroidTestCase;
-import android.util.LocaleUtil;
 import android.view.View;
 
 public class ConfigurationTest extends AndroidTestCase {
diff --git a/tests/tests/text/src/android/text/cts/TextUtilsTest.java b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
index 5ae1ef5..157f146 100755
--- a/tests/tests/text/src/android/text/cts/TextUtilsTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
@@ -27,24 +27,28 @@
 import android.os.Parcelable;
 import android.test.AndroidTestCase;
 import android.text.GetChars;
-import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.SpannedString;
 import android.text.TextPaint;
 import android.text.TextUtils;
-import android.text.TextUtils.EllipsizeCallback;
 import android.text.TextUtils.TruncateAt;
 import android.text.style.BackgroundColorSpan;
 import android.text.style.ReplacementSpan;
 import android.text.style.TextAppearanceSpan;
 import android.text.style.URLSpan;
 import android.util.StringBuilderPrinter;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetNew;
 
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.regex.Pattern;
 
+import static android.view.View.LAYOUT_DIRECTION_LTR;
+import static android.view.View.LAYOUT_DIRECTION_RTL;
+
 /**
  * Test {@link TextUtils}.
  */
@@ -2026,4 +2030,174 @@
         TextUtils.dumpSpans(spanned, printer, prefix);
         assertTrue(builder.length() > 0);
     }
-}
+
+    @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "getLayoutDirectionFromLocale",
+            args = {Locale.class}
+    )
+    public void testGetLayoutDirectionFromLocale() {
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(null));
+
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.ENGLISH));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.CANADA));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.FRANCE));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.FRENCH));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.GERMAN));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.GERMANY));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.ITALIAN));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.ITALY));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.UK));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.US));
+
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.ROOT));
+
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.CHINA));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.CHINESE));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.JAPAN));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.JAPANESE));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.KOREA));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.KOREAN));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.PRC));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.TAIWAN));
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE));
+
+        Locale locale = new Locale("ar");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "AE");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "BH");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "DZ");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "EG");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "IQ");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "JO");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "KW");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "LB");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "LY");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "MA");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "OM");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "QA");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "SA");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "SD");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "SY");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "TN");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ar", "YE");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        locale = new Locale("fa");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("fa", "AF");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("fa", "IR");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        locale = new Locale("iw");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("iw", "IL");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("he");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("he", "IL");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        locale = new Locale("pa_Arab");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("pa_Arab", "PK");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        locale = new Locale("ps");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ps", "AF");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        locale = new Locale("ur");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ur", "IN");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("ur", "PK");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        locale = new Locale("uz_Arab");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+        locale = new Locale("uz_Arab", "AF");
+        assertEquals(LAYOUT_DIRECTION_RTL,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+
+        // Locale without a real language
+        locale = new Locale("zz");
+        assertEquals(LAYOUT_DIRECTION_LTR,
+                TextUtils.getLayoutDirectionFromLocale(locale));
+    }}
diff --git a/tests/tests/view/src/android/view/cts/LocaleUtilTest.java b/tests/tests/view/src/android/view/cts/LocaleUtilTest.java
deleted file mode 100644
index d80ebbe..0000000
--- a/tests/tests/view/src/android/view/cts/LocaleUtilTest.java
+++ /dev/null
@@ -1,204 +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 android.view.cts;
-
-import android.test.AndroidTestCase;
-import android.util.LocaleUtil;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-
-import java.util.Locale;
-
-import static android.view.View.LAYOUT_DIRECTION_LTR;
-import static android.view.View.LAYOUT_DIRECTION_RTL;
-
-/**
- * Test {@link LocaleUtil}.
- */
-public class LocaleUtilTest extends AndroidTestCase {
-
-    @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getLayoutDirectionFromLocale",
-            args = {Locale.class}
-    )
-    public void testGetLayoutDirectionFromLocale() {
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(null));
-
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.ENGLISH));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.FRANCE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.FRENCH));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMANY));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALIAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALY));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.UK));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.US));
-
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT));
-
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINA));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINESE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPANESE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREA));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.PRC));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.TAIWAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE));
-
-        Locale locale = new Locale("ar");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "AE");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "BH");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "DZ");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "EG");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "IQ");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "JO");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "KW");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "LB");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "LY");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "MA");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "OM");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "QA");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "SA");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "SD");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "SY");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "TN");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "YE");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("fa");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("fa", "AF");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("fa", "IR");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("iw");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("iw", "IL");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("he");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("he", "IL");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("pa_Arab");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("pa_Arab", "PK");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("ps");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ps", "AF");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("ur");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ur", "IN");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ur", "PK");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("uz_Arab");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("uz_Arab", "AF");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        // Locale without a real language
-        locale = new Locale("zz");
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(locale));
-    }
-}
\ No newline at end of file