Fix IcuCompatTest#testMaximizeAndGetScript pre API 21.

Locale.forLanguageTag did not exist pre API 21.

Bug: 30198627
Change-Id: I26ec272f2db542b763e119867b064f77654237ec
diff --git a/compat/tests/java/android/support/v4/text/IcuCompatTest.java b/compat/tests/java/android/support/v4/text/IcuCompatTest.java
index 0eb4ba1..20aaa9b 100644
--- a/compat/tests/java/android/support/v4/text/IcuCompatTest.java
+++ b/compat/tests/java/android/support/v4/text/IcuCompatTest.java
@@ -16,6 +16,7 @@
 
 package android.support.v4.text;
 
+import android.os.Build;
 import android.test.suitebuilder.annotation.SmallTest;
 
 import junit.framework.TestCase;
@@ -26,6 +27,11 @@
 public class IcuCompatTest extends TestCase {
     public void testMaximizeAndGetScript() {
         assertEquals("Latn", ICUCompat.maximizeAndGetScript(new Locale("en", "US")));
-        assertEquals("Visp", ICUCompat.maximizeAndGetScript(Locale.forLanguageTag("en-Visp-US")));
+
+        // Script tags were added to java.util.Locale only on API 21.
+        if (Build.VERSION.SDK_INT >= 21) {
+            assertEquals(
+                    "Visp", ICUCompat.maximizeAndGetScript(Locale.forLanguageTag("en-Visp-US")));
+        }
     }
 }