[go: nahoru, domu]

Use our Locale instead of java.util.Locale everywhere

Here is the result of LocaleList construction cost:

benchmark:        16,409 ns LocaleListBenchmark.create[en-US]
benchmark:        32,470 ns LocaleListBenchmark.create[en-US,ja-JP]
benchmark:        47,791 ns LocaleListBenchmark.create[en-US,ja-JP,zh-CH]
benchmark:        62,738 ns LocaleListBenchmark.create[en-US,ja-JP,zh-CH,zh-TW]
benchmark:        77,677 ns LocaleListBenchmark.create[en-US,ja-JP,zh-CH,zh-TW,sr-Latn-SR]

Bug: 139312607
Bug: 122478208
Test: ./gradlew test
Change-Id: I8f20910323e6338fe483efdc65405b2a587e7715
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/LocaleListBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/LocaleListBenchmark.kt
new file mode 100644
index 0000000..df89d71
--- /dev/null
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/LocaleListBenchmark.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2019 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 androidx.ui.text
+
+import androidx.benchmark.junit4.BenchmarkRule
+import androidx.benchmark.junit4.measureRepeated
+import androidx.test.filters.LargeTest
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+@LargeTest
+@RunWith(Parameterized::class)
+class LocaleListBenchmark(val languageTag: String) {
+    companion object {
+        private val langTagPresets = arrayOf("en-US", "ja-JP", "zh-CH", "zh-TW", "sr-Latn-SR")
+
+        @JvmStatic
+        @Parameterized.Parameters(name = "languageTags={0}")
+        fun initParameters(): Array<Any> =
+            // Generates the comma separated language tags from the sliced langTagPresets array.
+            // e.g. this generates, "en-US", "en-US,ja-JP", "en-US,ja-JP,zh-CH", ...
+            langTagPresets.mapIndexed { index, _ -> langTagPresets.sliceArray(0..index) }
+                .map { it.joinToString(",") }
+                .toTypedArray()
+    }
+
+    @get:Rule
+    val benchmarkRule = BenchmarkRule()
+
+    @Test
+    fun create() {
+        benchmarkRule.measureRepeated { LocaleList(languageTag) }
+    }
+}
\ No newline at end of file
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/test/TextBenchmarkHelper.kt b/ui/integration-tests/test/src/main/java/androidx/ui/test/TextBenchmarkHelper.kt
index 435189c..df4691b 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/test/TextBenchmarkHelper.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/test/TextBenchmarkHelper.kt
@@ -22,13 +22,13 @@
 import androidx.ui.graphics.Color
 import androidx.ui.painting.Shadow
 import androidx.ui.text.AnnotatedString
+import androidx.ui.text.LocaleList
 import androidx.ui.text.TextStyle
 import androidx.ui.text.font.FontStyle
 import androidx.ui.text.font.FontWeight
 import androidx.ui.text.style.BaselineShift
 import androidx.ui.text.style.TextDecoration
 import androidx.ui.text.style.TextGeometricTransform
-import java.util.Locale
 import kotlin.math.ceil
 import kotlin.random.Random
 
@@ -52,7 +52,7 @@
         TextStyle(letterSpacing = 0.2f),
         TextStyle(baselineShift = BaselineShift.Subscript),
         TextStyle(textGeometricTransform = TextGeometricTransform(0.5f, 0.5f)),
-        TextStyle(locale = Locale.ITALIAN)
+        TextStyle(localeList = LocaleList("it"))
     )
 
     private fun getTextStyleList(hasMetricAffectingStyle: Boolean) =
diff --git a/ui/ui-text/api/0.1.0-dev01.txt b/ui/ui-text/api/0.1.0-dev01.txt
index 02303f8..8040ae7 100644
--- a/ui/ui-text/api/0.1.0-dev01.txt
+++ b/ui/ui-text/api/0.1.0-dev01.txt
@@ -224,12 +224,12 @@
   }
 
   public final class TextStyle {
-    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     ctor public TextStyle();
     method public androidx.ui.graphics.Color? component1();
     method public androidx.ui.text.style.BaselineShift? component10();
     method public androidx.ui.text.style.TextGeometricTransform? component11();
-    method public java.util.Locale? component12();
+    method public androidx.ui.text.LocaleList? component12();
     method public androidx.ui.graphics.Color? component13();
     method public androidx.ui.text.style.TextDecoration? component14();
     method public androidx.ui.painting.Shadow? component15();
@@ -241,7 +241,7 @@
     method public androidx.ui.text.font.FontFamily? component7();
     method public String? component8();
     method public Float? component9();
-    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     method public androidx.ui.graphics.Color? getBackground();
     method public androidx.ui.text.style.BaselineShift? getBaselineShift();
     method public androidx.ui.graphics.Color? getColor();
@@ -254,7 +254,7 @@
     method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
     method public androidx.ui.text.font.FontWeight? getFontWeight();
     method public Float? getLetterSpacing();
-    method public java.util.Locale? getLocale();
+    method public androidx.ui.text.LocaleList? getLocaleList();
     method public androidx.ui.painting.Shadow? getShadow();
     method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
     method public androidx.ui.text.TextStyle merge(androidx.ui.text.TextStyle? other = null);
diff --git a/ui/ui-text/api/api_lint.ignore b/ui/ui-text/api/api_lint.ignore
index bfe8ce1..83e5587 100644
--- a/ui/ui-text/api/api_lint.ignore
+++ b/ui/ui-text/api/api_lint.ignore
@@ -9,17 +9,17 @@
     Must avoid boxed primitives (`java.lang.Float`)
 AutoBoxing: androidx.ui.text.ParagraphStyle#getLineHeight():
     Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, java.util.Locale, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #2:
+AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #2:
     Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, java.util.Locale, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #8:
+AutoBoxing: androidx.ui.text.TextStyle#TextStyle(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #8:
     Must avoid boxed primitives (`java.lang.Float`)
 AutoBoxing: androidx.ui.text.TextStyle#component3():
     Must avoid boxed primitives (`java.lang.Float`)
 AutoBoxing: androidx.ui.text.TextStyle#component9():
     Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, java.util.Locale, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #2:
+AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #2:
     Must avoid boxed primitives (`java.lang.Float`)
-AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, java.util.Locale, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #8:
+AutoBoxing: androidx.ui.text.TextStyle#copy(androidx.ui.graphics.Color, androidx.ui.core.Sp, Float, androidx.ui.text.font.FontWeight, androidx.ui.text.font.FontStyle, androidx.ui.text.font.FontSynthesis, androidx.ui.text.font.FontFamily, String, Float, androidx.ui.text.style.BaselineShift, androidx.ui.text.style.TextGeometricTransform, androidx.ui.text.LocaleList, androidx.ui.graphics.Color, androidx.ui.text.style.TextDecoration, androidx.ui.painting.Shadow) parameter #8:
     Must avoid boxed primitives (`java.lang.Float`)
 AutoBoxing: androidx.ui.text.TextStyle#getFontSizeScale():
     Must avoid boxed primitives (`java.lang.Float`)
diff --git a/ui/ui-text/api/current.txt b/ui/ui-text/api/current.txt
index 02303f8..8040ae7 100644
--- a/ui/ui-text/api/current.txt
+++ b/ui/ui-text/api/current.txt
@@ -224,12 +224,12 @@
   }
 
   public final class TextStyle {
-    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     ctor public TextStyle();
     method public androidx.ui.graphics.Color? component1();
     method public androidx.ui.text.style.BaselineShift? component10();
     method public androidx.ui.text.style.TextGeometricTransform? component11();
-    method public java.util.Locale? component12();
+    method public androidx.ui.text.LocaleList? component12();
     method public androidx.ui.graphics.Color? component13();
     method public androidx.ui.text.style.TextDecoration? component14();
     method public androidx.ui.painting.Shadow? component15();
@@ -241,7 +241,7 @@
     method public androidx.ui.text.font.FontFamily? component7();
     method public String? component8();
     method public Float? component9();
-    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     method public androidx.ui.graphics.Color? getBackground();
     method public androidx.ui.text.style.BaselineShift? getBaselineShift();
     method public androidx.ui.graphics.Color? getColor();
@@ -254,7 +254,7 @@
     method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
     method public androidx.ui.text.font.FontWeight? getFontWeight();
     method public Float? getLetterSpacing();
-    method public java.util.Locale? getLocale();
+    method public androidx.ui.text.LocaleList? getLocaleList();
     method public androidx.ui.painting.Shadow? getShadow();
     method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
     method public androidx.ui.text.TextStyle merge(androidx.ui.text.TextStyle? other = null);
diff --git a/ui/ui-text/api/public_plus_experimental_0.1.0-dev01.txt b/ui/ui-text/api/public_plus_experimental_0.1.0-dev01.txt
index 02303f8..8040ae7 100644
--- a/ui/ui-text/api/public_plus_experimental_0.1.0-dev01.txt
+++ b/ui/ui-text/api/public_plus_experimental_0.1.0-dev01.txt
@@ -224,12 +224,12 @@
   }
 
   public final class TextStyle {
-    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     ctor public TextStyle();
     method public androidx.ui.graphics.Color? component1();
     method public androidx.ui.text.style.BaselineShift? component10();
     method public androidx.ui.text.style.TextGeometricTransform? component11();
-    method public java.util.Locale? component12();
+    method public androidx.ui.text.LocaleList? component12();
     method public androidx.ui.graphics.Color? component13();
     method public androidx.ui.text.style.TextDecoration? component14();
     method public androidx.ui.painting.Shadow? component15();
@@ -241,7 +241,7 @@
     method public androidx.ui.text.font.FontFamily? component7();
     method public String? component8();
     method public Float? component9();
-    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     method public androidx.ui.graphics.Color? getBackground();
     method public androidx.ui.text.style.BaselineShift? getBaselineShift();
     method public androidx.ui.graphics.Color? getColor();
@@ -254,7 +254,7 @@
     method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
     method public androidx.ui.text.font.FontWeight? getFontWeight();
     method public Float? getLetterSpacing();
-    method public java.util.Locale? getLocale();
+    method public androidx.ui.text.LocaleList? getLocaleList();
     method public androidx.ui.painting.Shadow? getShadow();
     method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
     method public androidx.ui.text.TextStyle merge(androidx.ui.text.TextStyle? other = null);
diff --git a/ui/ui-text/api/public_plus_experimental_current.txt b/ui/ui-text/api/public_plus_experimental_current.txt
index 02303f8..8040ae7 100644
--- a/ui/ui-text/api/public_plus_experimental_current.txt
+++ b/ui/ui-text/api/public_plus_experimental_current.txt
@@ -224,12 +224,12 @@
   }
 
   public final class TextStyle {
-    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     ctor public TextStyle();
     method public androidx.ui.graphics.Color? component1();
     method public androidx.ui.text.style.BaselineShift? component10();
     method public androidx.ui.text.style.TextGeometricTransform? component11();
-    method public java.util.Locale? component12();
+    method public androidx.ui.text.LocaleList? component12();
     method public androidx.ui.graphics.Color? component13();
     method public androidx.ui.text.style.TextDecoration? component14();
     method public androidx.ui.painting.Shadow? component15();
@@ -241,7 +241,7 @@
     method public androidx.ui.text.font.FontFamily? component7();
     method public String? component8();
     method public Float? component9();
-    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     method public androidx.ui.graphics.Color? getBackground();
     method public androidx.ui.text.style.BaselineShift? getBaselineShift();
     method public androidx.ui.graphics.Color? getColor();
@@ -254,7 +254,7 @@
     method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
     method public androidx.ui.text.font.FontWeight? getFontWeight();
     method public Float? getLetterSpacing();
-    method public java.util.Locale? getLocale();
+    method public androidx.ui.text.LocaleList? getLocaleList();
     method public androidx.ui.painting.Shadow? getShadow();
     method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
     method public androidx.ui.text.TextStyle merge(androidx.ui.text.TextStyle? other = null);
diff --git a/ui/ui-text/api/restricted_0.1.0-dev01.txt b/ui/ui-text/api/restricted_0.1.0-dev01.txt
index 250ba00..51376c3 100644
--- a/ui/ui-text/api/restricted_0.1.0-dev01.txt
+++ b/ui/ui-text/api/restricted_0.1.0-dev01.txt
@@ -250,12 +250,12 @@
   }
 
   public final class TextStyle {
-    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     ctor public TextStyle();
     method public androidx.ui.graphics.Color? component1();
     method public androidx.ui.text.style.BaselineShift? component10();
     method public androidx.ui.text.style.TextGeometricTransform? component11();
-    method public java.util.Locale? component12();
+    method public androidx.ui.text.LocaleList? component12();
     method public androidx.ui.graphics.Color? component13();
     method public androidx.ui.text.style.TextDecoration? component14();
     method public androidx.ui.painting.Shadow? component15();
@@ -267,7 +267,7 @@
     method public androidx.ui.text.font.FontFamily? component7();
     method public String? component8();
     method public Float? component9();
-    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     method public androidx.ui.graphics.Color? getBackground();
     method public androidx.ui.text.style.BaselineShift? getBaselineShift();
     method public androidx.ui.graphics.Color? getColor();
@@ -280,7 +280,7 @@
     method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
     method public androidx.ui.text.font.FontWeight? getFontWeight();
     method public Float? getLetterSpacing();
-    method public java.util.Locale? getLocale();
+    method public androidx.ui.text.LocaleList? getLocaleList();
     method public androidx.ui.painting.Shadow? getShadow();
     method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
     method public androidx.ui.text.TextStyle merge(androidx.ui.text.TextStyle? other = null);
diff --git a/ui/ui-text/api/restricted_current.txt b/ui/ui-text/api/restricted_current.txt
index 250ba00..51376c3 100644
--- a/ui/ui-text/api/restricted_current.txt
+++ b/ui/ui-text/api/restricted_current.txt
@@ -250,12 +250,12 @@
   }
 
   public final class TextStyle {
-    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    ctor public TextStyle(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     ctor public TextStyle();
     method public androidx.ui.graphics.Color? component1();
     method public androidx.ui.text.style.BaselineShift? component10();
     method public androidx.ui.text.style.TextGeometricTransform? component11();
-    method public java.util.Locale? component12();
+    method public androidx.ui.text.LocaleList? component12();
     method public androidx.ui.graphics.Color? component13();
     method public androidx.ui.text.style.TextDecoration? component14();
     method public androidx.ui.painting.Shadow? component15();
@@ -267,7 +267,7 @@
     method public androidx.ui.text.font.FontFamily? component7();
     method public String? component8();
     method public Float? component9();
-    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, java.util.Locale? locale, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
+    method public androidx.ui.text.TextStyle copy(androidx.ui.graphics.Color? color, androidx.ui.core.Sp? fontSize, Float? fontSizeScale, androidx.ui.text.font.FontWeight? fontWeight, androidx.ui.text.font.FontStyle? fontStyle, androidx.ui.text.font.FontSynthesis? fontSynthesis, androidx.ui.text.font.FontFamily? fontFamily, String? fontFeatureSettings, Float? letterSpacing, androidx.ui.text.style.BaselineShift? baselineShift, androidx.ui.text.style.TextGeometricTransform? textGeometricTransform, androidx.ui.text.LocaleList? localeList, androidx.ui.graphics.Color? background, androidx.ui.text.style.TextDecoration? decoration, androidx.ui.painting.Shadow? shadow);
     method public androidx.ui.graphics.Color? getBackground();
     method public androidx.ui.text.style.BaselineShift? getBaselineShift();
     method public androidx.ui.graphics.Color? getColor();
@@ -280,7 +280,7 @@
     method public androidx.ui.text.font.FontSynthesis? getFontSynthesis();
     method public androidx.ui.text.font.FontWeight? getFontWeight();
     method public Float? getLetterSpacing();
-    method public java.util.Locale? getLocale();
+    method public androidx.ui.text.LocaleList? getLocaleList();
     method public androidx.ui.painting.Shadow? getShadow();
     method public androidx.ui.text.style.TextGeometricTransform? getTextGeometricTransform();
     method public androidx.ui.text.TextStyle merge(androidx.ui.text.TextStyle? other = null);
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
index 7cb64eb..e0aa11a 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
@@ -46,8 +46,8 @@
 import androidx.ui.core.Sp
 import androidx.ui.core.sp
 import androidx.ui.text.AnnotatedString
+import androidx.ui.text.LocaleList
 import androidx.ui.text.style.TextIndent
-import java.util.Locale
 
 val displayText = "Text Demo"
 val displayTextChinese = "文本演示"
@@ -376,7 +376,7 @@
             text = "$text   ",
             style = TextStyle(
                 fontSize = fontSize8,
-                locale = Locale("ja", "JP")
+                localeList = LocaleList("ja-JP")
             )
         )
 
@@ -384,7 +384,7 @@
             text = "$text   ",
             style = TextStyle(
                 fontSize = fontSize8,
-                locale = Locale("zh", "CN")
+                localeList = LocaleList("zh-CN")
             )
         )
 
@@ -392,7 +392,7 @@
             text = text,
             style = TextStyle(
                 fontSize = fontSize8,
-                locale = Locale("zh", "TW")
+                localeList = LocaleList("zh-TW")
             )
         )
     }
@@ -558,11 +558,11 @@
                 Span(text = "$arabicSentence")
                 Span(
                     text = "\n先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。",
-                    style = TextStyle(locale = Locale("zh", "CN"))
+                    style = TextStyle(localeList = LocaleList("zh-CN"))
                 )
                 Span(
                     text = "\nまず、現在天下が魏・呉・蜀に分れており、そのうち蜀は疲弊していることを指摘する。",
-                    style = TextStyle(locale = Locale("ja", "JP"))
+                    style = TextStyle(localeList = LocaleList("ja-JP"))
                 )
             }
         }
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
index a362850..dab3dae 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
@@ -37,8 +37,9 @@
 import androidx.ui.layout.CrossAxisAlignment
 import androidx.ui.foundation.VerticalScroller
 import androidx.ui.text.AnnotatedString
+import androidx.ui.text.Locale
+import androidx.ui.text.LocaleList
 import androidx.ui.text.TextStyle
-import java.util.Locale
 
 /**
  * The offset translator used for credit card input field.
@@ -94,10 +95,12 @@
  *
  * This filer converts ASCII characters to capital form.
  */
-private class CapitalizeTransformation(val locale: Locale = Locale.US) : VisualTransformation {
+private class CapitalizeTransformation(
+    val locale: LocaleList = LocaleList("en-US")
+) : VisualTransformation {
     override fun filter(text: AnnotatedString): TransformedText {
         // TODO(nona): identityTranslater doesn't work for some locale, e.g. Turkish
-        return TransformedText(AnnotatedString(text.text.toUpperCase(locale)), identityTranslater)
+        return TransformedText(AnnotatedString(text.text).toUpperCase(locale), identityTranslater)
     }
 }
 
@@ -189,7 +192,7 @@
                  old, new ->
                     if (new.text.any { !it.isLetterOrDigit() }) old else new
                 },
-                visualTransformation = CapitalizeTransformation(Locale.forLanguageTag("tr"))
+                visualTransformation = CapitalizeTransformation(LocaleList("tr"))
             )
 
             TagLine(tag = "Password")
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
index 7f8dc48..3dd32a6 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
@@ -42,7 +42,6 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
-import java.util.Locale
 
 @RunWith(JUnit4::class)
 @SmallTest
@@ -2484,7 +2483,7 @@
         textStyles: List<AnnotatedString.Item<TextStyle>> = listOf(),
         paragraphStyles: List<AnnotatedString.Item<ParagraphStyle>> = listOf(),
         fontFamily: FontFamily = fontFamilyMeasureFont,
-        locale: Locale? = null,
+        localeList: LocaleList? = null,
         textStyle: TextStyle? = null,
         density: Density? = null,
         layoutDirection: LayoutDirection = LayoutDirection.Ltr,
@@ -2499,7 +2498,7 @@
             textStyle = TextStyle(
                 fontFamily = fontFamily,
                 fontSize = fontSize,
-                locale = locale
+                localeList = localeList
             ).merge(textStyle),
             paragraphStyle = ParagraphStyle(
                 textIndent = textIndent,
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
index e7b570f..902b432 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
@@ -54,7 +54,6 @@
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
 import org.mockito.Mockito.mock
-import java.util.Locale
 import kotlin.math.roundToInt
 
 @RunWith(JUnit4::class)
@@ -1607,19 +1606,19 @@
             val fontSizeInPx = fontSize.toPx().value
             val locales = arrayOf(
                 // duplicate ja is on purpose
-                Locale("ja"),
-                Locale("ja"),
-                Locale("zh", "CN"),
-                Locale("zh", "TW")
+                LocaleList("ja"),
+                LocaleList("ja"),
+                LocaleList("zh-CN"),
+                LocaleList("zh-TW")
             )
 
-            val bitmaps = locales.map { locale ->
+            val bitmaps = locales.map { localeList ->
                 val paragraph = Paragraph(
                     text = text,
                     textStyles = listOf(),
                     style = TextStyle(
                         fontSize = fontSize,
-                        locale = locale
+                        localeList = localeList
                     ),
                     paragraphStyle = ParagraphStyle(),
                     density = defaultDensity,
@@ -3271,7 +3270,7 @@
         lineHeight: Float? = null,
         textStyles: List<AnnotatedString.Item<TextStyle>> = listOf(),
         fontFamily: FontFamily = fontFamilyMeasureFont,
-        locale: Locale? = null,
+        localeList: LocaleList? = null,
         textStyle: TextStyle? = null,
         density: Density? = null,
         textDirectionAlgorithm: TextDirectionAlgorithm? = null,
@@ -3283,7 +3282,7 @@
             style = TextStyle(
                 fontFamily = fontFamily,
                 fontSize = fontSize,
-                locale = locale
+                localeList = localeList
             ).merge(textStyle),
             paragraphStyle = ParagraphStyle(
                 textIndent = textIndent,
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
index de877a2..8c017e3 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
@@ -49,6 +49,8 @@
 import androidx.ui.text.matchers.hasSpanOnTop
 import androidx.ui.text.AnnotatedString
 import androidx.ui.painting.Shadow
+import androidx.ui.text.Locale
+import androidx.ui.text.LocaleList
 import androidx.ui.text.ParagraphStyle
 import androidx.ui.text.TestFontResourceLoader
 import androidx.ui.text.TextStyle
@@ -70,7 +72,6 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
-import java.util.Locale
 import kotlin.math.ceil
 
 @RunWith(JUnit4::class)
@@ -482,8 +483,8 @@
     @Test
     fun testAnnotatedString_setLocaleOnWholeText() {
         val text = "abcde"
-        val locale = Locale("en", "US")
-        val textStyle = TextStyle(locale = locale)
+        val localeList = LocaleList("en-US")
+        val textStyle = TextStyle(localeList = localeList)
 
         val paragraph = simpleParagraph(
             text = text,
@@ -497,8 +498,8 @@
     @Test
     fun testAnnotatedString_setLocaleOnPartText() {
         val text = "abcde"
-        val locale = Locale("en", "US")
-        val textStyle = TextStyle(locale = locale)
+        val localeList = LocaleList("en-US")
+        val textStyle = TextStyle(localeList = localeList)
 
         val paragraph = simpleParagraph(
             text = text,
@@ -512,8 +513,8 @@
     @Test
     fun testAnnotatedString_setLocaleTwice_lastOneOverwrite() {
         val text = "abcde"
-        val textStyle = TextStyle(locale = Locale("en", "US"))
-        val textStyleOverwrite = TextStyle(locale = Locale("ja", "JP"))
+        val textStyle = TextStyle(localeList = LocaleList("en-US"))
+        val textStyleOverwrite = TextStyle(localeList = LocaleList("ja-JP"))
 
         val paragraph = simpleParagraph(
             text = text,
@@ -1068,16 +1069,17 @@
 
     @Test
     fun testTextStyle_locale_appliedOnTextPaint() {
-        val systemLocale = java.util.Locale.JAPANESE
-        val locale = Locale(systemLocale.language, systemLocale.country)
+        val platformLocale = java.util.Locale.JAPANESE
+        val localeList = LocaleList(platformLocale.toLanguageTag())
 
         val paragraph = simpleParagraph(
             text = "",
-            textStyle = TextStyle(locale = locale)
+            textStyle = TextStyle(localeList = localeList)
         )
         paragraph.layout(ParagraphConstraints(width = 0.0f))
 
-        assertThat(paragraph.textPaint.textLocale, equalTo(systemLocale))
+        assertThat(paragraph.textPaint.textLocale.language, equalTo(platformLocale.language))
+        assertThat(paragraph.textPaint.textLocale.country, equalTo(platformLocale.country))
     }
 
     @Test
@@ -1224,11 +1226,11 @@
 
     @Test
     fun locale_isSetOnParagraphImpl_enUS() {
-        val locale = Locale("en", "US")
+        val localeList = LocaleList("en-US")
         val text = "abc"
         val paragraph = simpleParagraph(
             text = text,
-            textStyle = TextStyle(locale = locale)
+            textStyle = TextStyle(localeList = localeList)
         )
 
         paragraph.layout(ParagraphConstraints(width = Float.MAX_VALUE))
@@ -1238,11 +1240,11 @@
 
     @Test
     fun locale_isSetOnParagraphImpl_jpJP() {
-        val locale = Locale("ja", "JP")
+        val localeList = LocaleList("ja-JP")
         val text = "abc"
         val paragraph = simpleParagraph(
             text = text,
-            textStyle = TextStyle(locale = locale)
+            textStyle = TextStyle(localeList = localeList)
         )
 
         paragraph.layout(ParagraphConstraints(width = Float.MAX_VALUE))
@@ -1252,11 +1254,11 @@
 
     @Test
     fun locale_noCountryCode_isSetOnParagraphImpl() {
-        val locale = Locale("ja")
+        val localeList = LocaleList("ja")
         val text = "abc"
         val paragraph = simpleParagraph(
             text = text,
-            textStyle = TextStyle(locale = locale)
+            textStyle = TextStyle(localeList = localeList)
         )
 
         paragraph.layout(ParagraphConstraints(width = Float.MAX_VALUE))
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt
index ba5b36e..189a9cc 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt
@@ -41,7 +41,6 @@
 import androidx.ui.text.style.TextAlign
 import androidx.ui.text.style.TextDirection
 import androidx.ui.text.style.TextOverflow
-import java.util.Locale
 
 /** The default font size if none is specified. */
 private val DefaultFontSize: Sp = 14.sp
@@ -96,8 +95,6 @@
  * to the last line before the line truncated by [maxLines], if [maxLines] is non-null and that
  * line overflows the width constraint.
  *
- * @param locale The locale used to select region-specific glyphs.
- *
  * @param layoutDirection The widget layout direction.
  *
  * @hide
@@ -110,7 +107,6 @@
     val maxLines: Int? = null,
     val softWrap: Boolean = true,
     val overflow: TextOverflow = TextOverflow.Clip,
-    val locale: Locale? = null,
     val density: Density,
     val layoutDirection: LayoutDirection,
     val resourceLoader: Font.ResourceLoader
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt b/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt
index f8be302..b87eb42 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/TextStyle.kt
@@ -30,7 +30,6 @@
 import androidx.ui.graphics.lerp
 import androidx.ui.lerp
 import androidx.ui.painting.Shadow
-import java.util.Locale
 
 /**
  * Configuration object to define the text style.
@@ -52,7 +51,7 @@
  * @param baselineShift This parameter specifies how much the baseline is shifted from the current
  *  position.
  * @param textGeometricTransform The geometric transformation applied the text.
- * @param locale The locale used to select region-specific glyphs.
+ * @param localeList The locale list used to select region-specific glyphs.
  * @param background The background color for the text.
  * @param decoration The decorations to paint near the text (e.g., an underline).
  * @param shadow The shadow effect applied on the text.
@@ -69,7 +68,7 @@
     val letterSpacing: Float? = null,
     val baselineShift: BaselineShift? = null,
     val textGeometricTransform: TextGeometricTransform? = null,
-    val locale: Locale? = null,
+    val localeList: LocaleList? = null,
     val background: Color? = null,
     val decoration: TextDecoration? = null,
     val shadow: Shadow? = null
@@ -98,7 +97,7 @@
             letterSpacing = other.letterSpacing ?: this.letterSpacing,
             baselineShift = other.baselineShift ?: this.baselineShift,
             textGeometricTransform = other.textGeometricTransform ?: this.textGeometricTransform,
-            locale = other.locale ?: this.locale,
+            localeList = other.localeList ?: this.localeList,
             background = other.background ?: this.background,
             decoration = other.decoration ?: this.decoration,
             shadow = other.shadow ?: this.shadow
@@ -219,7 +218,7 @@
                     b.textGeometricTransform ?: TextGeometricTransform.None,
                     t
                 ),
-                locale = lerpDiscrete(a.locale, b.locale, t),
+                localeList = lerpDiscrete(a.localeList, b.localeList, t),
                 background = lerpDiscrete(
                     a.background,
                     b.background,
@@ -260,7 +259,7 @@
             letterSpacing != other.letterSpacing ||
             baselineShift != other.baselineShift ||
             textGeometricTransform != other.textGeometricTransform ||
-            locale != other.locale ||
+            localeList != other.localeList ||
             background != other.background
         ) {
             return RenderComparison.LAYOUT
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
index 7aafef4..97200de 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
@@ -16,6 +16,8 @@
 package androidx.ui.text.platform
 
 import android.graphics.Typeface
+import android.os.Build
+import android.os.LocaleList as AndroidLocaleList
 import android.text.SpannableString
 import android.text.Spanned
 import android.text.TextPaint
@@ -29,6 +31,7 @@
 import android.text.style.ScaleXSpan
 import android.text.style.StrikethroughSpan
 import android.text.style.UnderlineSpan
+import androidx.annotation.RequiresApi
 import androidx.annotation.VisibleForTesting
 import androidx.text.LayoutCompat.ALIGN_CENTER
 import androidx.text.LayoutCompat.ALIGN_LEFT
@@ -63,6 +66,8 @@
 import androidx.ui.painting.Canvas
 import androidx.ui.painting.Path
 import androidx.ui.text.AnnotatedString
+import androidx.ui.text.Locale
+import androidx.ui.text.LocaleList
 import androidx.ui.text.Paragraph
 import androidx.ui.text.ParagraphConstraints
 import androidx.ui.text.ParagraphStyle
@@ -76,7 +81,7 @@
 import androidx.ui.text.style.TextDirection
 import androidx.ui.text.style.TextDirectionAlgorithm
 import androidx.ui.text.style.TextIndent
-import java.util.Locale
+import java.util.Locale as JavaLocale
 import kotlin.math.roundToInt
 
 /**
@@ -142,7 +147,7 @@
         get() = layout?.didExceedMaxLines ?: false
 
     @VisibleForTesting
-    internal val textLocale: Locale
+    internal val textLocale: JavaLocale
         get() = textPaint.textLocale
 
     override val lineCount: Int
@@ -466,10 +471,14 @@
             )
         }
         // TODO(Migration/haoyuchang): implement height
-        style.locale?.let {
+        style.localeList?.let {
             spannableString.setSpan(
-                // TODO(Migration/haoyuchang): support locale fallback in the framework
-                LocaleSpan(Locale(it.language, it.country ?: "")),
+                if (Build.VERSION.SDK_INT >= 24) {
+                    LocaleSpan(it.toAndroidLocaleList())
+                } else {
+                    val locale = if (it.isEmpty()) Locale.current else it[0]
+                    LocaleSpan(locale.toJavaLocale())
+                },
                 start,
                 end,
                 Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
@@ -521,11 +530,13 @@
         typeface = createTypeface(style, typefaceAdapter)
     }
 
-    style.locale?.let {
-        textLocale = Locale(
-            it.language,
-            it.country ?: ""
-        )
+    style.localeList?.let {
+        if (Build.VERSION.SDK_INT >= 24) {
+            textLocales = it.toAndroidLocaleList()
+        } else {
+            val locale = if (it.isEmpty()) Locale.current else it[0]
+            textLocale = locale.toJavaLocale()
+        }
     }
 
     style.color?.let {
@@ -614,4 +625,10 @@
     TextAlign.Start -> ALIGN_NORMAL
     TextAlign.End -> ALIGN_OPPOSITE
     else -> DEFAULT_ALIGNMENT
-}
\ No newline at end of file
+}
+
+private fun Locale.toJavaLocale(): JavaLocale = (platformLocale as AndroidLocale).javaLocale
+
+@RequiresApi(api = 24)
+private fun LocaleList.toAndroidLocaleList(): AndroidLocaleList =
+    AndroidLocaleList(*map { it.toJavaLocale() }.toTypedArray())
\ No newline at end of file
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt
index 772eaae..893b59b 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt
@@ -26,7 +26,6 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
-import java.util.Locale
 
 @RunWith(JUnit4::class)
 class TextDelegateTest() {
@@ -44,7 +43,6 @@
 
         assertThat(textDelegate.maxLines).isNull()
         assertThat(textDelegate.overflow).isEqualTo(TextOverflow.Clip)
-        assertThat(textDelegate.locale).isNull()
     }
 
     @Test
@@ -90,21 +88,6 @@
         assertThat(textDelegate.overflow).isEqualTo(overflow)
     }
 
-    @Test
-    fun `constructor with customized locale`() {
-        val locale = Locale("en", "US")
-
-        val textDelegate = TextDelegate(
-            text = AnnotatedString(text = ""),
-            locale = locale,
-            density = density,
-            resourceLoader = resourceLoader,
-            layoutDirection = LayoutDirection.Ltr
-        )
-
-        assertThat(textDelegate.locale).isEqualTo(locale)
-    }
-
     @Test(expected = AssertionError::class)
     fun `minIntrinsicWidth without layout assertion should fail`() {
         val textDelegate = TextDelegate(
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt
index 1651a1e..a9effe5 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextStyleTest.kt
@@ -34,7 +34,6 @@
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
-import java.util.Locale
 
 @RunWith(JUnit4::class)
 class TextStyleTest {
@@ -47,7 +46,7 @@
         assertThat(textStyle.fontWeight).isNull()
         assertThat(textStyle.fontStyle).isNull()
         assertThat(textStyle.letterSpacing).isNull()
-        assertThat(textStyle.locale).isNull()
+        assertThat(textStyle.localeList).isNull()
         assertThat(textStyle.background).isNull()
         assertThat(textStyle.decoration).isNull()
         assertThat(textStyle.fontFamily).isNull()
@@ -109,11 +108,11 @@
 
     @Test
     fun `constructor with customized locale`() {
-        val locale = Locale("en", "US")
+        val localeList = LocaleList("en-US")
 
-        val textStyle = TextStyle(locale = locale)
+        val textStyle = TextStyle(localeList = localeList)
 
-        assertThat(textStyle.locale).isEqualTo(locale)
+        assertThat(textStyle.localeList).isEqualTo(localeList)
     }
 
     @Test
@@ -410,25 +409,25 @@
 
     @Test
     fun `merge with other's locale is null should use this' locale`() {
-        val locale = Locale("en", "US")
-        val textStyle = TextStyle(locale = locale)
+        val localeList = LocaleList("en-US")
+        val textStyle = TextStyle(localeList = localeList)
         val otherTextStyle = TextStyle()
 
         val newTextStyle = textStyle.merge(otherTextStyle)
 
-        assertThat(newTextStyle.locale).isEqualTo(locale)
+        assertThat(newTextStyle.localeList).isEqualTo(localeList)
     }
 
     @Test
     fun `merge with other's locale is set should use other's locale`() {
-        val locale = Locale("en", "US")
-        val otherLocale = Locale("ja", "JP")
-        val textStyle = TextStyle(locale = locale)
-        val otherTextStyle = TextStyle(locale = otherLocale)
+        val localeList = LocaleList("en-US")
+        val otherlocaleList = LocaleList("ja-JP")
+        val textStyle = TextStyle(localeList = localeList)
+        val otherTextStyle = TextStyle(localeList = otherlocaleList)
 
         val newTextStyle = textStyle.merge(otherTextStyle)
 
-        assertThat(newTextStyle.locale).isEqualTo(otherLocale)
+        assertThat(newTextStyle.localeList).isEqualTo(otherlocaleList)
     }
 
     @Test
@@ -1141,72 +1140,72 @@
 
     @Test
     fun `lerp locale with a is Null and t is smaller than half`() {
-        val locale = Locale("en", "US")
+        val localeList = LocaleList("en-US")
         val t = 0.2f
-        val textStyle = TextStyle(locale = locale)
+        val textStyle = TextStyle(localeList = localeList)
 
         val newTextStyle = TextStyle.lerp(b = textStyle, t = t)
 
-        assertThat(newTextStyle?.locale).isNull()
+        assertThat(newTextStyle?.localeList).isNull()
     }
 
     @Test
     fun `lerp locale with a is Null and t is larger than half`() {
-        val locale = Locale("en", "US")
+        val localeList = LocaleList("en-US")
         val t = 0.8f
-        val textStyle = TextStyle(locale = locale)
+        val textStyle = TextStyle(localeList = localeList)
 
         val newTextStyle = TextStyle.lerp(b = textStyle, t = t)
 
-        assertThat(newTextStyle?.locale).isEqualTo(locale)
+        assertThat(newTextStyle?.localeList).isEqualTo(localeList)
     }
 
     @Test
     fun `lerp locale with b is Null and t is smaller than half`() {
-        val locale = Locale("en", "US")
+        val localeList = LocaleList("en-US")
         val t = 0.2f
-        val textStyle = TextStyle(locale = locale)
+        val textStyle = TextStyle(localeList = localeList)
 
         val newTextStyle = TextStyle.lerp(a = textStyle, t = t)
 
-        assertThat(newTextStyle?.locale).isEqualTo(locale)
+        assertThat(newTextStyle?.localeList).isEqualTo(localeList)
     }
 
     @Test
     fun `lerp locale with b is Null and t is larger than half`() {
-        val locale = Locale("en", "US")
+        val localeList = LocaleList("en-US")
         val t = 0.8f
-        val textStyle = TextStyle(locale = locale)
+        val textStyle = TextStyle(localeList = localeList)
 
         val newTextStyle = TextStyle.lerp(a = textStyle, t = t)
 
-        assertThat(newTextStyle?.locale).isNull()
+        assertThat(newTextStyle?.localeList).isNull()
     }
 
     @Test
     fun `lerp locale with a and b are not Null and t is smaller than half`() {
-        val locale1 = Locale("en", "US")
-        val locale2 = Locale("ja", "JP")
+        val localeList1 = LocaleList("en-US")
+        val localeList2 = LocaleList("ja-JP")
         val t = 0.3f
-        val textStyle1 = TextStyle(locale = locale1)
-        val textStyle2 = TextStyle(locale = locale2)
+        val textStyle1 = TextStyle(localeList = localeList1)
+        val textStyle2 = TextStyle(localeList = localeList2)
 
         val newTextStyle = TextStyle.lerp(a = textStyle1, b = textStyle2, t = t)
 
-        assertThat(newTextStyle?.locale).isEqualTo(locale1)
+        assertThat(newTextStyle?.localeList).isEqualTo(localeList1)
     }
 
     @Test
     fun `lerp locale with a and b are not Null and t is larger than half`() {
-        val locale1 = Locale("en", "US")
-        val locale2 = Locale("ja", "JP")
+        val localeList1 = LocaleList("en-US")
+        val localeList2 = LocaleList("ja-JP")
         val t = 0.8f
-        val textStyle1 = TextStyle(locale = locale1)
-        val textStyle2 = TextStyle(locale = locale2)
+        val textStyle1 = TextStyle(localeList = localeList1)
+        val textStyle2 = TextStyle(localeList = localeList2)
 
         val newTextStyle = TextStyle.lerp(a = textStyle1, b = textStyle2, t = t)
 
-        assertThat(newTextStyle?.locale).isEqualTo(locale2)
+        assertThat(newTextStyle?.localeList).isEqualTo(localeList2)
     }
 
     @Test
@@ -1378,7 +1377,7 @@
             letterSpacing = 1.0f,
             baselineShift = BaselineShift.Subscript,
             textGeometricTransform = TextGeometricTransform(scaleX = 1.0f),
-            locale = Locale("en", "US"),
+            localeList = LocaleList("en-US"),
             background = bgColor,
             decoration = TextDecoration.Underline,
             fontFamily = FontFamily(genericFamily = "sans-serif"),
@@ -1416,7 +1415,7 @@
             .copy(textGeometricTransform = TextGeometricTransform())))
             .isEqualTo(RenderComparison.LAYOUT)
 
-        assertThat(textStyle.compareTo(textStyle.copy(locale = Locale("ja", "JP"))))
+        assertThat(textStyle.compareTo(textStyle.copy(localeList = LocaleList("ja-JP"))))
             .isEqualTo(RenderComparison.LAYOUT)
     }
 
@@ -1437,7 +1436,7 @@
             letterSpacing = 1.0f,
             baselineShift = BaselineShift.Superscript,
             textGeometricTransform = TextGeometricTransform(null, null),
-            locale = Locale("en", "US"),
+            localeList = LocaleList("en-US"),
             decoration = TextDecoration.Underline,
             fontFamily = FontFamily(genericFamily = "sans-serif"),
             shadow = shadow1