Document known limitation of getLayoutDirectionFromLocale()
Document that the version of getLayoutDirectionFromLocale() called
for JellyBean and earlier has an intentional known limitation to
languages written in Arabic and Hebrew scripts.
Bug: 22559274
Change-Id: I52857ff8014504ea5412733e2290fde476482556
diff --git a/compat/java/android/support/v4/text/TextUtilsCompat.java b/compat/java/android/support/v4/text/TextUtilsCompat.java
index 40bc298..f512c16 100644
--- a/compat/java/android/support/v4/text/TextUtilsCompat.java
+++ b/compat/java/android/support/v4/text/TextUtilsCompat.java
@@ -64,6 +64,8 @@
final String scriptSubtag = ICUCompat.maximizeAndGetScript(locale);
if (scriptSubtag == null) return getLayoutDirectionFromFirstChar(locale);
+ // This is intentionally limited to Arabic and Hebrew scripts, since older
+ // versions of Android platform only considered those scripts to be right-to-left.
if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) ||
scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) {
return ViewCompat.LAYOUT_DIRECTION_RTL;