Snap for 5130802 from d3da46fdc0f8fc21d059dbf4907b26dfaa277fc9 to pie-cts-release

Change-Id: Icd7b690c080d9abc9db7ec0568e8a764dd420458
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java
index ba55ee9..89e9d95 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java
@@ -346,28 +346,33 @@
         checkNext(map1, map2, LIMIT);
     }
 
-    private static final int SET_LIMIT = 0x10FFFF;
     private static final int propEnum = UProperty.GENERAL_CATEGORY;
 
     @Test
     public void TestUnicodeMapGeneralCategory() {
         logln("Setting General Category");
-        // Android patch begin. b/79168307 Reduce the heap memory needed for the test
-        splitTestUnicodeMapGeneralCategory(0, SET_LIMIT / 2);
-        splitTestUnicodeMapGeneralCategory(SET_LIMIT / 2 + 1, SET_LIMIT);
-        // Android patch end. b/79168307 Reduce the heap memory needed for the test
-    }
-
-    // Android patch begin. b/79168307 Reduce the heap memory needed for the test
-    private void splitTestUnicodeMapGeneralCategory(int startCodePoint, int endCodePoint) {
-        UnicodeMap<String> map1 = new UnicodeMap<String>();
-        Map<Integer, String> map2 = new TreeMap<Integer,String>();
-        for (int cp = startCodePoint; cp <= endCodePoint; ++cp) {
+        UnicodeMap<String> map1 = new UnicodeMap();
+        Map<Integer, String> map2 = new HashMap<Integer, String>();
+        //Map<Integer, String> map3 = new TreeMap<Integer, String>();
+        map1 = new UnicodeMap<String>();
+        map2 = new TreeMap<Integer,String>();
+        for (int cp = 0;;) {
               int enumValue = UCharacter.getIntPropertyValue(cp, propEnum);
               //if (enumValue <= 0) continue; // for smaller set
               String value = UCharacter.getPropertyValueName(propEnum,enumValue, UProperty.NameChoice.LONG);
               map1.put(cp, value);
               map2.put(cp, value);
+              cp++;
+              // Unicode is huge, skip over large parts of it.
+              if (cp == 0x08FF) {           // General Scripts Area.
+                  cp = 0xD700;              // Hangul Syllables Area.
+              } else if (cp == 0x100FF) {   // General Scripts Area.
+                  cp = 0x1F000;             // Symbols Area.
+              } else if (cp == 0x200FF) {   // CJK Unified Ideographs Extensions.
+                  cp = 0x10FF00;            // Supplementary Private Use Area-B.
+              } else if (cp == 0x10FFFF) {  // The end of Unicode.
+                  break;
+              }
         }
         checkNext(map1, map2, Integer.MAX_VALUE);
 
@@ -390,7 +395,6 @@
             }
         }
     }
-    // Android patch end. b/79168307 Reduce the heap memory needed for the test
 
     @Test
     public void TestAUnicodeMap2() {
diff --git a/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java b/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
index 34346d1..0038304 100644
--- a/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
+++ b/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
@@ -343,28 +343,33 @@
         checkNext(map1, map2, LIMIT);
     }
 
-    private static final int SET_LIMIT = 0x10FFFF;
     private static final int propEnum = UProperty.GENERAL_CATEGORY;
 
     @Test
     public void TestUnicodeMapGeneralCategory() {
         logln("Setting General Category");
-        // Android patch begin. b/79168307 Reduce the heap memory needed for the test
-        splitTestUnicodeMapGeneralCategory(0, SET_LIMIT / 2);
-        splitTestUnicodeMapGeneralCategory(SET_LIMIT / 2 + 1, SET_LIMIT);
-        // Android patch end. b/79168307 Reduce the heap memory needed for the test
-    }
-
-    // Android patch begin. b/79168307 Reduce the heap memory needed for the test
-    private void splitTestUnicodeMapGeneralCategory(int startCodePoint, int endCodePoint) {
-        UnicodeMap<String> map1 = new UnicodeMap<String>();
-        Map<Integer, String> map2 = new TreeMap<Integer,String>();
-        for (int cp = startCodePoint; cp <= endCodePoint; ++cp) {
+        UnicodeMap<String> map1 = new UnicodeMap();
+        Map<Integer, String> map2 = new HashMap<Integer, String>();
+        //Map<Integer, String> map3 = new TreeMap<Integer, String>();
+        map1 = new UnicodeMap<String>();
+        map2 = new TreeMap<Integer,String>();
+        for (int cp = 0;;) {
               int enumValue = UCharacter.getIntPropertyValue(cp, propEnum);
               //if (enumValue <= 0) continue; // for smaller set
               String value = UCharacter.getPropertyValueName(propEnum,enumValue, UProperty.NameChoice.LONG);
               map1.put(cp, value);
               map2.put(cp, value);
+              cp++;
+              // Unicode is huge, skip over large parts of it.
+              if (cp == 0x08FF) {           // General Scripts Area.
+                  cp = 0xD700;              // Hangul Syllables Area.
+              } else if (cp == 0x100FF) {   // General Scripts Area.
+                  cp = 0x1F000;             // Symbols Area.
+              } else if (cp == 0x200FF) {   // CJK Unified Ideographs Extensions.
+                  cp = 0x10FF00;            // Supplementary Private Use Area-B.
+              } else if (cp == 0x10FFFF) {  // The end of Unicode.
+                  break;
+              }
         }
         checkNext(map1, map2, Integer.MAX_VALUE);
 
@@ -387,7 +392,6 @@
             }
         }
     }
-    // Android patch end. b/79168307 Reduce the heap memory needed for the test
 
     @Test
     public void TestAUnicodeMap2() {