"Move core-icu4j into I18n APEX" Attempt 2 am: ee8b64e489

Change-Id: I6662a2df6b4c2f20723ccb6e06c90855d9c13407
diff --git a/src/vogar/android/AndroidSdk.java b/src/vogar/android/AndroidSdk.java
index 464549f..45f11bb 100644
--- a/src/vogar/android/AndroidSdk.java
+++ b/src/vogar/android/AndroidSdk.java
@@ -188,17 +188,31 @@
                 String jar = jarNames[i];
                 File file;
                 if (modeId.isHost()) {
-                    jar = jar.equals("conscrypt-hostdex") ? "conscrypt-host-hostdex" : jar;
+                    if  ("conscrypt-hostdex".equals(jar)) {
+                        jar = "conscrypt-host-hostdex";
+                    } else if ("core-icu4j-hostdex".equals(jar)) {
+                        jar = "core-icu4j-host-hostdex";
+                    }
                     file = new File(String.format(pattern, jar));
                 } else {
-                    if (jar.equals("conscrypt")) {
-                        file = new File(String.format(pattern, jar + ".com.android.conscrypt"));
-                        if (!file.exists()) {
-                          // With unbundled ART, the intermediate directory is under conscrypt.
-                          file = new File(String.format(pattern, jar));
-                        }
+                    final String apexPackage;
+                    // With unbundled ART, the intermediate directory storing the jar file
+                    // outside ART APEX doesn't contain the apex package name.
+                    final boolean tryNonApexIntermediate;
+                    if ("conscrypt".equals(jar)) {
+                        apexPackage = "com.android.conscrypt";
+                        tryNonApexIntermediate = true;
+                    } else if ("core-icu4j".equals(jar)) {
+                        apexPackage = "com.android.i18n";
+                        tryNonApexIntermediate = true;
                     } else {
-                        file = new File(String.format(pattern, jar + ".com.android.art.testing"));
+                        apexPackage = "com.android.art.testing";
+                        tryNonApexIntermediate = false;
+                    }
+
+                    file = new File(String.format(pattern, jar + "." + apexPackage));
+                    if (tryNonApexIntermediate && !file.exists()) {
+                        file = new File(String.format(pattern, jar));
                     }
                 }
                 compilationClasspath[i] = file;