Add `android_ravenwood_test` build rule

Since we're unable to compile libcore classes for the device,
we temporarily pivot usages to our own copy of EmptyArray.

Bug: 292141694
Test: m nothing --no-skip-soong-tests
Test: m hoststubgen ravenwood-runtime tradefed atest && atest-dev HostStubGenTest-framework-test
Change-Id: I9d4ff559924e47725eb3e897aaf2cc93e9b1a193
diff --git a/Ravenwood.bp b/Ravenwood.bp
index da02298..1582266 100644
--- a/Ravenwood.bp
+++ b/Ravenwood.bp
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 // We need this "trampoline" rule to force soong to give a host-side jar to
-// framework-minus-apex.ravenwood. Otherwise, soong would mix up the arch (?) and we'd get
+// framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get
 // a dex jar.
 java_library {
     name: "framework-minus-apex-for-hoststubgen",
@@ -26,7 +26,7 @@
 }
 
 // Generate the stub/impl from framework-all, with hidden APIs.
-java_genrule_host {
+java_genrule {
     name: "framework-minus-apex.ravenwood-base",
     tools: ["hoststubgen"],
     cmd: "$(location hoststubgen) " +
@@ -57,7 +57,9 @@
 }
 
 // Extract the impl jar from "framework-minus-apex.ravenwood-base" for subsequent build rules.
-java_genrule_host {
+// Note this emits a "device side" output, so that ravenwood tests can (implicitly)
+// depend on it.
+java_genrule {
     name: "framework-minus-apex.ravenwood",
     defaults: ["hoststubgen-for-prototype-only-genrule"],
     cmd: "cp $(in) $(out)",
@@ -68,3 +70,17 @@
         "framework-minus-apex.ravenwood.jar",
     ],
 }
+
+android_ravenwood_libgroup {
+    name: "ravenwood-runtime",
+    libs: [
+        "framework-minus-apex.ravenwood",
+        "hoststubgen-helper-runtime.ravenwood",
+        "hoststubgen-helper-framework-runtime.ravenwood",
+    ],
+}
+
+android_ravenwood_libgroup {
+    name: "ravenwood-utils",
+    libs: [],
+}
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java
index 155f508..2945c8f 100644
--- a/core/java/android/util/ArrayMap.java
+++ b/core/java/android/util/ArrayMap.java
@@ -21,8 +21,6 @@
 
 import com.android.internal.util.ArrayUtils;
 
-import libcore.util.EmptyArray;
-
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.ConcurrentModificationException;
diff --git a/core/java/android/util/EmptyArray.java b/core/java/android/util/EmptyArray.java
new file mode 100644
index 0000000..1216024
--- /dev/null
+++ b/core/java/android/util/EmptyArray.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 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 android.util;
+
+import android.annotation.NonNull;
+
+/**
+ * Empty array is immutable. Use a shared empty array to avoid allocation.
+ *
+ * @hide
+ */
+public final class EmptyArray {
+    private EmptyArray() {}
+
+    public static final @NonNull boolean[] BOOLEAN = new boolean[0];
+    public static final @NonNull byte[] BYTE = new byte[0];
+    public static final @NonNull char[] CHAR = new char[0];
+    public static final @NonNull double[] DOUBLE = new double[0];
+    public static final @NonNull float[] FLOAT = new float[0];
+    public static final @NonNull int[] INT = new int[0];
+    public static final @NonNull long[] LONG = new long[0];
+    public static final @NonNull Object[] OBJECT = new Object[0];
+    public static final @NonNull String[] STRING = new String[0];
+}
diff --git a/framework-minus-apex-ravenwood-policies.txt b/framework-minus-apex-ravenwood-policies.txt
index 6bac58b..bfb192e 100644
--- a/framework-minus-apex-ravenwood-policies.txt
+++ b/framework-minus-apex-ravenwood-policies.txt
@@ -1 +1,9 @@
 # Ravenwood "policy" file for framework-minus-apex.
+
+class android.util.ArrayMap stubclass
+class android.util.ContainerHelpers stubclass
+class android.util.EmptyArray stubclass
+class android.util.MapCollections stubclass
+
+class android.util.Log stubclass
+class android.util.Log !com.android.hoststubgen.nativesubstitution.Log_host
diff --git a/tools/hoststubgen/hoststubgen/Android.bp b/tools/hoststubgen/hoststubgen/Android.bp
index 226e2fad..4160f49 100644
--- a/tools/hoststubgen/hoststubgen/Android.bp
+++ b/tools/hoststubgen/hoststubgen/Android.bp
@@ -12,6 +12,7 @@
     name: "hoststubgen-for-prototype-only-genrule",
     visibility: [
         ":__subpackages__",
+        "//frameworks/base",
         "//frameworks/base/ravenwood:__subpackages__",
     ],
 }
@@ -21,6 +22,7 @@
     name: "hoststubgen-for-prototype-only-java",
     visibility: [
         ":__subpackages__",
+        "//frameworks/base",
         "//frameworks/base/ravenwood:__subpackages__",
     ],
 }
@@ -30,6 +32,7 @@
     name: "hoststubgen-for-prototype-only-filegroup",
     visibility: [
         ":__subpackages__",
+        "//frameworks/base",
         "//frameworks/base/ravenwood:__subpackages__",
     ],
 }
@@ -44,8 +47,6 @@
     ],
     host_supported: true,
 
-    // Seems like we need it to avoid circular deps.
-    // Copied it from "app-compat-annotations".
     sdk_version: "core_current",
 }
 
@@ -66,6 +67,21 @@
     visibility: ["//visibility:public"],
 }
 
+java_library {
+    name: "hoststubgen-helper-runtime.ravenwood",
+    srcs: [
+        "helper-runtime-src/**/*.java",
+    ],
+    libs: [
+        "junit",
+    ],
+    static_libs: [
+        "guava",
+    ],
+    jarjar_rules: "jarjar-rules.txt",
+    visibility: ["//visibility:public"],
+}
+
 // Host-side stub generator tool.
 java_binary_host {
     name: "hoststubgen",
@@ -245,6 +261,18 @@
     ],
 }
 
+java_library {
+    name: "hoststubgen-helper-framework-runtime.ravenwood",
+    defaults: ["hoststubgen-for-prototype-only-java"],
+    srcs: [
+        "helper-framework-runtime-src/framework/**/*.java",
+    ],
+    libs: [
+        "hoststubgen-helper-runtime.ravenwood",
+        "framework-minus-apex.ravenwood",
+    ],
+}
+
 // Defaults for host side test modules.
 // We need two rules for each test.
 // 1. A "-test-lib" jar, which compiles the test against the stub jar.
diff --git a/tools/hoststubgen/hoststubgen/framework-policy-override.txt b/tools/hoststubgen/hoststubgen/framework-policy-override.txt
index 295498d..ff0fe32 100644
--- a/tools/hoststubgen/hoststubgen/framework-policy-override.txt
+++ b/tools/hoststubgen/hoststubgen/framework-policy-override.txt
@@ -62,6 +62,7 @@
 # Used by ArrayMap. No need to put them in the stub, but we need them in impl.
 class android.util.MapCollections         keepclass
 class android.util.ContainerHelpers       keepclass
+class android.util.EmptyArray             stubclass
 class com.android.internal.util.XmlUtils  keepclass
 class com.android.internal.util.FastMath  keepclass
 class android.util.MathUtils              keepclass
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ImplicitOutputFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ImplicitOutputFilter.kt
index c6334c4..78c44ea 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ImplicitOutputFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ImplicitOutputFilter.kt
@@ -23,6 +23,7 @@
 import com.android.hoststubgen.log
 import com.android.hoststubgen.asm.ClassNodes
 import com.android.hoststubgen.asm.isVisibilityPrivateOrPackagePrivate
+import org.objectweb.asm.tree.ClassNode
 
 /**
  * Filter implementing "implicit" rules, such as:
@@ -35,10 +36,7 @@
         private val classes: ClassNodes,
         fallback: OutputFilter
 ) : DelegatingFilter(fallback) {
-    private fun getClassImplicitPolicy(className: String): FilterPolicyWithReason? {
-        // TODO: This check should be cached.
-        val cn = classes.getClass(className)
-
+    private fun getClassImplicitPolicy(className: String, cn: ClassNode): FilterPolicyWithReason? {
         if (isAnonymousInnerClass(cn)) {
             log.forDebug {
 //                log.d("  anon-inner class: ${className} outer: ${cn.outerClass}  ")
@@ -57,10 +55,24 @@
     }
 
     override fun getPolicyForClass(className: String): FilterPolicyWithReason {
-        // Use the implicit policy, if any.
-        getClassImplicitPolicy(className)?.let { return it }
+        val fallback = super.getPolicyForClass(className)
 
-        return super.getPolicyForClass(className)
+        // TODO: This check should be cached.
+        val cn = classes.getClass(className)
+
+        if (cn.superName == "java/lang/Enum" &&
+                fallback.policy == FilterPolicy.Keep) {
+            return FilterPolicy.KeepClass.withReason("enum")
+        }
+        if (cn.interfaces.contains("java/lang/annotation/Annotation") &&
+                fallback.policy == FilterPolicy.Keep) {
+            return FilterPolicy.KeepClass.withReason("annotation")
+        }
+
+        // Use the implicit policy, if any.
+        getClassImplicitPolicy(className, cn)?.let { return it }
+
+        return fallback
     }
 
     override fun getPolicyForMethod(
diff --git a/tools/hoststubgen/hoststubgen/test-framework/AndroidHostTest.bp b/tools/hoststubgen/hoststubgen/test-framework/AndroidHostTest.bp
index b71e5c4..1f8382a 100644
--- a/tools/hoststubgen/hoststubgen/test-framework/AndroidHostTest.bp
+++ b/tools/hoststubgen/hoststubgen/test-framework/AndroidHostTest.bp
@@ -42,3 +42,16 @@
     ],
     test_suites: ["general-tests"],
 }
+
+// "Productionized" build rule.
+android_ravenwood_test {
+    name: "HostStubGenTest-framework-test",
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "junit",
+        "truth",
+        "mockito",
+    ],
+}
diff --git a/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/ArrayMapTest.java b/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/ArrayMapTest.java
index 62bbf48..2c5949c 100644
--- a/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/ArrayMapTest.java
+++ b/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/ArrayMapTest.java
@@ -23,16 +23,10 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
 import android.util.ArrayMap;
 import android.util.Log;
 
-import androidx.test.runner.AndroidJUnit4;
-
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
 import java.util.AbstractMap;
 import java.util.Arrays;
@@ -50,111 +44,9 @@
 /**
  * Some basic tests for {@link android.util.ArrayMap}.
  */
-@RunWith(AndroidJUnit4.class)
 public class ArrayMapTest {
     static final boolean DEBUG = false;
 
-    static final int OP_ADD = 1;
-    static final int OP_REM = 2;
-
-    static int[] OPS = new int[]{
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD, OP_ADD,
-            OP_ADD, OP_ADD, OP_ADD,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-            OP_REM, OP_REM, OP_REM,
-            OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM, OP_REM,
-    };
-
-    static int[] KEYS = new int[]{
-            // General adding and removing.
-            -1, 1900, 600, 200, 1200, 1500, 1800, 100, 1900,
-            2100, 300, 800, 600, 1100, 1300, 2000, 1000, 1400,
-            600, -1, 1900, 600, 300, 2100, 200, 800, 800,
-            1800, 1500, 1300, 1100, 2000, 1400, 1000, 1200, 1900,
-
-            // Shrink when removing item from end.
-            100, 200, 300, 400, 500, 600, 700, 800, 900,
-            900, 800, 700, 600, 500, 400, 300, 200, 100,
-
-            // Shrink when removing item from middle.
-            100, 200, 300, 400, 500, 600, 700, 800, 900,
-            900, 800, 700, 600, 500, 400, 200, 300, 100,
-
-            // Shrink when removing item from front.
-            100, 200, 300, 400, 500, 600, 700, 800, 900,
-            900, 800, 700, 600, 500, 400, 100, 200, 300,
-
-            // Test hash collisions.
-            105, 106, 108, 104, 102, 102, 107, 5, 205,
-            4, 202, 203, 3, 5, 101, 109, 200, 201,
-            0, -1, 100,
-            106, 108, 104, 102, 103, 105, 107, 101, 109,
-            -1, 100, 0,
-            4, 5, 3, 5, 200, 203, 202, 201, 205,
-    };
-
-    public static class ControlledHash implements Parcelable {
-        final int mValue;
-
-        ControlledHash(int value) {
-            mValue = value;
-        }
-
-        @Override
-        public final boolean equals(Object o) {
-            if (o == null) {
-                return false;
-            }
-            return mValue == ((ControlledHash)o).mValue;
-        }
-
-        @Override
-        public final int hashCode() {
-            return mValue/100;
-        }
-
-        @Override
-        public final String toString() {
-            return Integer.toString(mValue);
-        }
-
-        @Override
-        public int describeContents() {
-            return 0;
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            dest.writeInt(mValue);
-        }
-
-        public static final Parcelable.Creator<ControlledHash> CREATOR
-                = new Parcelable.Creator<ControlledHash>() {
-            public ControlledHash createFromParcel(Parcel in) {
-                return new ControlledHash(in.readInt());
-            }
-
-            public ControlledHash[] newArray(int size) {
-                return new ControlledHash[size];
-            }
-        };
-    }
-
     private static boolean compare(Object v1, Object v2) {
         if (v1 == null) {
             return v2 == null;
@@ -287,35 +179,6 @@
         }
     }
 
-    private static void compareBundles(Bundle bundle1, Bundle bundle2) {
-        Set<String> keySet1 = bundle1.keySet();
-        Iterator<String> iterator1 = keySet1.iterator();
-        while (iterator1.hasNext()) {
-            String key = iterator1.next();
-            int value1 = bundle1.getInt(key);
-            if (bundle2.get(key) == null) {
-                fail("Bad Bundle: bundle2 didn't have expected key " + key);
-            }
-            int value2 = bundle2.getInt(key);
-            if (value1 != value2) {
-                fail("Bad Bundle: at key key " + key + " expected " + value1 + ", got " + value2);
-            }
-        }
-        Set<String> keySet2 = bundle2.keySet();
-        Iterator<String> iterator2 = keySet2.iterator();
-        while (iterator2.hasNext()) {
-            String key = iterator2.next();
-            if (bundle1.get(key) == null) {
-                fail("Bad Bundle: bundle1 didn't have expected key " + key);
-            }
-            int value1 = bundle1.getInt(key);
-            int value2 = bundle2.getInt(key);
-            if (value1 != value2) {
-                fail("Bad Bundle: at key key " + key + " expected " + value1 + ", got " + value2);
-            }
-        }
-    }
-
     private static void dump(Map map, ArrayMap array) {
         Log.e("test", "HashMap of " + map.size() + " entries:");
         Set<Map.Entry> mapSet = map.entrySet();
@@ -339,96 +202,6 @@
         }
     }
 
-    private static void dump(Bundle bundle1, Bundle bundle2) {
-        Log.e("test", "First Bundle of " + bundle1.size() + " entries:");
-        Set<String> keys1 = bundle1.keySet();
-        for (String key : keys1) {
-            Log.e("test", "    " + key + " -> " + bundle1.get(key));
-        }
-        Log.e("test", "Second Bundle of " + bundle2.size() + " entries:");
-        Set<String> keys2 = bundle2.keySet();
-        for (String key : keys2) {
-            Log.e("test", "    " + key + " -> " + bundle2.get(key));
-        }
-    }
-
-    @Test
-    public void testBasicArrayMap() {
-        HashMap<ControlledHash, Integer> hashMap = new HashMap<>();
-        ArrayMap<ControlledHash, Integer> arrayMap = new ArrayMap<>();
-        Bundle bundle = new Bundle();
-
-        for (int i = 0; i < OPS.length; i++) {
-            Integer oldHash;
-            Integer oldArray;
-            ControlledHash key = KEYS[i] < 0 ? null : new ControlledHash(KEYS[i]);
-            String strKey = KEYS[i] < 0 ? null : Integer.toString(KEYS[i]);
-            switch (OPS[i]) {
-                case OP_ADD:
-                    if (DEBUG) Log.i("test", "Adding key: " + key);
-                    oldHash = hashMap.put(key, i);
-                    oldArray = arrayMap.put(key, i);
-                    bundle.putInt(strKey, i);
-                    break;
-                case OP_REM:
-                    if (DEBUG) Log.i("test", "Removing key: " + key);
-                    oldHash = hashMap.remove(key);
-                    oldArray = arrayMap.remove(key);
-                    bundle.remove(strKey);
-                    break;
-                default:
-                    fail("Bad operation " + OPS[i] + " @ " + i);
-                    return;
-            }
-            if (!compare(oldHash, oldArray)) {
-                String msg = "Bad result: expected " + oldHash + ", got " + oldArray;
-                Log.e("test", msg);
-                dump(hashMap, arrayMap);
-                fail(msg);
-            }
-            try {
-                validateArrayMap(arrayMap);
-            } catch (Throwable e) {
-                Log.e("test", e.getMessage());
-                dump(hashMap, arrayMap);
-                throw e;
-            }
-            try {
-                compareMaps(hashMap, arrayMap);
-            } catch (Throwable e) {
-                Log.e("test", e.getMessage());
-                dump(hashMap, arrayMap);
-                throw e;
-            }
-            Parcel parcel = Parcel.obtain();
-            bundle.writeToParcel(parcel, 0);
-            parcel.setDataPosition(0);
-            Bundle bundle2 = parcel.readBundle();
-            try {
-                compareBundles(bundle, bundle2);
-            } catch (Throwable e) {
-                Log.e("test", e.getMessage());
-                dump(bundle, bundle2);
-                throw e;
-            }
-        }
-
-        arrayMap.put(new ControlledHash(50000), 100);
-        ControlledHash lookup = new ControlledHash(50000);
-        Iterator<ControlledHash> it = arrayMap.keySet().iterator();
-        while (it.hasNext()) {
-            if (it.next().equals(lookup)) {
-                it.remove();
-            }
-        }
-        if (arrayMap.containsKey(lookup)) {
-            String msg = "Bad map iterator: didn't remove test key";
-            Log.e("test", msg);
-            dump(hashMap, arrayMap);
-            fail(msg);
-        }
-    }
-
     @Test
     public void testCopyArrayMap() {
         // map copy constructor test
@@ -481,44 +254,6 @@
         }
     }
 
-//    /**
-//     * Test creating a malformed array map with duplicated keys and that we will catch this when
-//     * unparcelling.
-//     */
-//    @Test
-//    public void testDuplicateKeys() throws NoSuchMethodException,
-//            InvocationTargetException, IllegalAccessException, NoSuchFieldException {
-//        ArrayMap<String, Object> map1 = new ArrayMap(2);
-//
-//        Method appendMethod = ArrayMap.class.getMethod("append", Object.class, Object.class);
-//        appendMethod.invoke(map1, Integer.toString(100000), "foo");
-//        appendMethod.invoke(map1, Integer.toString(100000), "bar");
-//
-//        // Now parcel/unparcel, and verify we get the expected error.
-//        Parcel parcel = Parcel.obtain();
-//        Method writeArrayMapMethod = Parcel.class.getMethod("writeArrayMap", ArrayMap.class);
-//        writeArrayMapMethod.invoke(parcel, map1);
-//        parcel.setDataPosition(0);
-//        ArrayMap<String, Object> map2 = new ArrayMap(2);
-//
-//        try {
-//            Parcel.class.getMethod("readArrayMap", ArrayMap.class, ClassLoader.class).invoke(
-//                    parcel, map2, null);
-//        } catch (InvocationTargetException e) {
-//            Throwable cause = e.getCause();
-//            if (cause instanceof IllegalArgumentException) {
-//                // Good!
-//                return;
-//            }
-//            throw e;
-//        }
-//
-//        String msg = "Didn't throw expected IllegalArgumentException";
-//        Log.e("test", msg);
-//        dump(map1, map2);
-//        fail(msg);
-//    }
-
     private static void checkEntrySetToArray(ArrayMap<?, ?> testMap) {
         try {
             testMap.entrySet().toArray();
@@ -734,4 +469,4 @@
             fail("ArrayMap replaceAll failure, expect " + expectedMap + ", but " + map);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/LogTest.java b/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/LogTest.java
index 56544b4..3e33b54 100644
--- a/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/LogTest.java
+++ b/tools/hoststubgen/hoststubgen/test-framework/src/com/android/hoststubgen/frameworktest/LogTest.java
@@ -18,7 +18,6 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.util.Log;
-import android.util.Slog;
 
 import org.junit.Test;
 
@@ -33,12 +32,6 @@
         Log.i("TAG", "Test i log");
         Log.w("TAG", "Test w log");
         Log.e("TAG", "Test e log");
-
-        Slog.v("TAG", "Test v slog");
-        Slog.d("TAG", "Test d slog");
-        Slog.i("TAG", "Test i slog");
-        Slog.w("TAG", "Test w slog");
-        Slog.e("TAG", "Test e slog");
     }
 
     @Test
diff --git a/tools/hoststubgen/scripts/run-all-tests.sh b/tools/hoststubgen/scripts/run-all-tests.sh
index 8bc88de..ba1d404 100755
--- a/tools/hoststubgen/scripts/run-all-tests.sh
+++ b/tools/hoststubgen/scripts/run-all-tests.sh
@@ -24,8 +24,14 @@
   hoststubgen-test-tiny-test
 )
 
-# First, build all the test modules. This shouldn't fail.
-run m run-ravenwood-test ${READY_TEST_MODULES[*]} ${NOT_READY_TEST_MODULES[*]}
+MUST_BUILD_MODULES=(
+    run-ravenwood-test
+    "${NOT_READY_TEST_MODULES[*]}"
+    HostStubGenTest-framework-test
+)
+
+# First, build all the test / etc modules. This shouldn't fail.
+run m "${MUST_BUILD_MODULES[@]}"
 
 # Next, run the golden check. This should always pass too.
 # The following scripts _should_ pass too, but they depend on the internal paths to soong generated