Cherry-pick Ravenwood "core" code
- Copied f/b/r and f/b/t/h
- Ported files under f/b/core, only what needed to for run-ravenwood-tests.sh to pass
- Local changes because of missing resoucres support
- Added @DisabledOnRavenwood(reason="AOSP is missing resources support") to tests under f/b/r that depends on resources
bivalentinst and servicestest
- Added try-catch around ResourcesManager.setInstance()
Flag: EXEMPT host test change only
Bug: 292141694
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh
Merged-in: I8a9b8374be3ae052ba4f152eb43af20d0871597f
Change-Id: Iefd574dbded8c4ab2e244c4918c26641364a3432
diff --git a/Ravenwood.bp b/Ravenwood.bp
index 7faa33f..ec58210 100644
--- a/Ravenwood.bp
+++ b/Ravenwood.bp
@@ -25,13 +25,15 @@
visibility: ["//visibility:private"],
}
-// Generate the stub/impl from framework-all, with hidden APIs.
+// Process framework-all with hoststubgen for Ravenwood.
// This step takes several tens of seconds, so we manually shard it to multiple modules.
// All the copies have to be kept in sync.
-// TODO: Do the sharding better.
+// TODO: Do the sharding better, either by making hostsubgen support sharding natively, or
+// making a better build rule.
genrule_defaults {
name: "framework-minus-apex.ravenwood-base_defaults",
+ defaults: ["ravenwood-internal-only-visibility-genrule"],
tools: ["hoststubgen"],
srcs: [
":framework-minus-apex-for-hoststubgen",
@@ -41,148 +43,101 @@
],
out: [
"ravenwood.jar",
-
- // Following files are created just as FYI.
- "hoststubgen_framework-minus-apex_keep_all.txt",
- "hoststubgen_framework-minus-apex_dump.txt",
-
"hoststubgen_framework-minus-apex.log",
- "hoststubgen_framework-minus-apex_stats.csv",
- "hoststubgen_framework-minus-apex_apis.csv",
],
- visibility: ["//visibility:private"],
}
+framework_minus_apex_cmd = "$(location hoststubgen) " +
+ "@$(location :ravenwood-standard-options) " +
+ "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
+ "--out-jar $(location ravenwood.jar) " +
+ "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
+ "--policy-override-file $(location :ravenwood-framework-policies) " +
+ "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "
+
java_genrule {
name: "framework-minus-apex.ravenwood-base_X0",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
- cmd: "$(location hoststubgen) " +
- "--num-shards 6 --shard-index 0 " + // Only this line differs
-
- "@$(location :ravenwood-standard-options) " +
-
- "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
- "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
- "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
-
- "--out-impl-jar $(location ravenwood.jar) " +
-
- "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
- "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " +
-
- "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
- "--policy-override-file $(location :ravenwood-framework-policies) " +
- "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X1",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
- cmd: "$(location hoststubgen) " +
- "--num-shards 6 --shard-index 1 " + // Only this line differs
-
- "@$(location :ravenwood-standard-options) " +
-
- "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
- "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
- "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
-
- "--out-impl-jar $(location ravenwood.jar) " +
-
- "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
- "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " +
-
- "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
- "--policy-override-file $(location :ravenwood-framework-policies) " +
- "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X2",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
- cmd: "$(location hoststubgen) " +
- "--num-shards 6 --shard-index 2 " + // Only this line differs
-
- "@$(location :ravenwood-standard-options) " +
-
- "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
- "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
- "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
-
- "--out-impl-jar $(location ravenwood.jar) " +
-
- "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
- "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " +
-
- "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
- "--policy-override-file $(location :ravenwood-framework-policies) " +
- "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X3",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
- cmd: "$(location hoststubgen) " +
- "--num-shards 6 --shard-index 3 " + // Only this line differs
-
- "@$(location :ravenwood-standard-options) " +
-
- "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
- "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
- "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
-
- "--out-impl-jar $(location ravenwood.jar) " +
-
- "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
- "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " +
-
- "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
- "--policy-override-file $(location :ravenwood-framework-policies) " +
- "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X4",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
- cmd: "$(location hoststubgen) " +
- "--num-shards 6 --shard-index 4 " + // Only this line differs
-
- "@$(location :ravenwood-standard-options) " +
-
- "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
- "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
- "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
-
- "--out-impl-jar $(location ravenwood.jar) " +
-
- "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
- "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " +
-
- "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
- "--policy-override-file $(location :ravenwood-framework-policies) " +
- "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X5",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
- cmd: "$(location hoststubgen) " +
- "--num-shards 6 --shard-index 5 " + // Only this line differs
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5",
+}
- "@$(location :ravenwood-standard-options) " +
+java_genrule {
+ name: "framework-minus-apex.ravenwood-base_X6",
+ defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6",
+}
- "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
+java_genrule {
+ name: "framework-minus-apex.ravenwood-base_X7",
+ defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7",
+}
+
+java_genrule {
+ name: "framework-minus-apex.ravenwood-base_X8",
+ defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8",
+}
+
+java_genrule {
+ name: "framework-minus-apex.ravenwood-base_X9",
+ defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+ cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9",
+}
+
+// Build framework-minus-apex.ravenwood-base without sharding.
+// We extract the various dump files from this one, rather than the sharded ones, because
+// some dumps use the output from other classes (e.g. base classes) which may not be in the
+// same shard. Also some of the dump files ("apis") may be slow even when sharded, because
+// the output contains the information from all the input classes, rather than the output classes.
+// Not using sharding is fine for this module because it's only used for collecting the
+// dump / stats files, which don't have to happen regularly.
+java_genrule {
+ name: "framework-minus-apex.ravenwood-base_all",
+ defaults: ["framework-minus-apex.ravenwood-base_defaults"],
+ cmd: framework_minus_apex_cmd +
"--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
"--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
- "--out-impl-jar $(location ravenwood.jar) " +
-
"--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
- "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " +
+ "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ",
- "--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
- "--policy-override-file $(location :ravenwood-framework-policies) " +
- "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
+ out: [
+ "hoststubgen_framework-minus-apex_keep_all.txt",
+ "hoststubgen_framework-minus-apex_dump.txt",
+ "hoststubgen_framework-minus-apex_stats.csv",
+ "hoststubgen_framework-minus-apex_apis.csv",
+ ],
}
// Marge all the sharded jars
@@ -198,73 +153,16 @@
":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}",
+ ":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}",
+ ":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}",
+ ":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}",
+ ":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}",
],
out: [
"framework-minus-apex.ravenwood.jar",
],
}
-// Merge the sharded text files
-genrule {
- name: "hoststubgen_framework-minus-apex_stats.csv",
- defaults: ["ravenwood-internal-only-visibility-genrule"],
- cmd: "cat $(in) > $(out)",
- srcs: [
- ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_stats.csv}",
- ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_stats.csv}",
- ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_stats.csv}",
- ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_stats.csv}",
- ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_stats.csv}",
- ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_stats.csv}",
- ],
- out: ["hoststubgen_framework-minus-apex_stats.csv"],
-}
-
-genrule {
- name: "hoststubgen_framework-minus-apex_apis.csv",
- defaults: ["ravenwood-internal-only-visibility-genrule"],
- cmd: "cat $(in) > $(out)",
- srcs: [
- ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_apis.csv}",
- ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_apis.csv}",
- ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_apis.csv}",
- ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_apis.csv}",
- ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_apis.csv}",
- ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_apis.csv}",
- ],
- out: ["hoststubgen_framework-minus-apex_apis.csv"],
-}
-
-genrule {
- name: "hoststubgen_framework-minus-apex_keep_all.txt",
- defaults: ["ravenwood-internal-only-visibility-genrule"],
- cmd: "cat $(in) > $(out)",
- srcs: [
- ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_keep_all.txt}",
- ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_keep_all.txt}",
- ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_keep_all.txt}",
- ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_keep_all.txt}",
- ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_keep_all.txt}",
- ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_keep_all.txt}",
- ],
- out: ["hoststubgen_framework-minus-apex_keep_all.txt"],
-}
-
-genrule {
- name: "hoststubgen_framework-minus-apex_dump.txt",
- defaults: ["ravenwood-internal-only-visibility-genrule"],
- cmd: "cat $(in) > $(out)",
- srcs: [
- ":framework-minus-apex.ravenwood-base_X0{hoststubgen_framework-minus-apex_dump.txt}",
- ":framework-minus-apex.ravenwood-base_X1{hoststubgen_framework-minus-apex_dump.txt}",
- ":framework-minus-apex.ravenwood-base_X2{hoststubgen_framework-minus-apex_dump.txt}",
- ":framework-minus-apex.ravenwood-base_X3{hoststubgen_framework-minus-apex_dump.txt}",
- ":framework-minus-apex.ravenwood-base_X4{hoststubgen_framework-minus-apex_dump.txt}",
- ":framework-minus-apex.ravenwood-base_X5{hoststubgen_framework-minus-apex_dump.txt}",
- ],
- out: ["hoststubgen_framework-minus-apex_dump.txt"],
-}
-
java_library {
name: "services.core-for-hoststubgen",
installable: false, // host only jar.
@@ -285,7 +183,7 @@
"--stats-file $(location hoststubgen_services.core_stats.csv) " +
"--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
- "--out-impl-jar $(location ravenwood.jar) " +
+ "--out-jar $(location ravenwood.jar) " +
"--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " +
"--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " +
@@ -325,6 +223,9 @@
],
}
+// TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming,
+// but services.core.ravenwood has complex dependencies, so it'll take more than
+// just using hoststubgen "rename"s.
java_library {
name: "services.core.ravenwood-jarjar",
defaults: ["ravenwood-internal-only-visibility-java"],
@@ -337,7 +238,6 @@
// Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
// Rename some of the dependencies to make sure they're included in the intended order.
-// Also apply jarjar.
java_library {
name: "100-framework-minus-apex.ravenwood",
defaults: ["ravenwood-internal-only-visibility-java"],
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index db216b1..6a599ea 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -2406,9 +2406,9 @@
* @hide
*/
@android.ravenwood.annotation.RavenwoodKeep
- public final void basicInit(Context context) {
- mInstrContext = context;
- mAppContext = context;
+ public final void basicInit(Context instrContext, Context appContext) {
+ mInstrContext = instrContext;
+ mAppContext = appContext;
}
/** @hide */
diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java
index ba356bb..ef59e0a 100644
--- a/core/java/android/database/CursorWindow.java
+++ b/core/java/android/database/CursorWindow.java
@@ -16,6 +16,8 @@
package android.database;
+import static java.util.Objects.requireNonNull;
+
import android.annotation.BytesLong;
import android.annotation.IntRange;
import android.compat.annotation.UnsupportedAppUsage;
@@ -24,6 +26,10 @@
import android.database.sqlite.SQLiteException;
import android.os.Parcel;
import android.os.Parcelable;
+import android.ravenwood.annotation.RavenwoodKeepWholeClass;
+import android.ravenwood.annotation.RavenwoodRedirect;
+import android.ravenwood.annotation.RavenwoodRedirectionClass;
+import android.ravenwood.annotation.RavenwoodThrow;
import dalvik.annotation.optimization.FastNative;
import dalvik.system.CloseGuard;
@@ -38,9 +44,8 @@
* consumer for reading.
* </p>
*/
-@android.ravenwood.annotation.RavenwoodKeepWholeClass
-@android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.CursorWindow_host")
+@RavenwoodKeepWholeClass
+@RavenwoodRedirectionClass("CursorWindow_host")
public class CursorWindow extends SQLiteClosable implements Parcelable {
private static final String STATS_TAG = "CursorWindowStats";
@@ -61,48 +66,69 @@
private final CloseGuard mCloseGuard;
// May throw CursorWindowAllocationException
+ @RavenwoodRedirect
private static native long nativeCreate(String name, int cursorWindowSize);
// May throw CursorWindowAllocationException
+ @RavenwoodRedirect
private static native long nativeCreateFromParcel(Parcel parcel);
+ @RavenwoodRedirect
private static native void nativeDispose(long windowPtr);
+ @RavenwoodRedirect
private static native void nativeWriteToParcel(long windowPtr, Parcel parcel);
+ @RavenwoodRedirect
private static native String nativeGetName(long windowPtr);
+ @RavenwoodRedirect
private static native byte[] nativeGetBlob(long windowPtr, int row, int column);
+ @RavenwoodRedirect
private static native String nativeGetString(long windowPtr, int row, int column);
+ @RavenwoodThrow
private static native void nativeCopyStringToBuffer(long windowPtr, int row, int column,
CharArrayBuffer buffer);
+ @RavenwoodRedirect
private static native boolean nativePutBlob(long windowPtr, byte[] value, int row, int column);
+ @RavenwoodRedirect
private static native boolean nativePutString(long windowPtr, String value,
int row, int column);
// Below native methods don't do unconstrained work, so are FastNative for performance
@FastNative
+ @RavenwoodThrow
private static native void nativeClear(long windowPtr);
@FastNative
+ @RavenwoodRedirect
private static native int nativeGetNumRows(long windowPtr);
@FastNative
+ @RavenwoodRedirect
private static native boolean nativeSetNumColumns(long windowPtr, int columnNum);
@FastNative
+ @RavenwoodRedirect
private static native boolean nativeAllocRow(long windowPtr);
@FastNative
+ @RavenwoodThrow
private static native void nativeFreeLastRow(long windowPtr);
@FastNative
+ @RavenwoodRedirect
private static native int nativeGetType(long windowPtr, int row, int column);
@FastNative
+ @RavenwoodRedirect
private static native long nativeGetLong(long windowPtr, int row, int column);
@FastNative
+ @RavenwoodRedirect
private static native double nativeGetDouble(long windowPtr, int row, int column);
@FastNative
+ @RavenwoodRedirect
private static native boolean nativePutLong(long windowPtr, long value, int row, int column);
@FastNative
+ @RavenwoodRedirect
private static native boolean nativePutDouble(long windowPtr, double value, int row, int column);
@FastNative
+ @RavenwoodThrow
private static native boolean nativePutNull(long windowPtr, int row, int column);
@@ -640,6 +666,7 @@
*/
public boolean putBlob(byte[] value,
@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
+ requireNonNull(value);
acquireReference();
try {
return nativePutBlob(mWindowPtr, value, row - mStartPos, column);
@@ -658,6 +685,7 @@
*/
public boolean putString(String value,
@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
+ requireNonNull(value);
acquireReference();
try {
return nativePutString(mWindowPtr, value, row - mStartPos, column);
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index b7556df..97e9f34 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -21,6 +21,8 @@
import android.annotation.SystemApi;
import android.app.AppOpsManager;
import android.compat.annotation.UnsupportedAppUsage;
+import android.ravenwood.annotation.RavenwoodClassLoadHook;
+import android.ravenwood.annotation.RavenwoodKeepWholeClass;
import android.util.ExceptionUtils;
import android.util.Log;
import android.util.Slog;
@@ -30,11 +32,9 @@
import com.android.internal.os.BinderCallHeavyHitterWatcher.BinderCallHeavyHitterListener;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.BinderInternal.CallSession;
-import com.android.internal.os.SomeArgs;
import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.FunctionalUtils.ThrowingRunnable;
import com.android.internal.util.FunctionalUtils.ThrowingSupplier;
-import com.android.internal.util.Preconditions;
import dalvik.annotation.optimization.CriticalNative;
@@ -48,7 +48,6 @@
import java.io.PrintWriter;
import java.lang.reflect.Modifier;
import java.util.concurrent.atomic.AtomicReferenceArray;
-import java.util.function.Supplier;
/**
* Base class for a remotable object, the core part of a lightweight
@@ -82,6 +81,8 @@
*
* @see IBinder
*/
+@RavenwoodKeepWholeClass
+@RavenwoodClassLoadHook(RavenwoodClassLoadHook.LIBANDROID_LOADING_HOOK)
public class Binder implements IBinder {
/*
* Set this flag to true to detect anonymous, local or member classes
@@ -292,33 +293,6 @@
sWarnOnBlockingOnCurrentThread.set(sWarnOnBlocking);
}
- private static volatile ThreadLocal<SomeArgs> sIdentity$ravenwood;
-
- @android.ravenwood.annotation.RavenwoodKeepWholeClass
- private static class IdentitySupplier implements Supplier<SomeArgs> {
- @Override
- public SomeArgs get() {
- final SomeArgs args = SomeArgs.obtain();
- // Match IPCThreadState behavior
- args.arg1 = Boolean.FALSE;
- args.argi1 = android.os.Process.myUid();
- args.argi2 = android.os.Process.myPid();
- return args;
- }
- }
-
- /** @hide */
- @android.ravenwood.annotation.RavenwoodKeep
- public static void init$ravenwood() {
- sIdentity$ravenwood = ThreadLocal.withInitial(new IdentitySupplier());
- }
-
- /** @hide */
- @android.ravenwood.annotation.RavenwoodKeep
- public static void reset$ravenwood() {
- sIdentity$ravenwood = null;
- }
-
/**
* Raw native pointer to JavaBBinderHolder object. Owned by this Java object. Not null.
*/
@@ -346,14 +320,8 @@
* 0 for a synchronous call.
*/
@CriticalNative
- @android.ravenwood.annotation.RavenwoodReplace
public static final native int getCallingPid();
- /** @hide */
- public static final int getCallingPid$ravenwood() {
- return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().argi2;
- }
-
/**
* Return the Linux UID assigned to the process that sent you the
* current transaction that is being processed. This UID can be used with
@@ -362,14 +330,8 @@
* incoming transaction, then its own UID is returned.
*/
@CriticalNative
- @android.ravenwood.annotation.RavenwoodReplace
public static final native int getCallingUid();
- /** @hide */
- public static final int getCallingUid$ravenwood() {
- return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().argi1;
- }
-
/**
* Returns {@code true} if the current thread is currently executing an
* incoming transaction.
@@ -377,21 +339,13 @@
* @hide
*/
@CriticalNative
- @android.ravenwood.annotation.RavenwoodReplace
public static final native boolean isDirectlyHandlingTransactionNative();
- /** @hide */
- public static final boolean isDirectlyHandlingTransactionNative$ravenwood() {
- // Ravenwood doesn't support IPC
- return false;
- }
-
private static boolean sIsHandlingBinderTransaction = false;
/**
* @hide
*/
- @android.ravenwood.annotation.RavenwoodKeep
public static final boolean isDirectlyHandlingTransaction() {
return sIsHandlingBinderTransaction || isDirectlyHandlingTransactionNative();
}
@@ -400,7 +354,6 @@
* This is Test API which will be used to override output of isDirectlyHandlingTransactionNative
* @hide
*/
- @android.ravenwood.annotation.RavenwoodKeep
public static void setIsDirectlyHandlingTransactionOverride(boolean isInTransaction) {
sIsHandlingBinderTransaction = isInTransaction;
}
@@ -412,15 +365,8 @@
* @hide
*/
@CriticalNative
- @android.ravenwood.annotation.RavenwoodReplace
private static native boolean hasExplicitIdentity();
- /** @hide */
- private static boolean hasExplicitIdentity$ravenwood() {
- return Preconditions.requireNonNullViaRavenwoodRule(sIdentity$ravenwood).get().arg1
- == Boolean.TRUE;
- }
-
/**
* Return the Linux UID assigned to the process that sent the transaction
* currently being processed.
@@ -429,7 +375,6 @@
* executing an incoming transaction and the calling identity has not been
* explicitly set with {@link #clearCallingIdentity()}
*/
- @android.ravenwood.annotation.RavenwoodKeep
public static final int getCallingUidOrThrow() {
if (!isDirectlyHandlingTransaction() && !hasExplicitIdentity()) {
throw new IllegalStateException(
@@ -491,26 +436,8 @@
* @see #restoreCallingIdentity(long)
*/
@CriticalNative
- @android.ravenwood.annotation.RavenwoodReplace
public static final native long clearCallingIdentity();
- /** @hide */
- public static final long clearCallingIdentity$ravenwood() {
- final SomeArgs args = Preconditions.requireNonNullViaRavenwoodRule(
- sIdentity$ravenwood).get();
- long res = ((long) args.argi1 << 32) | args.argi2;
- if (args.arg1 == Boolean.TRUE) {
- res |= (0x1 << 30);
- } else {
- res &= ~(0x1 << 30);
- }
- // Match IPCThreadState behavior
- args.arg1 = Boolean.TRUE;
- args.argi1 = android.os.Process.myUid();
- args.argi2 = android.os.Process.myPid();
- return res;
- }
-
/**
* Restore the identity of the incoming IPC on the current thread
* back to a previously identity that was returned by {@link
@@ -522,18 +449,8 @@
* @see #clearCallingIdentity
*/
@CriticalNative
- @android.ravenwood.annotation.RavenwoodReplace
public static final native void restoreCallingIdentity(long token);
- /** @hide */
- public static final void restoreCallingIdentity$ravenwood(long token) {
- final SomeArgs args = Preconditions.requireNonNullViaRavenwoodRule(
- sIdentity$ravenwood).get();
- args.arg1 = ((token & (0x1 << 30)) != 0) ? Boolean.TRUE : Boolean.FALSE;
- args.argi1 = (int) (token >> 32);
- args.argi2 = (int) (token & ~(0x1 << 30));
- }
-
/**
* Convenience method for running the provided action enclosed in
* {@link #clearCallingIdentity}/{@link #restoreCallingIdentity}.
@@ -729,14 +646,8 @@
* in order to prevent the process from holding on to objects longer than
* it needs to.
*/
- @android.ravenwood.annotation.RavenwoodReplace
public static final native void flushPendingCommands();
- /** @hide */
- public static final void flushPendingCommands$ravenwood() {
- // Ravenwood doesn't support IPC; ignored
- }
-
/**
* Add the calling thread to the IPC thread pool. This function does
* not return until the current process is exiting.
@@ -794,7 +705,6 @@
* <p>If you're creating a Binder token (a Binder object without an attached interface),
* you should use {@link #Binder(String)} instead.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public Binder() {
this(null);
}
@@ -811,12 +721,9 @@
* Instead of creating multiple tokens with the same descriptor, consider adding a suffix to
* help identify them.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public Binder(@Nullable String descriptor) {
mObject = getNativeBBinderHolder();
- if (mObject != 0L) {
- NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject);
- }
+ NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject);
if (FIND_POTENTIAL_LEAKS) {
final Class<? extends Binder> klass = getClass();
@@ -835,7 +742,6 @@
* will be implemented for you to return the given owner IInterface when
* the corresponding descriptor is requested.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public void attachInterface(@Nullable IInterface owner, @Nullable String descriptor) {
mOwner = owner;
mDescriptor = descriptor;
@@ -844,7 +750,6 @@
/**
* Default implementation returns an empty interface name.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public @Nullable String getInterfaceDescriptor() {
return mDescriptor;
}
@@ -853,7 +758,6 @@
* Default implementation always returns true -- if you got here,
* the object is alive.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public boolean pingBinder() {
return true;
}
@@ -864,7 +768,6 @@
* Note that if you're calling on a local binder, this always returns true
* because your process is alive if you're calling it.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public boolean isBinderAlive() {
return true;
}
@@ -874,7 +777,6 @@
* to return the associated {@link IInterface} if it matches the requested
* descriptor.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public @Nullable IInterface queryLocalInterface(@NonNull String descriptor) {
if (mDescriptor != null && mDescriptor.equals(descriptor)) {
return mOwner;
@@ -1073,7 +975,6 @@
*
* @hide
*/
- @android.ravenwood.annotation.RavenwoodKeep
public @Nullable String getTransactionName(int transactionCode) {
return null;
}
@@ -1082,7 +983,6 @@
* @hide
*/
@VisibleForTesting
- @android.ravenwood.annotation.RavenwoodKeep
public final @Nullable String getTransactionTraceName(int transactionCode) {
final boolean isInterfaceUserDefined = getMaxTransactionId() == 0;
if (mTransactionTraceNames == null) {
@@ -1120,7 +1020,6 @@
return transactionTraceName;
}
- @android.ravenwood.annotation.RavenwoodKeep
private @NonNull String getSimpleDescriptor() {
String descriptor = mDescriptor;
if (descriptor == null) {
@@ -1140,7 +1039,6 @@
* @return The highest user-defined transaction id of all transactions.
* @hide
*/
- @android.ravenwood.annotation.RavenwoodKeep
public int getMaxTransactionId() {
return 0;
}
@@ -1352,14 +1250,12 @@
/**
* Local implementation is a no-op.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public void linkToDeath(@NonNull DeathRecipient recipient, int flags) {
}
/**
* Local implementation is a no-op.
*/
- @android.ravenwood.annotation.RavenwoodKeep
public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) {
return true;
}
@@ -1387,13 +1283,8 @@
}
}
- @android.ravenwood.annotation.RavenwoodReplace
private static native long getNativeBBinderHolder();
- private static long getNativeBBinderHolder$ravenwood() {
- return 0L;
- }
-
/**
* By default, we use the calling UID since we can always trust it.
*/
diff --git a/core/java/android/os/MessageQueue.java b/core/java/android/os/MessageQueue.java
index 5b711c9..53da4a9 100644
--- a/core/java/android/os/MessageQueue.java
+++ b/core/java/android/os/MessageQueue.java
@@ -20,6 +20,7 @@
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
+import android.ravenwood.annotation.RavenwoodRedirect;
import android.util.Log;
import android.util.Printer;
import android.util.SparseArray;
@@ -39,8 +40,7 @@
* {@link Looper#myQueue() Looper.myQueue()}.
*/
@android.ravenwood.annotation.RavenwoodKeepWholeClass
-@android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.MessageQueue_host")
+@android.ravenwood.annotation.RavenwoodRedirectionClass("MessageQueue_host")
public final class MessageQueue {
private static final String TAG = "MessageQueue";
private static final boolean DEBUG = false;
@@ -74,12 +74,18 @@
@UnsupportedAppUsage
private int mNextBarrierToken;
+ @RavenwoodRedirect
private native static long nativeInit();
+ @RavenwoodRedirect
private native static void nativeDestroy(long ptr);
@UnsupportedAppUsage
+ @RavenwoodRedirect
private native void nativePollOnce(long ptr, int timeoutMillis); /*non-static for callbacks*/
+ @RavenwoodRedirect
private native static void nativeWake(long ptr);
+ @RavenwoodRedirect
private native static boolean nativeIsPolling(long ptr);
+ @RavenwoodRedirect
private native static void nativeSetFileDescriptorEvents(long ptr, int fd, int events);
MessageQueue(boolean quitAllowed) {
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 47096db..f728552 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -27,8 +27,8 @@
import android.annotation.TestApi;
import android.app.AppOpsManager;
import android.compat.annotation.UnsupportedAppUsage;
+import android.ravenwood.annotation.RavenwoodClassLoadHook;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;
-import android.ravenwood.annotation.RavenwoodNativeSubstitutionClass;
import android.ravenwood.annotation.RavenwoodReplace;
import android.ravenwood.annotation.RavenwoodThrow;
import android.text.TextUtils;
@@ -233,8 +233,7 @@
* {@link #readSparseArray(ClassLoader, Class)}.
*/
@RavenwoodKeepWholeClass
-@RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.Parcel_host")
+@RavenwoodClassLoadHook(RavenwoodClassLoadHook.LIBANDROID_LOADING_HOOK)
public final class Parcel {
private static final boolean DEBUG_RECYCLE = false;
@@ -389,10 +388,8 @@
@CriticalNative
private static native void nativeMarkSensitive(long nativePtr);
@FastNative
- @RavenwoodThrow
private static native void nativeMarkForBinder(long nativePtr, IBinder binder);
@CriticalNative
- @RavenwoodThrow
private static native boolean nativeIsForRpc(long nativePtr);
@CriticalNative
private static native int nativeDataSize(long nativePtr);
@@ -424,14 +421,12 @@
private static native int nativeWriteFloat(long nativePtr, float val);
@CriticalNative
private static native int nativeWriteDouble(long nativePtr, double val);
- @RavenwoodThrow
private static native void nativeSignalExceptionForError(int error);
@FastNative
private static native void nativeWriteString8(long nativePtr, String val);
@FastNative
private static native void nativeWriteString16(long nativePtr, String val);
@FastNative
- @RavenwoodThrow
private static native void nativeWriteStrongBinder(long nativePtr, IBinder val);
@FastNative
private static native void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val);
@@ -452,7 +447,6 @@
@FastNative
private static native String nativeReadString16(long nativePtr);
@FastNative
- @RavenwoodThrow
private static native IBinder nativeReadStrongBinder(long nativePtr);
@FastNative
private static native FileDescriptor nativeReadFileDescriptor(long nativePtr);
@@ -477,17 +471,13 @@
private static native boolean nativeHasBinders(long nativePtr);
private static native boolean nativeHasBindersInRange(
long nativePtr, int offset, int length);
- @RavenwoodThrow
private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName);
- @RavenwoodThrow
private static native void nativeEnforceInterface(long nativePtr, String interfaceName);
@CriticalNative
- @RavenwoodThrow
private static native boolean nativeReplaceCallingWorkSourceUid(
long nativePtr, int workSourceUid);
@CriticalNative
- @RavenwoodThrow
private static native int nativeReadCallingWorkSourceUid(long nativePtr);
/** Last time exception with a stack trace was written */
@@ -496,7 +486,6 @@
private static final int WRITE_EXCEPTION_STACK_TRACE_THRESHOLD_MS = 1000;
@CriticalNative
- @RavenwoodThrow
private static native long nativeGetOpenAshmemSize(long nativePtr);
public final static Parcelable.Creator<String> STRING_CREATOR
@@ -660,12 +649,10 @@
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- @RavenwoodThrow
public static native long getGlobalAllocSize();
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- @RavenwoodThrow
public static native long getGlobalAllocCount();
/**
@@ -1257,6 +1244,7 @@
* @hide
*/
@UnsupportedAppUsage
+ @RavenwoodThrow(blockedBy = android.text.Spanned.class)
public final void writeCharSequence(@Nullable CharSequence val) {
TextUtils.writeToParcel(val, this, 0);
}
@@ -2996,7 +2984,7 @@
* @see #writeNoException
* @see #readException
*/
- @RavenwoodReplace
+ @RavenwoodReplace(blockedBy = AppOpsManager.class)
public final void writeException(@NonNull Exception e) {
AppOpsManager.prefixParcelWithAppOpsIfNeeded(this);
@@ -3035,10 +3023,15 @@
}
}
- /** @hide */
- public final void writeException$ravenwood(@NonNull Exception e) {
- // Ravenwood doesn't support IPC, no transaction headers needed
- writeInt(getExceptionCode(e));
+ private void writeException$ravenwood(@NonNull Exception e) {
+ int code = getExceptionCode(e);
+ writeInt(code);
+ if (code == 0) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ }
+ throw new RuntimeException(e);
+ }
writeString(e.getMessage());
writeInt(0);
}
@@ -3096,7 +3089,7 @@
* @see #writeException
* @see #readException
*/
- @RavenwoodReplace
+ @RavenwoodReplace(blockedBy = AppOpsManager.class)
public final void writeNoException() {
AppOpsManager.prefixParcelWithAppOpsIfNeeded(this);
@@ -3127,9 +3120,7 @@
}
}
- /** @hide */
- public final void writeNoException$ravenwood() {
- // Ravenwood doesn't support IPC, no transaction headers needed
+ private void writeNoException$ravenwood() {
writeInt(0);
}
diff --git a/core/java/android/os/ParcelFileDescriptor.java b/core/java/android/os/ParcelFileDescriptor.java
index 4cc057a..e80efd2 100644
--- a/core/java/android/os/ParcelFileDescriptor.java
+++ b/core/java/android/os/ParcelFileDescriptor.java
@@ -41,7 +41,6 @@
import android.net.Uri;
import android.os.MessageQueue.OnFileDescriptorEventListener;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;
-import android.ravenwood.annotation.RavenwoodNativeSubstitutionClass;
import android.ravenwood.annotation.RavenwoodReplace;
import android.ravenwood.annotation.RavenwoodThrow;
import android.system.ErrnoException;
@@ -77,8 +76,6 @@
* you to close it when done with it.
*/
@RavenwoodKeepWholeClass
-@RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.ParcelFileDescriptor_host")
public class ParcelFileDescriptor implements Parcelable, Closeable {
private static final String TAG = "ParcelFileDescriptor";
@@ -206,11 +203,11 @@
}
mWrapped = null;
mFd = fd;
- setFdOwner(mFd);
+ IoUtils.setFdOwner(mFd, this);
mCommFd = commChannel;
if (mCommFd != null) {
- setFdOwner(mCommFd);
+ IoUtils.setFdOwner(mCommFd, this);
}
mGuard.open("close");
@@ -298,7 +295,7 @@
public static @NonNull ParcelFileDescriptor wrap(@NonNull ParcelFileDescriptor pfd,
@NonNull Handler handler, @NonNull OnCloseListener listener) throws IOException {
final FileDescriptor original = new FileDescriptor();
- setFdInt(original, pfd.detachFd());
+ original.setInt$(pfd.detachFd());
return fromFd(original, handler, listener);
}
@@ -363,18 +360,10 @@
}
}
- @RavenwoodReplace
private static void closeInternal(FileDescriptor fd) {
IoUtils.closeQuietly(fd);
}
- private static void closeInternal$ravenwood(FileDescriptor fd) {
- try {
- Os.close(fd);
- } catch (ErrnoException ignored) {
- }
- }
-
/**
* Create a new ParcelFileDescriptor that is a dup of an existing
* FileDescriptor. This obeys standard POSIX semantics, where the
@@ -385,7 +374,7 @@
try {
final FileDescriptor fd = new FileDescriptor();
int intfd = Os.fcntlInt(orig, (isAtLeastQ() ? F_DUPFD_CLOEXEC : F_DUPFD), 0);
- setFdInt(fd, intfd);
+ fd.setInt$(intfd);
return new ParcelFileDescriptor(fd);
} catch (ErrnoException e) {
throw e.rethrowAsIOException();
@@ -418,12 +407,12 @@
*/
public static ParcelFileDescriptor fromFd(int fd) throws IOException {
final FileDescriptor original = new FileDescriptor();
- setFdInt(original, fd);
+ original.setInt$(fd);
try {
final FileDescriptor dup = new FileDescriptor();
int intfd = Os.fcntlInt(original, (isAtLeastQ() ? F_DUPFD_CLOEXEC : F_DUPFD), 0);
- setFdInt(dup, intfd);
+ dup.setInt$(intfd);
return new ParcelFileDescriptor(dup);
} catch (ErrnoException e) {
throw e.rethrowAsIOException();
@@ -446,7 +435,7 @@
*/
public static ParcelFileDescriptor adoptFd(int fd) {
final FileDescriptor fdesc = new FileDescriptor();
- setFdInt(fdesc, fd);
+ fdesc.setInt$(fd);
return new ParcelFileDescriptor(fdesc);
}
@@ -703,7 +692,7 @@
@RavenwoodThrow(reason = "Os.readlink() and Os.stat()")
public static File getFile(FileDescriptor fd) throws IOException {
try {
- final String path = Os.readlink("/proc/self/fd/" + getFdInt(fd));
+ final String path = Os.readlink("/proc/self/fd/" + fd.getInt$());
if (OsConstants.S_ISREG(Os.stat(path).st_mode)
|| OsConstants.S_ISCHR(Os.stat(path).st_mode)) {
return new File(path);
@@ -783,7 +772,7 @@
if (mClosed) {
throw new IllegalStateException("Already closed");
}
- return getFdInt(mFd);
+ return mFd.getInt$();
}
}
@@ -805,7 +794,7 @@
if (mClosed) {
throw new IllegalStateException("Already closed");
}
- int fd = acquireRawFd(mFd);
+ int fd = IoUtils.acquireRawFd(mFd);
writeCommStatusAndClose(Status.DETACHED, null);
mClosed = true;
mGuard.close();
@@ -1265,38 +1254,6 @@
}
}
- private static native void setFdInt$ravenwood(FileDescriptor fd, int fdInt);
- private static native int getFdInt$ravenwood(FileDescriptor fd);
-
- @RavenwoodReplace
- private static void setFdInt(FileDescriptor fd, int fdInt) {
- fd.setInt$(fdInt);
- }
-
- @RavenwoodReplace
- private static int getFdInt(FileDescriptor fd) {
- return fd.getInt$();
- }
-
- @RavenwoodReplace
- private void setFdOwner(FileDescriptor fd) {
- IoUtils.setFdOwner(fd, this);
- }
-
- private void setFdOwner$ravenwood(FileDescriptor fd) {
- // FD owners currently unsupported under Ravenwood; ignored
- }
-
- @RavenwoodReplace
- private int acquireRawFd(FileDescriptor fd) {
- return IoUtils.acquireRawFd(fd);
- }
-
- private int acquireRawFd$ravenwood(FileDescriptor fd) {
- // FD owners currently unsupported under Ravenwood; return FD directly
- return getFdInt(fd);
- }
-
@RavenwoodReplace
private static boolean isAtLeastQ() {
return (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q);
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 5f790a9..df6ece4 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -845,16 +845,11 @@
/**
* Returns true if the current process is a 64-bit runtime.
*/
- @android.ravenwood.annotation.RavenwoodReplace
+ @android.ravenwood.annotation.RavenwoodKeep
public static final boolean is64Bit() {
return VMRuntime.getRuntime().is64Bit();
}
- /** @hide */
- public static final boolean is64Bit$ravenwood() {
- return "amd64".equals(System.getProperty("os.arch"));
- }
-
private static volatile ThreadLocal<SomeArgs> sIdentity$ravenwood;
/** @hide */
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 292e6bd..33bfb99 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -2607,10 +2607,15 @@
* (Java) thread-local policy value.
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
+ @android.ravenwood.annotation.RavenwoodReplace
private static void onBinderStrictModePolicyChange(@ThreadPolicyMask int newPolicy) {
setBlockGuardPolicy(newPolicy);
}
+ private static void onBinderStrictModePolicyChange$ravenwood(@ThreadPolicyMask int newPolicy) {
+ /* no-op */
+ }
+
/**
* A tracked, critical time span. (e.g. during an animation.)
*
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index 0a38691..e53873b 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -21,11 +21,13 @@
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.ravenwood.annotation.RavenwoodKeepWholeClass;
-import android.ravenwood.annotation.RavenwoodNativeSubstitutionClass;
+import android.ravenwood.annotation.RavenwoodRedirect;
+import android.ravenwood.annotation.RavenwoodRedirectionClass;
import android.util.Log;
import android.util.MutableInt;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.ravenwood.RavenwoodEnvironment;
import dalvik.annotation.optimization.CriticalNative;
import dalvik.annotation.optimization.FastNative;
@@ -56,8 +58,7 @@
*/
@SystemApi
@RavenwoodKeepWholeClass
-@RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.SystemProperties_host")
+@RavenwoodRedirectionClass("SystemProperties_host")
public class SystemProperties {
private static final String TAG = "SystemProperties";
private static final boolean TRACK_KEY_ACCESS = false;
@@ -75,7 +76,7 @@
@UnsupportedAppUsage
@GuardedBy("sChangeCallbacks")
- private static final ArrayList<Runnable> sChangeCallbacks = new ArrayList<Runnable>();
+ static final ArrayList<Runnable> sChangeCallbacks = new ArrayList<Runnable>();
@GuardedBy("sRoReads")
private static final HashMap<String, MutableInt> sRoReads =
@@ -102,30 +103,18 @@
}
/** @hide */
+ @RavenwoodRedirect
public static void init$ravenwood(Map<String, String> values,
Predicate<String> keyReadablePredicate, Predicate<String> keyWritablePredicate) {
- native_init$ravenwood(values, keyReadablePredicate, keyWritablePredicate,
- SystemProperties::callChangeCallbacks);
- synchronized (sChangeCallbacks) {
- sChangeCallbacks.clear();
- }
+ throw RavenwoodEnvironment.notSupportedOnDevice();
}
/** @hide */
+ @RavenwoodRedirect
public static void reset$ravenwood() {
- native_reset$ravenwood();
- synchronized (sChangeCallbacks) {
- sChangeCallbacks.clear();
- }
+ throw RavenwoodEnvironment.notSupportedOnDevice();
}
- // These native methods are currently only implemented by Ravenwood, as it's the only
- // mechanism we have to jump to our RavenwoodNativeSubstitutionClass
- private static native void native_init$ravenwood(Map<String, String> values,
- Predicate<String> keyReadablePredicate, Predicate<String> keyWritablePredicate,
- Runnable changeCallback);
- private static native void native_reset$ravenwood();
-
// The one-argument version of native_get used to be a regular native function. Nowadays,
// we use the two-argument form of native_get all the time, but we can't just delete the
// one-argument overload: apps use it via reflection, as the UnsupportedAppUsage annotation
@@ -137,34 +126,46 @@
@FastNative
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ @RavenwoodRedirect
private static native String native_get(String key, String def);
@FastNative
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ @RavenwoodRedirect
private static native int native_get_int(String key, int def);
@FastNative
@UnsupportedAppUsage
+ @RavenwoodRedirect
private static native long native_get_long(String key, long def);
@FastNative
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ @RavenwoodRedirect
private static native boolean native_get_boolean(String key, boolean def);
@FastNative
+ @RavenwoodRedirect
private static native long native_find(String name);
@FastNative
+ @RavenwoodRedirect
private static native String native_get(long handle);
@CriticalNative
+ @RavenwoodRedirect
private static native int native_get_int(long handle, int def);
@CriticalNative
+ @RavenwoodRedirect
private static native long native_get_long(long handle, long def);
@CriticalNative
+ @RavenwoodRedirect
private static native boolean native_get_boolean(long handle, boolean def);
// _NOT_ FastNative: native_set performs IPC and can block
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ @RavenwoodRedirect
private static native void native_set(String key, String def);
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ @RavenwoodRedirect
private static native void native_add_change_callback();
+ @RavenwoodRedirect
private static native void native_report_sysprop_change();
/**
@@ -300,7 +301,7 @@
}
@SuppressWarnings("unused") // Called from native code.
- private static void callChangeCallbacks() {
+ static void callChangeCallbacks() {
ArrayList<Runnable> callbacks = null;
synchronized (sChangeCallbacks) {
//Log.i("foo", "Calling " + sChangeCallbacks.size() + " change callbacks!");
diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java
index 0a73fd1..00545da 100644
--- a/core/java/android/util/EventLog.java
+++ b/core/java/android/util/EventLog.java
@@ -21,6 +21,10 @@
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
+import android.ravenwood.annotation.RavenwoodKeepWholeClass;
+import android.ravenwood.annotation.RavenwoodRedirect;
+import android.ravenwood.annotation.RavenwoodRedirectionClass;
+import android.ravenwood.annotation.RavenwoodThrow;
import java.io.BufferedReader;
import java.io.FileReader;
@@ -48,9 +52,8 @@
* They carry a payload of one or more int, long, or String values. The
* event-log-tags file defines the payload contents for each type code.
*/
-@android.ravenwood.annotation.RavenwoodKeepWholeClass
-@android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.EventLog_host")
+@RavenwoodKeepWholeClass
+@RavenwoodRedirectionClass("EventLog_host")
public class EventLog {
/** @hide */ public EventLog() {}
@@ -339,6 +342,7 @@
* @param value A value to log
* @return The number of bytes written
*/
+ @RavenwoodRedirect
public static native int writeEvent(int tag, int value);
/**
@@ -347,6 +351,7 @@
* @param value A value to log
* @return The number of bytes written
*/
+ @RavenwoodRedirect
public static native int writeEvent(int tag, long value);
/**
@@ -355,6 +360,7 @@
* @param value A value to log
* @return The number of bytes written
*/
+ @RavenwoodRedirect
public static native int writeEvent(int tag, float value);
/**
@@ -363,6 +369,7 @@
* @param str A value to log
* @return The number of bytes written
*/
+ @RavenwoodRedirect
public static native int writeEvent(int tag, String str);
/**
@@ -371,6 +378,7 @@
* @param list A list of values to log
* @return The number of bytes written
*/
+ @RavenwoodRedirect
public static native int writeEvent(int tag, Object... list);
/**
@@ -379,6 +387,7 @@
* @param output container to add events into
* @throws IOException if something goes wrong reading events
*/
+ @RavenwoodThrow
public static native void readEvents(int[] tags, Collection<Event> output)
throws IOException;
@@ -391,6 +400,7 @@
* @hide
*/
@SystemApi
+ @RavenwoodThrow
public static native void readEventsOnWrapping(int[] tags, long timestamp,
Collection<Event> output)
throws IOException;
diff --git a/core/java/android/util/LruCache.java b/core/java/android/util/LruCache.java
index be1ec41..9845f9e 100644
--- a/core/java/android/util/LruCache.java
+++ b/core/java/android/util/LruCache.java
@@ -18,7 +18,6 @@
import android.compat.annotation.UnsupportedAppUsage;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -226,16 +225,10 @@
}
}
- @android.ravenwood.annotation.RavenwoodReplace
private Map.Entry<K, V> eldest() {
return map.eldest();
}
- private Map.Entry<K, V> eldest$ravenwood() {
- final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
- return it.hasNext() ? it.next() : null;
- }
-
/**
* Removes the entry for {@code key} if it exists.
*
diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java
index 9ecb4cb..b2017a5 100644
--- a/core/java/android/util/Slog.java
+++ b/core/java/android/util/Slog.java
@@ -224,7 +224,6 @@
/**
* Similar to {@link #wtf(String, String)}, but does not output anything to the log.
*/
- @android.ravenwood.annotation.RavenwoodThrow
public static void wtfQuiet(@Nullable String tag, @NonNull String msg) {
Log.wtfQuiet(Log.LOG_ID_SYSTEM, tag, msg, true);
}
@@ -243,7 +242,6 @@
* @see Log#wtfStack(String, String)
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
- @android.ravenwood.annotation.RavenwoodThrow
public static int wtfStack(@Nullable String tag, @NonNull String msg) {
return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true);
}
diff --git a/core/java/com/android/internal/os/LongArrayMultiStateCounter.java b/core/java/com/android/internal/os/LongArrayMultiStateCounter.java
index 07fa679..dfb2884 100644
--- a/core/java/com/android/internal/os/LongArrayMultiStateCounter.java
+++ b/core/java/com/android/internal/os/LongArrayMultiStateCounter.java
@@ -18,6 +18,10 @@
import android.os.Parcel;
import android.os.Parcelable;
+import android.ravenwood.annotation.RavenwoodKeepWholeClass;
+import android.ravenwood.annotation.RavenwoodRedirect;
+import android.ravenwood.annotation.RavenwoodRedirectionClass;
+import android.ravenwood.annotation.RavenwoodReplace;
import com.android.internal.util.Preconditions;
@@ -55,18 +59,15 @@
*
* @hide
*/
-@android.ravenwood.annotation.RavenwoodKeepWholeClass
-@android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.LongArrayMultiStateCounter_host")
+@RavenwoodKeepWholeClass
+@RavenwoodRedirectionClass("LongArrayMultiStateCounter_host")
public final class LongArrayMultiStateCounter implements Parcelable {
/**
* Container for a native equivalent of a long[].
*/
- @android.ravenwood.annotation.RavenwoodKeepWholeClass
- @android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution"
- + ".LongArrayMultiStateCounter_host$LongArrayContainer_host")
+ @RavenwoodKeepWholeClass
+ @RavenwoodRedirectionClass("LongArrayContainer_host")
public static class LongArrayContainer {
private static NativeAllocationRegistry sRegistry;
@@ -81,7 +82,7 @@
registerNativeAllocation();
}
- @android.ravenwood.annotation.RavenwoodReplace
+ @RavenwoodReplace
private void registerNativeAllocation() {
if (sRegistry == null) {
synchronized (LongArrayMultiStateCounter.class) {
@@ -140,18 +141,23 @@
}
@CriticalNative
+ @RavenwoodRedirect
private static native long native_init(int length);
@CriticalNative
+ @RavenwoodRedirect
private static native long native_getReleaseFunc();
@FastNative
+ @RavenwoodRedirect
private static native void native_setValues(long nativeObject, long[] array);
@FastNative
+ @RavenwoodRedirect
private static native void native_getValues(long nativeObject, long[] array);
@FastNative
+ @RavenwoodRedirect
private static native boolean native_combineValues(long nativeObject, long[] array,
int[] indexMap);
}
@@ -175,7 +181,7 @@
registerNativeAllocation();
}
- @android.ravenwood.annotation.RavenwoodReplace
+ @RavenwoodReplace
private void registerNativeAllocation() {
if (sRegistry == null) {
synchronized (LongArrayMultiStateCounter.class) {
@@ -374,57 +380,73 @@
@CriticalNative
+ @RavenwoodRedirect
private static native long native_init(int stateCount, int arrayLength);
@CriticalNative
+ @RavenwoodRedirect
private static native long native_getReleaseFunc();
@CriticalNative
+ @RavenwoodRedirect
private static native void native_setEnabled(long nativeObject, boolean enabled,
long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_setState(long nativeObject, int state, long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_copyStatesFrom(long nativeObjectTarget,
long nativeObjectSource);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_setValues(long nativeObject, int state,
long longArrayContainerNativeObject);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_updateValues(long nativeObject,
long longArrayContainerNativeObject, long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_incrementValues(long nativeObject,
long longArrayContainerNativeObject, long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_addCounts(long nativeObject,
long longArrayContainerNativeObject);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_reset(long nativeObject);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_getCounts(long nativeObject,
long longArrayContainerNativeObject, int state);
@FastNative
+ @RavenwoodRedirect
private static native String native_toString(long nativeObject);
@FastNative
+ @RavenwoodRedirect
private static native void native_writeToParcel(long nativeObject, Parcel dest, int flags);
@FastNative
+ @RavenwoodRedirect
private static native long native_initFromParcel(Parcel parcel);
@CriticalNative
+ @RavenwoodRedirect
private static native int native_getStateCount(long nativeObject);
@CriticalNative
+ @RavenwoodRedirect
private static native int native_getArrayLength(long nativeObject);
}
diff --git a/core/java/com/android/internal/os/LongMultiStateCounter.java b/core/java/com/android/internal/os/LongMultiStateCounter.java
index e5662c7..c386a86 100644
--- a/core/java/com/android/internal/os/LongMultiStateCounter.java
+++ b/core/java/com/android/internal/os/LongMultiStateCounter.java
@@ -18,6 +18,10 @@
import android.os.Parcel;
import android.os.Parcelable;
+import android.ravenwood.annotation.RavenwoodKeepWholeClass;
+import android.ravenwood.annotation.RavenwoodRedirect;
+import android.ravenwood.annotation.RavenwoodRedirectionClass;
+import android.ravenwood.annotation.RavenwoodReplace;
import com.android.internal.util.Preconditions;
@@ -55,9 +59,8 @@
*
* @hide
*/
-@android.ravenwood.annotation.RavenwoodKeepWholeClass
-@android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.LongMultiStateCounter_host")
+@RavenwoodKeepWholeClass
+@RavenwoodRedirectionClass("LongMultiStateCounter_host")
public final class LongMultiStateCounter implements Parcelable {
private static NativeAllocationRegistry sRegistry;
@@ -82,7 +85,7 @@
mStateCount = native_getStateCount(mNativeObject);
}
- @android.ravenwood.annotation.RavenwoodReplace
+ @RavenwoodReplace
private void registerNativeAllocation() {
if (sRegistry == null) {
synchronized (LongMultiStateCounter.class) {
@@ -210,43 +213,56 @@
@CriticalNative
+ @RavenwoodRedirect
private static native long native_init(int stateCount);
@CriticalNative
+ @RavenwoodRedirect
private static native long native_getReleaseFunc();
@CriticalNative
+ @RavenwoodRedirect
private static native void native_setEnabled(long nativeObject, boolean enabled,
long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_setState(long nativeObject, int state, long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native long native_updateValue(long nativeObject, long value, long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_incrementValue(long nativeObject, long increment,
long timestampMs);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_addCount(long nativeObject, long count);
@CriticalNative
+ @RavenwoodRedirect
private static native void native_reset(long nativeObject);
@CriticalNative
+ @RavenwoodRedirect
private static native long native_getCount(long nativeObject, int state);
@FastNative
+ @RavenwoodRedirect
private static native String native_toString(long nativeObject);
@FastNative
+ @RavenwoodRedirect
private static native void native_writeToParcel(long nativeObject, Parcel dest, int flags);
@FastNative
+ @RavenwoodRedirect
private static native long native_initFromParcel(Parcel parcel);
@CriticalNative
+ @RavenwoodRedirect
private static native int native_getStateCount(long nativeObject);
}
diff --git a/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java b/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java
index 8fe1813..30b160a 100644
--- a/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java
+++ b/core/java/com/android/internal/ravenwood/RavenwoodEnvironment.java
@@ -15,24 +15,33 @@
*/
package com.android.internal.ravenwood;
-import android.ravenwood.annotation.RavenwoodNativeSubstitutionClass;
+import android.ravenwood.annotation.RavenwoodKeepWholeClass;
+import android.ravenwood.annotation.RavenwoodRedirect;
+import android.ravenwood.annotation.RavenwoodRedirectionClass;
+import android.ravenwood.annotation.RavenwoodReplace;
/**
* Class to interact with the Ravenwood environment.
*/
-@android.ravenwood.annotation.RavenwoodKeepWholeClass
-@RavenwoodNativeSubstitutionClass(
- "com.android.platform.test.ravenwood.nativesubstitution.RavenwoodEnvironment_host")
+@RavenwoodKeepWholeClass
+@RavenwoodRedirectionClass("RavenwoodEnvironment_host")
public final class RavenwoodEnvironment {
public static final String TAG = "RavenwoodEnvironment";
- private static RavenwoodEnvironment sInstance = new RavenwoodEnvironment();
- private static Workaround sWorkaround = new Workaround();
+ private static final RavenwoodEnvironment sInstance;
+ private static final Workaround sWorkaround;
private RavenwoodEnvironment() {
- if (isRunningOnRavenwood()) {
- ensureRavenwoodInitializedInternal();
- }
+ }
+
+ static {
+ sInstance = new RavenwoodEnvironment();
+ sWorkaround = new Workaround();
+ ensureRavenwoodInitialized();
+ }
+
+ public static RuntimeException notSupportedOnDevice() {
+ return new UnsupportedOperationException("This method can only be used on Ravenwood");
}
/**
@@ -47,16 +56,10 @@
*
* No-op if called on the device side.
*/
+ @RavenwoodRedirect
public static void ensureRavenwoodInitialized() {
}
- private static void ensureRavenwoodInitialized$ravenwood() {
- getInstance(); // This is enough to initialize the environment.
- }
-
- /** Initialize the ravenwood environment */
- private static native void ensureRavenwoodInitializedInternal();
-
/**
* USE IT SPARINGLY! Returns true if it's running on Ravenwood, hostside test environment.
*
@@ -69,7 +72,7 @@
* <p>If someone needs it without having access to the SDK, the following hack would work too.
* <code>System.getProperty("java.class.path").contains("ravenwood")</code>
*/
- @android.ravenwood.annotation.RavenwoodReplace
+ @RavenwoodReplace
public boolean isRunningOnRavenwood() {
return false;
}
@@ -79,13 +82,32 @@
}
/**
- * See {@link Workaround}. It's only usablke on Ravenwood.
+ * Get the object back from the address obtained from
+ * {@link dalvik.system.VMRuntime#addressOf(Object)}.
*/
+ @RavenwoodRedirect
+ public <T> T fromAddress(long address) {
+ throw notSupportedOnDevice();
+ }
+
+ /**
+ * See {@link Workaround}. It's only usable on Ravenwood.
+ */
+ @RavenwoodReplace
public static Workaround workaround() {
- if (getInstance().isRunningOnRavenwood()) {
- return sWorkaround;
- }
- throw new IllegalStateException("Workaround can only be used on Ravenwood");
+ throw notSupportedOnDevice();
+ }
+
+ private static Workaround workaround$ravenwood() {
+ return sWorkaround;
+ }
+
+ /**
+ * @return the "ravenwood-runtime" directory.
+ */
+ @RavenwoodRedirect
+ public String getRavenwoodRuntimePath() {
+ throw notSupportedOnDevice();
}
/**
diff --git a/core/java/com/android/internal/util/ArrayUtils.java b/core/java/com/android/internal/util/ArrayUtils.java
index 8f00f79..11123a9 100644
--- a/core/java/com/android/internal/util/ArrayUtils.java
+++ b/core/java/com/android/internal/util/ArrayUtils.java
@@ -49,81 +49,41 @@
private ArrayUtils() { /* cannot be instantiated */ }
- @android.ravenwood.annotation.RavenwoodReplace
public static byte[] newUnpaddedByteArray(int minLen) {
return (byte[])VMRuntime.getRuntime().newUnpaddedArray(byte.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
public static char[] newUnpaddedCharArray(int minLen) {
return (char[])VMRuntime.getRuntime().newUnpaddedArray(char.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static int[] newUnpaddedIntArray(int minLen) {
return (int[])VMRuntime.getRuntime().newUnpaddedArray(int.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
public static boolean[] newUnpaddedBooleanArray(int minLen) {
return (boolean[])VMRuntime.getRuntime().newUnpaddedArray(boolean.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
public static long[] newUnpaddedLongArray(int minLen) {
return (long[])VMRuntime.getRuntime().newUnpaddedArray(long.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
public static float[] newUnpaddedFloatArray(int minLen) {
return (float[])VMRuntime.getRuntime().newUnpaddedArray(float.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
public static Object[] newUnpaddedObjectArray(int minLen) {
return (Object[])VMRuntime.getRuntime().newUnpaddedArray(Object.class, minLen);
}
- @android.ravenwood.annotation.RavenwoodReplace
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@SuppressWarnings("unchecked")
public static <T> T[] newUnpaddedArray(Class<T> clazz, int minLen) {
return (T[])VMRuntime.getRuntime().newUnpaddedArray(clazz, minLen);
}
- public static byte[] newUnpaddedByteArray$ravenwood(int minLen) {
- return new byte[minLen];
- }
-
- public static char[] newUnpaddedCharArray$ravenwood(int minLen) {
- return new char[minLen];
- }
-
- public static int[] newUnpaddedIntArray$ravenwood(int minLen) {
- return new int[minLen];
- }
-
- public static boolean[] newUnpaddedBooleanArray$ravenwood(int minLen) {
- return new boolean[minLen];
- }
-
- public static long[] newUnpaddedLongArray$ravenwood(int minLen) {
- return new long[minLen];
- }
-
- public static float[] newUnpaddedFloatArray$ravenwood(int minLen) {
- return new float[minLen];
- }
-
- public static Object[] newUnpaddedObjectArray$ravenwood(int minLen) {
- return new Object[minLen];
- }
-
- public static <T> T[] newUnpaddedArray$ravenwood(Class<T> clazz, int minLen) {
- return (T[]) Array.newInstance(clazz, minLen);
- }
-
/**
* Checks if the beginnings of two byte arrays are equal.
*
@@ -622,6 +582,7 @@
/**
* Adds value to given array if not already present, providing set-like
* behavior.
+ * Adds value to given array. The method allows duplicate values.
*/
public static boolean[] appendBoolean(@Nullable boolean[] cur, boolean val) {
if (cur == null) {
diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp
index 584ebaa..dec724b 100644
--- a/core/jni/android_os_Parcel.cpp
+++ b/core/jni/android_os_Parcel.cpp
@@ -90,7 +90,7 @@
env->CallVoidMethod(parcelObj, gParcelOffsets.recycle);
}
-static void android_os_Parcel_markSensitive(jlong nativePtr)
+static void android_os_Parcel_markSensitive(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel) {
@@ -116,30 +116,30 @@
}
}
-static jboolean android_os_Parcel_isForRpc(jlong nativePtr) {
+static jboolean android_os_Parcel_isForRpc(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) {
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return parcel ? parcel->isForRpc() : false;
}
-static jint android_os_Parcel_dataSize(jlong nativePtr)
+static jint android_os_Parcel_dataSize(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return parcel ? parcel->dataSize() : 0;
}
-static jint android_os_Parcel_dataAvail(jlong nativePtr)
+static jint android_os_Parcel_dataAvail(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return parcel ? parcel->dataAvail() : 0;
}
-static jint android_os_Parcel_dataPosition(jlong nativePtr)
+static jint android_os_Parcel_dataPosition(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return parcel ? parcel->dataPosition() : 0;
}
-static jint android_os_Parcel_dataCapacity(jlong nativePtr)
+static jint android_os_Parcel_dataCapacity(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return parcel ? parcel->dataCapacity() : 0;
@@ -156,7 +156,7 @@
}
}
-static void android_os_Parcel_setDataPosition(jlong nativePtr, jint pos)
+static void android_os_Parcel_setDataPosition(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jint pos)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -175,7 +175,8 @@
}
}
-static jboolean android_os_Parcel_pushAllowFds(jlong nativePtr, jboolean allowFds)
+static jboolean android_os_Parcel_pushAllowFds(CRITICAL_JNI_PARAMS_COMMA
+ jlong nativePtr, jboolean allowFds)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
jboolean ret = JNI_TRUE;
@@ -185,7 +186,8 @@
return ret;
}
-static void android_os_Parcel_restoreAllowFds(jlong nativePtr, jboolean lastValue)
+static void android_os_Parcel_restoreAllowFds(CRITICAL_JNI_PARAMS_COMMA
+ jlong nativePtr, jboolean lastValue)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -259,22 +261,22 @@
blob.release();
}
-static int android_os_Parcel_writeInt(jlong nativePtr, jint val) {
+static int android_os_Parcel_writeInt(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jint val) {
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return (parcel != NULL) ? parcel->writeInt32(val) : OK;
}
-static int android_os_Parcel_writeLong(jlong nativePtr, jlong val) {
+static int android_os_Parcel_writeLong(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jlong val) {
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return (parcel != NULL) ? parcel->writeInt64(val) : OK;
}
-static int android_os_Parcel_writeFloat(jlong nativePtr, jfloat val) {
+static int android_os_Parcel_writeFloat(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jfloat val) {
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return (parcel != NULL) ? parcel->writeFloat(val) : OK;
}
-static int android_os_Parcel_writeDouble(jlong nativePtr, jdouble val) {
+static int android_os_Parcel_writeDouble(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr, jdouble val) {
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
return (parcel != NULL) ? parcel->writeDouble(val) : OK;
}
@@ -446,7 +448,7 @@
return ret;
}
-static jint android_os_Parcel_readInt(jlong nativePtr)
+static jint android_os_Parcel_readInt(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -455,7 +457,7 @@
return 0;
}
-static jlong android_os_Parcel_readLong(jlong nativePtr)
+static jlong android_os_Parcel_readLong(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -464,7 +466,7 @@
return 0;
}
-static jfloat android_os_Parcel_readFloat(jlong nativePtr)
+static jfloat android_os_Parcel_readFloat(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -473,7 +475,7 @@
return 0;
}
-static jdouble android_os_Parcel_readDouble(jlong nativePtr)
+static jdouble android_os_Parcel_readDouble(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -690,7 +692,7 @@
return JNI_FALSE;
}
-static jboolean android_os_Parcel_hasFileDescriptors(jlong nativePtr)
+static jboolean android_os_Parcel_hasFileDescriptors(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
jboolean ret = JNI_FALSE;
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
@@ -807,7 +809,7 @@
return Parcel::getGlobalAllocCount();
}
-static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr)
+static jlong android_os_Parcel_getOpenAshmemSize(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -816,7 +818,7 @@
return 0;
}
-static jint android_os_Parcel_readCallingWorkSourceUid(jlong nativePtr)
+static jint android_os_Parcel_readCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
@@ -825,7 +827,8 @@
return IPCThreadState::kUnsetWorkSource;
}
-static jboolean android_os_Parcel_replaceCallingWorkSourceUid(jlong nativePtr, jint uid)
+static jboolean android_os_Parcel_replaceCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA
+ jlong nativePtr, jint uid)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index ef50a95..8003bb7 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -1152,60 +1152,60 @@
// ----------------------------------------------------------------------------
-static jint android_os_Binder_getCallingPid()
+static jint android_os_Binder_getCallingPid(CRITICAL_JNI_PARAMS)
{
return IPCThreadState::self()->getCallingPid();
}
-static jint android_os_Binder_getCallingUid()
+static jint android_os_Binder_getCallingUid(CRITICAL_JNI_PARAMS)
{
return IPCThreadState::self()->getCallingUid();
}
-static jboolean android_os_Binder_isDirectlyHandlingTransactionNative() {
+static jboolean android_os_Binder_isDirectlyHandlingTransactionNative(CRITICAL_JNI_PARAMS) {
return getCurrentServingCall() == BinderCallType::BINDER;
}
-static jlong android_os_Binder_clearCallingIdentity()
+static jlong android_os_Binder_clearCallingIdentity(CRITICAL_JNI_PARAMS)
{
return IPCThreadState::self()->clearCallingIdentity();
}
-static void android_os_Binder_restoreCallingIdentity(jlong token)
+static void android_os_Binder_restoreCallingIdentity(CRITICAL_JNI_PARAMS_COMMA jlong token)
{
IPCThreadState::self()->restoreCallingIdentity(token);
}
-static jboolean android_os_Binder_hasExplicitIdentity() {
+static jboolean android_os_Binder_hasExplicitIdentity(CRITICAL_JNI_PARAMS) {
return IPCThreadState::self()->hasExplicitIdentity();
}
-static void android_os_Binder_setThreadStrictModePolicy(jint policyMask)
+static void android_os_Binder_setThreadStrictModePolicy(CRITICAL_JNI_PARAMS_COMMA jint policyMask)
{
IPCThreadState::self()->setStrictModePolicy(policyMask);
}
-static jint android_os_Binder_getThreadStrictModePolicy()
+static jint android_os_Binder_getThreadStrictModePolicy(CRITICAL_JNI_PARAMS)
{
return IPCThreadState::self()->getStrictModePolicy();
}
-static jlong android_os_Binder_setCallingWorkSourceUid(jint workSource)
+static jlong android_os_Binder_setCallingWorkSourceUid(CRITICAL_JNI_PARAMS_COMMA jint workSource)
{
return IPCThreadState::self()->setCallingWorkSourceUid(workSource);
}
-static jlong android_os_Binder_getCallingWorkSourceUid()
+static jlong android_os_Binder_getCallingWorkSourceUid(CRITICAL_JNI_PARAMS)
{
return IPCThreadState::self()->getCallingWorkSourceUid();
}
-static jlong android_os_Binder_clearCallingWorkSource()
+static jlong android_os_Binder_clearCallingWorkSource(CRITICAL_JNI_PARAMS)
{
return IPCThreadState::self()->clearCallingWorkSource();
}
-static void android_os_Binder_restoreCallingWorkSource(jlong token)
+static void android_os_Binder_restoreCallingWorkSource(CRITICAL_JNI_PARAMS_COMMA jlong token)
{
IPCThreadState::self()->restoreCallingWorkSource(token);
}
diff --git a/core/tests/coretests/src/android/os/BinderTest.java b/core/tests/coretests/src/android/os/BinderTest.java
index 9767d67..90ec93e 100644
--- a/core/tests/coretests/src/android/os/BinderTest.java
+++ b/core/tests/coretests/src/android/os/BinderTest.java
@@ -24,18 +24,16 @@
import static org.mockito.ArgumentMatchers.anyInt;
import static org.testng.Assert.assertThrows;
-import android.platform.test.annotations.IgnoreUnderRavenwood;
+import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
import androidx.test.filters.SmallTest;
import com.android.internal.os.BinderInternal;
-
import org.junit.Rule;
import org.junit.Test;
-@IgnoreUnderRavenwood(blockedBy = WorkSource.class)
public class BinderTest {
private static final int UID = 100;
@@ -89,6 +87,7 @@
@SmallTest
@Test(expected = java.lang.SecurityException.class)
+ @DisabledOnRavenwood(blockedBy = ServiceManagerNative.class)
public void testServiceManagerNativeSecurityException() throws RemoteException {
// Find the service manager
IServiceManager sServiceManager = ServiceManagerNative
@@ -101,6 +100,7 @@
@SmallTest
@Test(expected = java.lang.NullPointerException.class)
+ @DisabledOnRavenwood(blockedBy = ServiceManagerNative.class)
public void testServiceManagerNativeNullptrException() throws RemoteException {
// Find the service manager
IServiceManager sServiceManager = ServiceManagerNative
diff --git a/core/tests/coretests/src/android/os/BundleTest.java b/core/tests/coretests/src/android/os/BundleTest.java
index 40e79ad..5ef8d3c 100644
--- a/core/tests/coretests/src/android/os/BundleTest.java
+++ b/core/tests/coretests/src/android/os/BundleTest.java
@@ -25,7 +25,6 @@
import static org.junit.Assert.assertTrue;
import android.platform.test.annotations.DisabledOnRavenwood;
-import android.platform.test.annotations.IgnoreUnderRavenwood;
import android.platform.test.annotations.Presubmit;
import android.platform.test.ravenwood.RavenwoodRule;
import android.util.Log;
@@ -131,7 +130,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = ParcelFileDescriptor.class)
public void testCreateFromParcel() throws Exception {
boolean withFd;
Parcel p;
@@ -312,7 +310,7 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
+ @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP")
public void kindofEquals_lazyValuesAndDifferentClassLoaders_returnsFalse() {
Parcelable p1 = new CustomParcelable(13, "Tiramisu");
Parcelable p2 = new CustomParcelable(13, "Tiramisu");
@@ -368,7 +366,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void readWriteLengthMismatch_logsWtf() throws Exception {
mWtfHandler = Log.setWtfHandler((tag, e, system) -> {
throw new RuntimeException(e);
@@ -383,7 +380,7 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
+ @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP")
public void getParcelable_whenThrowingAndNotDefusing_throws() throws Exception {
Bundle.setShouldDefuse(false);
Bundle bundle = new Bundle();
@@ -396,7 +393,7 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
+ @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP")
public void getParcelable_whenThrowingAndDefusing_returnsNull() throws Exception {
Bundle.setShouldDefuse(true);
Bundle bundle = new Bundle();
@@ -412,7 +409,7 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
+ @DisabledOnRavenwood(reason = "Ravenwood tests run on the BCP")
public void getParcelable_whenThrowingAndDefusing_leavesElement() throws Exception {
Bundle.setShouldDefuse(true);
Bundle bundle = new Bundle();
@@ -447,7 +444,6 @@
}
@Test
- @DisabledOnRavenwood(blockedBy = Parcel.class)
public void parcelledBundleWithBinder_shouldReturnHasBindersTrue() throws Exception {
Bundle bundle = new Bundle();
bundle.putParcelable("test", new CustomParcelable(13, "Tiramisu"));
@@ -470,7 +466,6 @@
}
@Test
- @DisabledOnRavenwood(blockedBy = Parcel.class)
public void parcelledBundleWithoutBinder_shouldReturnHasBindersFalse() throws Exception {
Bundle bundle = new Bundle();
bundle.putParcelable("test", new CustomParcelable(13, "Tiramisu"));
diff --git a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java
index ffeab29..e9a27cd 100644
--- a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java
+++ b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java
@@ -20,7 +20,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.platform.test.annotations.IgnoreUnderRavenwood;
+import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
import android.util.ArrayMap;
@@ -67,7 +67,7 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
+ @DisabledOnRavenwood(blockedBy = android.text.Spanned.class)
public void nullCharSequence() {
Parcel p = Parcel.obtain();
p.writeCharSequence(null);
@@ -76,7 +76,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void nullStrongBinder() {
Parcel p = Parcel.obtain();
p.writeStrongBinder(null);
@@ -85,7 +84,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void nullStringInterface() {
Parcel p = Parcel.obtain();
p.writeStrongInterface(null);
diff --git a/core/tests/coretests/src/android/os/ParcelTest.java b/core/tests/coretests/src/android/os/ParcelTest.java
index 0697c96..8c098c2 100644
--- a/core/tests/coretests/src/android/os/ParcelTest.java
+++ b/core/tests/coretests/src/android/os/ParcelTest.java
@@ -23,7 +23,6 @@
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
-import android.platform.test.annotations.IgnoreUnderRavenwood;
import android.platform.test.annotations.Presubmit;
import android.platform.test.ravenwood.RavenwoodRule;
import android.util.Log;
@@ -48,7 +47,6 @@
private static final String INTERFACE_TOKEN_2 = "Another IBinder interface token";
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testIsForRpc() {
Parcel p = Parcel.obtain();
assertEquals(false, p.isForRpc());
@@ -56,7 +54,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testCallingWorkSourceUidAfterWrite() {
Parcel p = Parcel.obtain();
// Method does not throw if replaceCallingWorkSourceUid is called before requests headers
@@ -77,7 +74,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testCallingWorkSourceUidAfterEnforce() {
Parcel p = Parcel.obtain();
p.writeInterfaceToken(INTERFACE_TOKEN_1);
@@ -95,7 +91,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testParcelWithMultipleHeaders() {
Parcel p = Parcel.obtain();
Binder.setCallingWorkSourceUid(WORK_SOURCE_1);
@@ -153,7 +148,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testCompareDataInRange_whenSameDataWithBinder() {
Binder binder = new Binder();
Parcel pA = Parcel.obtain();
@@ -313,7 +307,6 @@
* and 1M length for complex objects are allowed.
*/
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testAllocations_whenWithinLimit() {
Binder.setIsDirectlyHandlingTransactionOverride(true);
Parcel p = Parcel.obtain();
@@ -398,7 +391,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testHasBinders_AfterWritingBinderToParcel() {
Binder binder = new Binder();
Parcel pA = Parcel.obtain();
@@ -410,7 +402,6 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = Parcel.class)
public void testHasBindersInRange_AfterWritingBinderToParcel() {
Binder binder = new Binder();
Parcel pA = Parcel.obtain();
diff --git a/ravenwood/.gitignore b/ravenwood/.gitignore
new file mode 100644
index 0000000..751553b
--- /dev/null
+++ b/ravenwood/.gitignore
@@ -0,0 +1 @@
+*.bak
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index ac62687..10e4f38 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -5,6 +5,10 @@
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
+
+ // OWNER: g/ravenwood
+ // Bug component: 25698
+ default_team: "trendy_team_framework_backstage_power",
}
filegroup {
@@ -94,6 +98,9 @@
libs: [
"ravenwood-runtime-common-ravenwood",
],
+ static_libs: [
+ "framework-annotations-lib", // should it be "libs" instead?
+ ],
visibility: ["//visibility:private"],
}
@@ -126,8 +133,9 @@
],
libs: [
"framework-minus-apex.ravenwood",
- "ravenwood-junit",
+ "ravenwood-helper-libcore-runtime",
],
+ sdk_version: "core_current",
visibility: ["//visibility:private"],
}
@@ -160,11 +168,22 @@
"ravenwood-framework",
"services.core.ravenwood",
"junit",
+ "framework-annotations-lib",
+ "ravenwood-helper-framework-runtime",
+ "ravenwood-helper-libcore-runtime",
],
visibility: ["//frameworks/base"],
jarjar_rules: ":ravenwood-services-jarjar-rules",
}
+java_device_for_host {
+ name: "ravenwood-junit-impl-for-ravenizer",
+ libs: [
+ "ravenwood-junit-impl",
+ ],
+ visibility: [":__subpackages__"],
+}
+
// Separated out from ravenwood-junit-impl since it needs to compile
// against `module_current`
java_library {
@@ -202,6 +221,7 @@
libs: [
"junit",
"flag-junit",
+ "framework-annotations-lib",
],
visibility: ["//visibility:public"],
}
@@ -279,10 +299,10 @@
src: "scripts/ravenwood-stats-checker.sh",
test_suites: ["general-tests"],
data: [
- ":hoststubgen_framework-minus-apex_stats.csv",
- ":hoststubgen_framework-minus-apex_apis.csv",
- ":hoststubgen_framework-minus-apex_keep_all.txt",
- ":hoststubgen_framework-minus-apex_dump.txt",
+ ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_stats.csv}",
+ ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_apis.csv}",
+ ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_keep_all.txt}",
+ ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_dump.txt}",
":services.core.ravenwood-base{hoststubgen_services.core_stats.csv}",
":services.core.ravenwood-base{hoststubgen_services.core_apis.csv}",
":services.core.ravenwood-base{hoststubgen_services.core_keep_all.txt}",
diff --git a/ravenwood/TEST_MAPPING b/ravenwood/TEST_MAPPING
index 5754837..86246e2 100644
--- a/ravenwood/TEST_MAPPING
+++ b/ravenwood/TEST_MAPPING
@@ -1,20 +1,15 @@
-// Keep the following two TEST_MAPPINGs in sync:
-// frameworks/base/ravenwood/TEST_MAPPING
-// frameworks/base/tools/hoststubgen/TEST_MAPPING
{
"presubmit": [
{ "name": "tiny-framework-dump-test" },
{ "name": "hoststubgentest" },
+ { "name": "hoststubgen-test-tiny-test" },
{ "name": "hoststubgen-invoke-test" },
- {
- "name": "RavenwoodMockitoTest_device"
- },
- {
- "name": "RavenwoodBivalentTest_device"
- },
- {
- "name": "RavenwoodResApkTest"
- },
+ { "name": "RavenwoodMockitoTest_device" },
+ { "name": "RavenwoodBivalentTest_device" },
+
+ { "name": "RavenwoodBivalentInstTest_nonself_inst" },
+ { "name": "RavenwoodBivalentInstTest_self_inst_device" },
+
// The sysui tests should match vendor/unbundled_google/packages/SystemUIGoogle/TEST_MAPPING
{
"name": "SystemUIGoogleTests"
@@ -26,6 +21,128 @@
}
],
"ravenwood-presubmit": [
+ // AUTO-GENERATED-START
+ // DO NOT MODIFY MANUALLY
+ // Use scripts/update-test-mapping.sh to update it.
+ {
+ "name": "AdServicesSharedLibrariesUnitTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "android.test.mock.ravenwood.tests",
+ "host": true
+ },
+ {
+ "name": "CarLibHostUnitTest",
+ "host": true,
+ "keywords": ["automotive_code_coverage"]
+ },
+ {
+ "name": "CarServiceHostUnitTest",
+ "host": true,
+ "keywords": ["automotive_code_coverage"]
+ },
+ {
+ "name": "CarSystemUIRavenTests",
+ "host": true,
+ "keywords": ["automotive_code_coverage"]
+ },
+ {
+ "name": "CtsAccountManagerTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsAppTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsContentTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsDatabaseTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsGraphicsTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsIcuTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsInputMethodTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsOsTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsProtoTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsResourcesTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsTextTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "CtsUtilTestCasesRavenwood",
+ "host": true
+ },
+ {
+ "name": "FrameworksCoreSystemPropertiesTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "FrameworksCoreTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "FrameworksInputMethodSystemServerTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "FrameworksMockingServicesTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "FrameworksServicesTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "FrameworksUtilTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "InternalTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "PowerStatsTestsRavenwood",
+ "host": true
+ },
+ {
+ "name": "RavenwoodBivalentInstTest_nonself_inst",
+ "host": true
+ },
+ {
+ "name": "RavenwoodBivalentInstTest_self_inst",
+ "host": true
+ },
+ {
+ "name": "RavenwoodBivalentTest",
+ "host": true
+ },
+ {
+ "name": "RavenwoodCoreTest",
+ "host": true
+ },
{
"name": "RavenwoodMinimumTest",
"host": true
@@ -35,15 +152,22 @@
"host": true
},
{
- "name": "CtsUtilTestCasesRavenwood",
+ "name": "RavenwoodResApkTest",
"host": true
},
{
- "name": "RavenwoodCoreTest",
+ "name": "RavenwoodRuntimeTest",
"host": true
},
{
- "name": "RavenwoodBivalentTest",
+ "name": "RavenwoodServicesTest",
+ "host": true
+ }
+ // AUTO-GENERATED-END
+ ],
+ "ravenwood-postsubmit": [
+ {
+ "name": "SystemUiRavenTests",
"host": true
}
]
diff --git a/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java b/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodRedirect.java
similarity index 82%
copy from ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java
copy to ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodRedirect.java
index 4b9cf85..b582ccf 100644
--- a/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java
+++ b/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodRedirect.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023 The Android Open Source Project
+ * Copyright (C) 2024 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.
@@ -15,7 +15,7 @@
*/
package android.ravenwood.annotation;
-import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -29,8 +29,7 @@
*
* @hide
*/
-@Target({TYPE})
+@Target({METHOD})
@Retention(RetentionPolicy.CLASS)
-public @interface RavenwoodNativeSubstitutionClass {
- String value();
+public @interface RavenwoodRedirect {
}
diff --git a/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java b/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodRedirectionClass.java
similarity index 94%
rename from ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java
rename to ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodRedirectionClass.java
index 4b9cf85..bee9222 100644
--- a/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java
+++ b/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodRedirectionClass.java
@@ -31,6 +31,6 @@
*/
@Target({TYPE})
@Retention(RetentionPolicy.CLASS)
-public @interface RavenwoodNativeSubstitutionClass {
+public @interface RavenwoodRedirectionClass {
String value();
}
diff --git a/ravenwood/bivalenttest/Android.bp b/ravenwood/bivalenttest/Android.bp
index 06cf08e6..e897735 100644
--- a/ravenwood/bivalenttest/Android.bp
+++ b/ravenwood/bivalenttest/Android.bp
@@ -39,6 +39,9 @@
"androidx.test.ext.junit",
"androidx.test.rules",
+ "junit-params",
+ "platform-parametric-runner-lib",
+
// To make sure it won't cause VerifyError (b/324063814)
"platformprotosnano",
],
@@ -65,6 +68,9 @@
"androidx.test.ext.junit",
"androidx.test.rules",
+ "junit-params",
+ "platform-parametric-runner-lib",
+
"ravenwood-junit",
],
jni_libs: [
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleDeviceOnlyTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleDeviceOnlyTest.java
index 3a24c0e..e8f59db 100644
--- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleDeviceOnlyTest.java
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleDeviceOnlyTest.java
@@ -26,6 +26,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+/**
+ * Test to ensure @DisabledOnRavenwood works. Note, now the DisabledOnRavenwood annotation
+ * is handled by the test runner, so it won't really need the class rule.
+ */
@RunWith(AndroidJUnit4.class)
@DisabledOnRavenwood
public class RavenwoodClassRuleDeviceOnlyTest {
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleRavenwoodOnlyTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleRavenwoodOnlyTest.java
deleted file mode 100644
index aa33dc3..0000000
--- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodClassRuleRavenwoodOnlyTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest;
-
-import android.platform.test.ravenwood.RavenwoodClassRule;
-import android.platform.test.ravenwood.RavenwoodRule;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Assert;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-// TODO: atest RavenwoodBivalentTest_device fails with the following message.
-// `RUNNER ERROR: Instrumentation reported numtests=7 but only ran 6`
-// @android.platform.test.annotations.DisabledOnNonRavenwood
-// Figure it out and then make DisabledOnNonRavenwood support TYPEs as well.
-@Ignore
-public class RavenwoodClassRuleRavenwoodOnlyTest {
- @ClassRule
- public static final RavenwoodClassRule sRavenwood = new RavenwoodClassRule();
-
- @Test
- public void testRavenwoodOnly() {
- Assert.assertTrue(RavenwoodRule.isOnRavenwood());
- }
-}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java
new file mode 100644
index 0000000..a5a16c1
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodConfigTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest;
+
+import static android.platform.test.ravenwood.RavenwoodConfig.isOnRavenwood;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import android.platform.test.ravenwood.RavenwoodConfig;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test to make sure the config field is used.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodConfigTest {
+ private static final String PACKAGE_NAME = "com.test";
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig =
+ new RavenwoodConfig.Builder()
+ .setPackageName(PACKAGE_NAME)
+ .build();
+
+ @Test
+ public void testConfig() {
+ assumeTrue(isOnRavenwood());
+ assertEquals(PACKAGE_NAME,
+ InstrumentationRegistry.getInstrumentation().getContext().getPackageName());
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java
new file mode 100644
index 0000000..c25d2b4
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodMultipleRuleTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest;
+
+import android.platform.test.ravenwood.RavenwoodConfig;
+import android.platform.test.ravenwood.RavenwoodRule;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Assume;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+
+/**
+ * Make sure having multiple RavenwoodRule's is detected.
+ * (But only when running on ravenwod. Otherwise it'll be ignored.)
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodMultipleRuleTest {
+
+ @Rule(order = Integer.MIN_VALUE)
+ public final ExpectedException mExpectedException = ExpectedException.none();
+
+ @Rule
+ public final RavenwoodRule mRavenwood1 = new RavenwoodRule();
+
+ @Rule
+ public final RavenwoodRule mRavenwood2 = new RavenwoodRule();
+
+ public RavenwoodMultipleRuleTest() {
+ // We can't call it within the test method because the exception happens before
+ // calling the method, so set it up here.
+ if (RavenwoodConfig.isOnRavenwood()) {
+ mExpectedException.expectMessage("Multiple nesting RavenwoodRule");
+ }
+ }
+
+ @Test
+ public void testMultipleRulesNotAllowed() {
+ Assume.assumeTrue(RavenwoodConfig.isOnRavenwood());
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodNoConfigNoRuleTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodNoConfigNoRuleTest.java
new file mode 100644
index 0000000..d473305
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodNoConfigNoRuleTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest;
+
+import static org.junit.Assert.assertNotNull;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test to make sure the environment is still initialized when no config and no rules are set.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodNoConfigNoRuleTest {
+
+ @Test
+ public void testInitialization() {
+ assertNotNull(InstrumentationRegistry.getInstrumentation());
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodRuleTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodRuleTest.java
index 01e90d8..3de372e 100644
--- a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodRuleTest.java
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/RavenwoodRuleTest.java
@@ -15,7 +15,6 @@
*/
package com.android.ravenwoodtest.bivalenttest;
-import android.platform.test.annotations.DisabledOnNonRavenwood;
import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
import android.util.Log;
@@ -39,12 +38,6 @@
}
@Test
- @DisabledOnNonRavenwood
- public void testRavenwoodOnly() {
- Assert.assertTrue(RavenwoodRule.isOnRavenwood());
- }
-
- @Test
public void testDumpSystemProperties() {
Log.w("XXX", "System properties");
for (var sp : System.getProperties().entrySet()) {
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/CallTracker.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/CallTracker.java
new file mode 100644
index 0000000..09a0aa8
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/CallTracker.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import static org.junit.Assert.fail;
+
+import static java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE;
+
+import android.util.Log;
+
+import java.lang.StackWalker.StackFrame;
+import java.util.HashMap;
+
+/**
+ * Used to keep track of and count the number of calls.
+ */
+public class CallTracker {
+ public static final String TAG = "CallTracker";
+
+ private final HashMap<String, Integer> mNumCalled = new HashMap<>();
+
+ /**
+ * Call it when a method is called. It increments the count for the calling method.
+ */
+ public void incrementMethodCallCount() {
+ var methodName = getCallingMethodName(1);
+
+ Log.i(TAG, "Method called: " + methodName);
+
+ mNumCalled.put(methodName, getNumCalled(methodName) + 1);
+ }
+
+ /**
+ * Return the number of calls of a method.
+ */
+ public int getNumCalled(String methodName) {
+ return mNumCalled.getOrDefault(methodName, 0);
+ }
+
+ /**
+ * Return the current method name. (with the class name.)
+ */
+ private static String getCallingMethodName(int frameOffset) {
+ var walker = StackWalker.getInstance(RETAIN_CLASS_REFERENCE);
+ var caller = walker.walk(frames ->
+ frames.skip(1 + frameOffset).findFirst().map(StackFrame::getMethodName)
+ );
+ return caller.get();
+ }
+
+ /**
+ * Check the number of calls stored in {@link #mNumCalled}.
+ */
+ public void assertCalls(Object... methodNameAndCountPairs) {
+ // Create a local copy
+ HashMap<String, Integer> counts = new HashMap<>(mNumCalled);
+ for (int i = 0; i < methodNameAndCountPairs.length - 1; i += 2) {
+ String methodName = (String) methodNameAndCountPairs[i];
+ int expectedCount = (Integer) methodNameAndCountPairs[i + 1];
+
+ if (getNumCalled(methodName) != expectedCount) {
+ fail(String.format("Method %s: expected call count=%d, actual=%d",
+ methodName, expectedCount, getNumCalled(methodName)));
+ }
+ counts.remove(methodName);
+ }
+ // All other entries are expected to be 0.
+ var sb = new StringBuilder();
+ for (var e : counts.entrySet()) {
+ if (e.getValue() == 0) {
+ continue;
+ }
+ sb.append(String.format("Method %s: expected call count=0, actual=%d",
+ e.getKey(), e.getValue()));
+ }
+ if (sb.length() > 0) {
+ fail(sb.toString());
+ }
+ }
+
+ /**
+ * Same as {@link #assertCalls(Object...)} but it kills the process if it fails.
+ * Only use in @AfterClass.
+ */
+ public void assertCallsOrDie(Object... methodNameAndCountPairs) {
+ try {
+ assertCalls(methodNameAndCountPairs);
+ } catch (Throwable th) {
+ // TODO: I don't think it's by spec, but the exception here would be ignored both on
+ // ravenwood and on the device side. Look into it.
+ Log.e(TAG, "*** Failure detected in @AfterClass! ***", th);
+ Log.e(TAG, "JUnit seems to ignore exceptions from @AfterClass, so killing self.");
+ System.exit(7);
+ }
+ }
+
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodAwareTestRunnerTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodAwareTestRunnerTest.java
new file mode 100644
index 0000000..d7c2c6c
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodAwareTestRunnerTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import static org.junit.Assert.assertFalse;
+
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.RavenwoodTestRunnerInitializing;
+import android.platform.test.ravenwood.RavenwoodRule;
+import android.util.Log;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Make sure RavenwoodAwareTestRunnerTest properly delegates to the original runner,
+ * and also run the special annotated methods.
+ */
+@RunWith(JUnitParamsRunner.class)
+public class RavenwoodAwareTestRunnerTest {
+ public static final String TAG = "RavenwoodAwareTestRunnerTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ private static int getExpectedRavenwoodRunnerInitializingNumCalls() {
+ return RavenwoodRule.isOnRavenwood() ? 1 : 0;
+ }
+
+ @RavenwoodTestRunnerInitializing
+ public static void ravenwoodRunnerInitializing() {
+ // No other calls should have been made.
+ sCallTracker.assertCalls();
+
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+ sCallTracker.assertCalls(
+ "ravenwoodRunnerInitializing",
+ getExpectedRavenwoodRunnerInitializingNumCalls()
+ );
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ public void test1() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ @Parameters({"foo", "bar"})
+ public void testWithParams(String arg) {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ @DisabledOnRavenwood
+ public void testDeviceOnly() {
+ assertFalse(RavenwoodRule.isOnRavenwood());
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "ravenwoodRunnerInitializing",
+ getExpectedRavenwoodRunnerInitializingNumCalls(),
+ "beforeClass", 1,
+ "test1", 1,
+ "testWithParams", 2
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitClassRuleDeviceOnlyTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitClassRuleDeviceOnlyTest.java
new file mode 100644
index 0000000..7ef672e
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitClassRuleDeviceOnlyTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.ravenwood.RavenwoodRule;
+import android.util.Log;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+@DisabledOnRavenwood
+public class RavenwoodImplicitClassRuleDeviceOnlyTest {
+ public static final String TAG = "RavenwoodImplicitClassRuleDeviceOnlyTest";
+
+ @BeforeClass
+ public static void beforeClass() {
+ // This method shouldn't be called -- unless RUN_DISABLED_TESTS is enabled.
+
+ // If we're doing RUN_DISABLED_TESTS, don't throw here, because that'd confuse junit.
+ if (!RavenwoodRule.private$ravenwood().isRunningDisabledTests()) {
+ Assert.assertFalse(RavenwoodRule.isOnRavenwood());
+ }
+ }
+
+ @Test
+ public void testDeviceOnly() {
+ Assert.assertFalse(RavenwoodRule.isOnRavenwood());
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ if (RavenwoodRule.isOnRavenwood()) {
+ Log.e(TAG, "Even @AfterClass shouldn't be executed!");
+
+ if (!RavenwoodRule.private$ravenwood().isRunningDisabledTests()) {
+ System.exit(1);
+ }
+ }
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleOrderRewriteTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleOrderRewriteTest.java
new file mode 100644
index 0000000..7ef40dc
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleOrderRewriteTest.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import android.platform.test.ravenwood.RavenwoodRule;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Assume;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+
+import java.util.HashMap;
+
+/**
+ * Make sure ravenizer will inject implicit rules and rewrite the existing rules' orders.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodImplicitRuleOrderRewriteTest {
+
+ private static final TestRule sEmptyRule = (statement, description) -> statement;
+
+ // We have two sets of 9 rules below, for class rules and instance rules.
+ // - Ravenizer will inject 2 more rules of each kind.
+ // - Ravenizer will adjust their order, so even though we'll add two sets of class and instance
+ // rules with a MIN / MAX order, there will still be no duplicate in the order.
+
+ private static final int EXPECTED_RULE_COUNT = 9 + 2;
+
+ @ClassRule(order = Integer.MIN_VALUE)
+ public static final TestRule sRule01 = sEmptyRule;
+
+ @ClassRule(order = Integer.MIN_VALUE + 1)
+ public static final TestRule sRule02 = sEmptyRule;
+
+ @ClassRule(order = -10)
+ public static final TestRule sRule03 = sEmptyRule;
+
+ @ClassRule(order = -1)
+ public static final TestRule sRule04 = sEmptyRule;
+
+ @ClassRule(order = 0)
+ public static final TestRule sRule05 = sEmptyRule;
+
+ @ClassRule(order = 1)
+ public static final TestRule sRule06 = sEmptyRule;
+
+ @ClassRule(order = 10)
+ public static final TestRule sRule07 = sEmptyRule;
+
+ @ClassRule(order = Integer.MAX_VALUE - 1)
+ public static final TestRule sRule08 = sEmptyRule;
+
+ @ClassRule(order = Integer.MAX_VALUE)
+ public static final TestRule sRule09 = sEmptyRule;
+
+ @Rule(order = Integer.MIN_VALUE)
+ public final TestRule mRule01 = sEmptyRule;
+
+ @Rule(order = Integer.MIN_VALUE + 1)
+ public final TestRule mRule02 = sEmptyRule;
+
+ @Rule(order = -10)
+ public final TestRule mRule03 = sEmptyRule;
+
+ @Rule(order = -1)
+ public final TestRule mRule04 = sEmptyRule;
+
+ @Rule(order = 0)
+ public final TestRule mRule05 = sEmptyRule;
+
+ @Rule(order = 1)
+ public final TestRule mRule06 = sEmptyRule;
+
+ @Rule(order = 10)
+ public final TestRule mRule07 = sEmptyRule;
+
+ @Rule(order = Integer.MAX_VALUE - 1)
+ public final TestRule mRule08 = sEmptyRule;
+
+ @Rule(order = Integer.MAX_VALUE)
+ public final TestRule mRule09 = sEmptyRule;
+
+ private void checkRules(boolean classRule) {
+ final var anotClass = classRule ? ClassRule.class : Rule.class;
+
+ final HashMap<Integer, Integer> ordersUsed = new HashMap<>();
+
+ for (var field : this.getClass().getDeclaredFields()) {
+ if (!field.isAnnotationPresent(anotClass)) {
+ continue;
+ }
+ final var anot = field.getAnnotation(anotClass);
+ final int order = classRule ? ((ClassRule) anot).order() : ((Rule) anot).order();
+
+ if (ordersUsed.containsKey(order)) {
+ fail("Detected duplicate order=" + order);
+ }
+ ordersUsed.put(order, 1);
+ }
+ assertEquals(EXPECTED_RULE_COUNT, ordersUsed.size());
+ }
+
+ @Test
+ public void testClassRules() {
+ Assume.assumeTrue(RavenwoodRule.isOnRavenwood());
+
+ checkRules(true);
+ }
+
+ @Test
+ public void testInstanceRules() {
+ Assume.assumeTrue(RavenwoodRule.isOnRavenwood());
+
+ checkRules(false);
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleShadowingTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleShadowingTest.java
new file mode 100644
index 0000000..ae596b1
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleShadowingTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test to make sure when a test class inherits another test class, the base class's
+ * implicit rules are shadowed and won't be executed.
+ *
+ * ... But for now, we don't have a way to programmatically check it, so for now we need to
+ * check the log file manually.
+ *
+ * TODO: Implement the test.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodImplicitRuleShadowingTest extends RavenwoodImplicitRuleShadowingTestBase {
+ @Test
+ public void testOkInSubClass() {
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleShadowingTestBase.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleShadowingTestBase.java
new file mode 100644
index 0000000..1ca97af
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodImplicitRuleShadowingTestBase.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * A test class that's just inherited by RavenwoodImplicitRuleShadowingTest.
+ */
+@RunWith(AndroidJUnit4.class)
+public abstract class RavenwoodImplicitRuleShadowingTestBase {
+ @Test
+ public void testOkInBaseClass() {
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodNoRavenizerTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodNoRavenizerTest.java
new file mode 100644
index 0000000..9d878f4
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodNoRavenizerTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import android.platform.test.annotations.NoRavenizer;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.RavenwoodTestRunnerInitializing;
+
+import org.junit.Test;
+
+/**
+ * Test for {@link android.platform.test.annotations.NoRavenizer}
+ */
+@NoRavenizer
+public class RavenwoodNoRavenizerTest {
+ public static final String TAG = "RavenwoodNoRavenizerTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ /**
+ * With @NoRavenizer, this method shouldn't be called.
+ */
+ @RavenwoodTestRunnerInitializing
+ public static void ravenwoodRunnerInitializing() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ /**
+ * Make sure ravenwoodRunnerInitializing() wasn't called.
+ */
+ @Test
+ public void testNotRavenized() {
+ sCallTracker.assertCalls(
+ "ravenwoodRunnerInitializing", 0
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunDisabledTestsReallyDisabledTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunDisabledTestsReallyDisabledTest.java
new file mode 100644
index 0000000..c77841b
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunDisabledTestsReallyDisabledTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import static org.junit.Assert.fail;
+
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.RavenwoodTestRunnerInitializing;
+import android.platform.test.ravenwood.RavenwoodRule;
+import android.util.Log;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test for "RAVENWOOD_RUN_DISABLED_TESTS" with "REALLY_DISABLED" set.
+ *
+ * This test is only executed on Ravenwood.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodRunDisabledTestsReallyDisabledTest {
+ private static final String TAG = "RavenwoodRunDisabledTestsTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ @RavenwoodTestRunnerInitializing
+ public static void ravenwoodRunnerInitializing() {
+ RavenwoodRule.private$ravenwood().overrideRunDisabledTest(true,
+ "\\#testReallyDisabled$");
+ }
+
+ /**
+ * This test gets to run with RAVENWOOD_RUN_DISABLED_TESTS set.
+ */
+ @Test
+ @DisabledOnRavenwood
+ public void testDisabledTestGetsToRun() {
+ if (!RavenwoodRule.isOnRavenwood()) {
+ return;
+ }
+ sCallTracker.incrementMethodCallCount();
+
+ fail("This test won't pass on Ravenwood.");
+ }
+
+ /**
+ * This will still not be executed due to the "really disabled" pattern.
+ */
+ @Test
+ @DisabledOnRavenwood
+ public void testReallyDisabled() {
+ if (!RavenwoodRule.isOnRavenwood()) {
+ return;
+ }
+ sCallTracker.incrementMethodCallCount();
+
+ fail("This test won't pass on Ravenwood.");
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ if (!RavenwoodRule.isOnRavenwood()) {
+ return;
+ }
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "testDisabledTestGetsToRun", 1,
+ "testReallyDisabled", 0
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunDisabledTestsTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunDisabledTestsTest.java
new file mode 100644
index 0000000..ea1a29d
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunDisabledTestsTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import static org.junit.Assert.fail;
+
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.RavenwoodTestRunnerInitializing;
+import android.platform.test.ravenwood.RavenwoodRule;
+import android.util.Log;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.AfterClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+
+/**
+ * Test for "RAVENWOOD_RUN_DISABLED_TESTS". (with no "REALLY_DISABLED" set.)
+ *
+ * This test is only executed on Ravenwood.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodRunDisabledTestsTest {
+ private static final String TAG = "RavenwoodRunDisabledTestsTest";
+
+ @Rule
+ public ExpectedException mExpectedException = ExpectedException.none();
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ @RavenwoodTestRunnerInitializing
+ public static void ravenwoodRunnerInitializing() {
+ RavenwoodRule.private$ravenwood().overrideRunDisabledTest(true, null);
+ }
+
+ @Test
+ @DisabledOnRavenwood
+ public void testDisabledTestGetsToRun() {
+ if (!RavenwoodRule.isOnRavenwood()) {
+ return;
+ }
+ sCallTracker.incrementMethodCallCount();
+
+ fail("This test won't pass on Ravenwood.");
+ }
+
+ @Test
+ @DisabledOnRavenwood
+ public void testDisabledButPass() {
+ if (!RavenwoodRule.isOnRavenwood()) {
+ return;
+ }
+ sCallTracker.incrementMethodCallCount();
+
+ // When a @DisabledOnRavenwood actually passed, the runner should make fail().
+ mExpectedException.expectMessage("it actually passed under Ravenwood");
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ if (!RavenwoodRule.isOnRavenwood()) {
+ return;
+ }
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "testDisabledTestGetsToRun", 1,
+ "testDisabledButPass", 1
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithAndroidXRunnerTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithAndroidXRunnerTest.java
new file mode 100644
index 0000000..c042eb0
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithAndroidXRunnerTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import android.util.Log;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Make sure ravenwood's test runner works with {@link AndroidJUnit4}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class RavenwoodRunnerWithAndroidXRunnerTest {
+ public static final String TAG = "RavenwoodRunnerWithAndroidXRunnerTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ @BeforeClass
+ public static void beforeClass() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Before
+ public void beforeTest() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @After
+ public void afterTest() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ public void test1() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ public void test2() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "beforeClass", 1,
+ "beforeTest", 2,
+ "afterTest", 2,
+ "test1", 1,
+ "test2", 1
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithJUnitParamsRunnerTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithJUnitParamsRunnerTest.java
new file mode 100644
index 0000000..2feb5ba
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithJUnitParamsRunnerTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import android.util.Log;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Make sure ravenwood's test runner works with {@link AndroidJUnit4}.
+ */
+@RunWith(JUnitParamsRunner.class)
+public class RavenwoodRunnerWithJUnitParamsRunnerTest {
+ public static final String TAG = "RavenwoodRunnerTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ @BeforeClass
+ public static void beforeClass() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Before
+ public void beforeTest() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @After
+ public void afterTest() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ public void testWithNoParams() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Test
+ @Parameters({"foo", "bar"})
+ public void testWithParams(String arg) {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "beforeClass", 1,
+ "beforeTest", 3,
+ "afterTest", 3,
+ "testWithNoParams", 1,
+ "testWithParams", 2
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithParameterizedAndroidJunit4Test.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithParameterizedAndroidJunit4Test.java
new file mode 100644
index 0000000..7e3bc0f
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodRunnerWithParameterizedAndroidJunit4Test.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import android.util.Log;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
+import platform.test.runner.parameterized.Parameters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Make sure ravenwood's test runner works with {@link ParameterizedAndroidJunit4}.
+ */
+@RunWith(ParameterizedAndroidJunit4.class)
+public class RavenwoodRunnerWithParameterizedAndroidJunit4Test {
+ public static final String TAG = "RavenwoodRunnerTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ private final String mParam;
+
+ private static int sNumInsantiation = 0;
+
+ public RavenwoodRunnerWithParameterizedAndroidJunit4Test(String param) {
+ mParam = param;
+ sNumInsantiation++;
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+ // It seems like ParameterizedAndroidJunit4 calls the @BeforeTest / @AfterTest methods
+ // one time too many.
+ // With two parameters, this method should be called only twice, but it's actually
+ // called three times.
+ // So let's not check the number fo beforeClass calls.
+ }
+
+ @Before
+ public void beforeTest() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @After
+ public void afterTest() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @Parameters
+ public static List<String> getParams() {
+ var params = new ArrayList<String>();
+ params.add("foo");
+ params.add("bar");
+ return params;
+ }
+
+ @Test
+ public void testWithParams() {
+ sCallTracker.incrementMethodCallCount();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "beforeTest", sNumInsantiation,
+ "afterTest", sNumInsantiation,
+ "testWithParams", sNumInsantiation
+ );
+ }
+}
diff --git a/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodSuiteTest.java b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodSuiteTest.java
new file mode 100644
index 0000000..7e396c2
--- /dev/null
+++ b/ravenwood/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodSuiteTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalenttest.ravenizer;
+
+import android.util.Log;
+
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test to make sure {@link Suite} works with the ravenwood test runner.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ RavenwoodSuiteTest.Test1.class,
+ RavenwoodSuiteTest.Test2.class
+})
+public class RavenwoodSuiteTest {
+ public static final String TAG = "RavenwoodSuiteTest";
+
+ private static final CallTracker sCallTracker = new CallTracker();
+
+ @AfterClass
+ public static void afterClass() {
+ Log.i(TAG, "afterClass called");
+
+ sCallTracker.assertCallsOrDie(
+ "test1", 1,
+ "test2", 1
+ );
+ }
+
+ /**
+ * Workaround for the issue where tradefed won't think a class is a test class
+ * if it has a @RunWith but no @Test methods, even if it is a Suite.
+ */
+ @Test
+ public void testEmpty() {
+ }
+
+ public static class Test1 {
+ @Test
+ public void test1() {
+ sCallTracker.incrementMethodCallCount();
+ }
+ }
+
+ public static class Test2 {
+ @Test
+ public void test2() {
+ sCallTracker.incrementMethodCallCount();
+ }
+ }
+}
diff --git a/ravenwood/coretest/README.md b/ravenwood/coretest/README.md
deleted file mode 100644
index b60bfbf..0000000
--- a/ravenwood/coretest/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Ravenwood core test
-
-This test contains (non-bivalent) tests for Ravenwood itself -- e.g. tests for the ravenwood rules.
\ No newline at end of file
diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodTestRunnerValidationTest.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodTestRunnerValidationTest.java
deleted file mode 100644
index f1e33cb..0000000
--- a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodTestRunnerValidationTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.ravenwoodtest.coretest;
-
-import android.platform.test.ravenwood.RavenwoodRule;
-
-import androidx.test.runner.AndroidJUnit4; // Intentionally use the deprecated one.
-
-import org.junit.Assume;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.RuleChain;
-import org.junit.runner.RunWith;
-
-/**
- * Test for the test runner validator in RavenwoodRule.
- */
-@RunWith(AndroidJUnit4.class)
-public class RavenwoodTestRunnerValidationTest {
- // Note the following rules don't have a @Rule, because they need to be applied in a specific
- // order. So we use a RuleChain instead.
- private ExpectedException mThrown = ExpectedException.none();
- private final RavenwoodRule mRavenwood = new RavenwoodRule();
-
- @Rule
- public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood);
-
- public RavenwoodTestRunnerValidationTest() {
- Assume.assumeTrue(RavenwoodRule._$RavenwoodPrivate.isOptionalValidationEnabled());
- // Because RavenwoodRule will throw this error before executing the test method,
- // we can't do it in the test method itself.
- // So instead, we initialize it here.
- mThrown.expectMessage("Switch to androidx.test.ext.junit.runners.AndroidJUnit4");
- }
-
- @Test
- public void testValidateTestRunner() {
- }
-}
diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail01_Test.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail01_Test.java
deleted file mode 100644
index db95fad..0000000
--- a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail01_Test.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.ravenwoodtest.coretest.methodvalidation;
-
-import android.platform.test.ravenwood.RavenwoodRule;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.RuleChain;
-import org.junit.runner.RunWith;
-
-/**
- * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations.
- * This class contains tests for this validator.
- */
-@RunWith(AndroidJUnit4.class)
-public class RavenwoodTestMethodValidation_Fail01_Test {
- private ExpectedException mThrown = ExpectedException.none();
- private final RavenwoodRule mRavenwood = new RavenwoodRule();
-
- @Rule
- public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood);
-
- public RavenwoodTestMethodValidation_Fail01_Test() {
- mThrown.expectMessage("Method setUp() doesn't have @Before");
- }
-
- @SuppressWarnings("JUnit4SetUpNotRun")
- public void setUp() {
- }
-
- @Test
- public void testEmpty() {
- }
-}
diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail02_Test.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail02_Test.java
deleted file mode 100644
index ddc66c7..0000000
--- a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail02_Test.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.ravenwoodtest.coretest.methodvalidation;
-
-import android.platform.test.ravenwood.RavenwoodRule;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.RuleChain;
-import org.junit.runner.RunWith;
-
-/**
- * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations.
- * This class contains tests for this validator.
- */
-@RunWith(AndroidJUnit4.class)
-public class RavenwoodTestMethodValidation_Fail02_Test {
- private ExpectedException mThrown = ExpectedException.none();
- private final RavenwoodRule mRavenwood = new RavenwoodRule();
-
- @Rule
- public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood);
-
- public RavenwoodTestMethodValidation_Fail02_Test() {
- mThrown.expectMessage("Method tearDown() doesn't have @After");
- }
-
- @SuppressWarnings("JUnit4TearDownNotRun")
- public void tearDown() {
- }
-
- @Test
- public void testEmpty() {
- }
-}
diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail03_Test.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail03_Test.java
deleted file mode 100644
index ec8e907..0000000
--- a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_Fail03_Test.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.ravenwoodtest.coretest.methodvalidation;
-
-import android.platform.test.ravenwood.RavenwoodRule;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.RuleChain;
-import org.junit.runner.RunWith;
-
-/**
- * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations.
- * This class contains tests for this validator.
- */
-@RunWith(AndroidJUnit4.class)
-public class RavenwoodTestMethodValidation_Fail03_Test {
- private ExpectedException mThrown = ExpectedException.none();
- private final RavenwoodRule mRavenwood = new RavenwoodRule();
-
- @Rule
- public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood);
-
- public RavenwoodTestMethodValidation_Fail03_Test() {
- mThrown.expectMessage("Method testFoo() doesn't have @Test");
- }
-
- @SuppressWarnings("JUnit4TestNotRun")
- public void testFoo() {
- }
-
- @Test
- public void testEmpty() {
- }
-}
diff --git a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_OkTest.java b/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_OkTest.java
deleted file mode 100644
index d952d07..0000000
--- a/ravenwood/coretest/test/com/android/ravenwoodtest/coretest/methodvalidation/RavenwoodTestMethodValidation_OkTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.ravenwoodtest.coretest.methodvalidation;
-
-import android.platform.test.ravenwood.RavenwoodRule;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations.
- * This class contains tests for this validator.
- */
-@RunWith(AndroidJUnit4.class)
-public class RavenwoodTestMethodValidation_OkTest {
- @Rule
- public final RavenwoodRule mRavenwood = new RavenwoodRule();
-
- @Before
- public void setUp() {
- }
-
- @Before
- public void testSetUp() {
- }
-
- @After
- public void tearDown() {
- }
-
- @After
- public void testTearDown() {
- }
-
- @Test
- public void testEmpty() {
- }
-}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java
new file mode 100644
index 0000000..478bead
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import static org.junit.Assert.fail;
+
+import android.os.Bundle;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.Order;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.Scope;
+import android.platform.test.ravenwood.RavenwoodTestStats.Result;
+import android.util.Log;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.runner.Description;
+import org.junit.runners.model.TestClass;
+
+/**
+ * Provide hook points created by {@link RavenwoodAwareTestRunner}.
+ *
+ * States are associated with each {@link RavenwoodAwareTestRunner} are stored in
+ * {@link RavenwoodRunnerState}, rather than as members of {@link RavenwoodAwareTestRunner}.
+ * See its javadoc for the reasons.
+ *
+ * All methods in this class must be called from the test main thread.
+ */
+public class RavenwoodAwareTestRunnerHook {
+ private static final String TAG = RavenwoodAwareTestRunner.TAG;
+
+ private RavenwoodAwareTestRunnerHook() {
+ }
+
+ /**
+ * Called before any code starts. Internally it will only initialize the environment once.
+ */
+ public static void performGlobalInitialization() {
+ RavenwoodRuntimeEnvironmentController.globalInitOnce();
+ }
+
+ /**
+ * Called when a runner starts, before the inner runner gets a chance to run.
+ */
+ public static void onRunnerInitializing(RavenwoodAwareTestRunner runner, TestClass testClass) {
+ Log.i(TAG, "onRunnerInitializing: testClass=" + testClass.getJavaClass()
+ + " runner=" + runner);
+
+ // This is needed to make AndroidJUnit4ClassRunner happy.
+ InstrumentationRegistry.registerInstance(null, Bundle.EMPTY);
+ }
+
+ /**
+ * Called when a whole test class is skipped.
+ */
+ public static void onClassSkipped(Description description) {
+ Log.i(TAG, "onClassSkipped: description=" + description);
+ RavenwoodTestStats.getInstance().onClassSkipped(description);
+ }
+
+ /**
+ * Called before the inner runner starts.
+ */
+ public static void onBeforeInnerRunnerStart(
+ RavenwoodAwareTestRunner runner, Description description) throws Throwable {
+ Log.v(TAG, "onBeforeInnerRunnerStart: description=" + description);
+
+ // Prepare the environment before the inner runner starts.
+ runner.mState.enterTestClass(description);
+ }
+
+ /**
+ * Called after the inner runner finished.
+ */
+ public static void onAfterInnerRunnerFinished(
+ RavenwoodAwareTestRunner runner, Description description) throws Throwable {
+ Log.v(TAG, "onAfterInnerRunnerFinished: description=" + description);
+
+ RavenwoodTestStats.getInstance().onClassFinished(description);
+ runner.mState.exitTestClass();
+ }
+
+ /**
+ * Called before a test / class.
+ *
+ * Return false if it should be skipped.
+ */
+ public static boolean onBefore(RavenwoodAwareTestRunner runner, Description description,
+ Scope scope, Order order) throws Throwable {
+ Log.v(TAG, "onBefore: description=" + description + ", " + scope + ", " + order);
+
+ if (scope == Scope.Instance && order == Order.Outer) {
+ // Start of a test method.
+ runner.mState.enterTestMethod(description);
+ }
+
+ final var classDescription = runner.mState.getClassDescription();
+
+ // Class-level annotations are checked by the runner already, so we only check
+ // method-level annotations here.
+ if (scope == Scope.Instance && order == Order.Outer) {
+ if (!RavenwoodEnablementChecker.shouldEnableOnRavenwood(
+ description, true)) {
+ RavenwoodTestStats.getInstance().onTestFinished(
+ classDescription, description, Result.Skipped);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Called after a test / class.
+ *
+ * Return false if the exception should be ignored.
+ */
+ public static boolean onAfter(RavenwoodAwareTestRunner runner, Description description,
+ Scope scope, Order order, Throwable th) {
+ Log.v(TAG, "onAfter: description=" + description + ", " + scope + ", " + order + ", " + th);
+
+ final var classDescription = runner.mState.getClassDescription();
+
+ if (scope == Scope.Instance && order == Order.Outer) {
+ // End of a test method.
+ runner.mState.exitTestMethod();
+ RavenwoodTestStats.getInstance().onTestFinished(classDescription, description,
+ th == null ? Result.Passed : Result.Failed);
+ }
+
+ // If RUN_DISABLED_TESTS is set, and the method did _not_ throw, make it an error.
+ if (RavenwoodRule.private$ravenwood().isRunningDisabledTests()
+ && scope == Scope.Instance && order == Order.Outer) {
+
+ boolean isTestEnabled = RavenwoodEnablementChecker.shouldEnableOnRavenwood(
+ description, false);
+ if (th == null) {
+ // Test passed. Is the test method supposed to be enabled?
+ if (isTestEnabled) {
+ // Enabled and didn't throw, okay.
+ return true;
+ } else {
+ // Disabled and didn't throw. We should report it.
+ fail("Test wasn't included under Ravenwood, but it actually "
+ + "passed under Ravenwood; consider updating annotations");
+ return true; // unreachable.
+ }
+ } else {
+ // Test failed.
+ if (isTestEnabled) {
+ // Enabled but failed. We should throw the exception.
+ return true;
+ } else {
+ // Disabled and failed. Expected. Don't throw.
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Called by {@link RavenwoodAwareTestRunner} to see if it should run a test class or not.
+ */
+ public static boolean shouldRunClassOnRavenwood(Class<?> clazz) {
+ return RavenwoodEnablementChecker.shouldRunClassOnRavenwood(clazz, true);
+ }
+
+ /**
+ * Called by RavenwoodRule.
+ */
+ public static void onRavenwoodRuleEnter(RavenwoodAwareTestRunner runner,
+ Description description, RavenwoodRule rule) throws Throwable {
+ Log.v(TAG, "onRavenwoodRuleEnter: description=" + description);
+
+ runner.mState.enterRavenwoodRule(rule);
+ }
+
+
+ /**
+ * Called by RavenwoodRule.
+ */
+ public static void onRavenwoodRuleExit(RavenwoodAwareTestRunner runner,
+ Description description, RavenwoodRule rule) throws Throwable {
+ Log.v(TAG, "onRavenwoodRuleExit: description=" + description);
+
+ runner.mState.exitRavenwoodRule(rule);
+ }
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodConfigState.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodConfigState.java
new file mode 100644
index 0000000..3535cb2
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodConfigState.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_EMPTY_RESOURCES_APK;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.annotation.Nullable;
+import android.app.ResourcesManager;
+import android.content.res.Resources;
+import android.view.DisplayAdjustments;
+
+import java.io.File;
+import java.util.HashMap;
+
+/**
+ * Used to store various states associated with {@link RavenwoodConfig} that's inly needed
+ * in junit-impl.
+ *
+ * We don't want to put it in junit-src to avoid having to recompile all the downstream
+ * dependencies after changing this class.
+ *
+ * All members must be called from the runner's main thread.
+ */
+public class RavenwoodConfigState {
+ private static final String TAG = "RavenwoodConfigState";
+
+ private final RavenwoodConfig mConfig;
+
+ public RavenwoodConfigState(RavenwoodConfig config) {
+ mConfig = config;
+ }
+
+ /** Map from path -> resources. */
+ private final HashMap<File, Resources> mCachedResources = new HashMap<>();
+
+ /**
+ * Load {@link Resources} from an APK, with cache.
+ */
+ public Resources loadResources(@Nullable File apkPath) {
+ var cached = mCachedResources.get(apkPath);
+ if (cached != null) {
+ return cached;
+ }
+
+ var fileToLoad = apkPath != null ? apkPath : new File(RAVENWOOD_EMPTY_RESOURCES_APK);
+
+ assertTrue("File " + fileToLoad + " doesn't exist.", fileToLoad.isFile());
+
+ final String path = fileToLoad.getAbsolutePath();
+ final var emptyPaths = new String[0];
+
+ ResourcesManager.getInstance().initializeApplicationPaths(path, emptyPaths);
+
+ final var ret = ResourcesManager.getInstance().getResources(null, path,
+ emptyPaths, emptyPaths, emptyPaths,
+ emptyPaths, null, null,
+ new DisplayAdjustments().getCompatibilityInfo(),
+ RavenwoodRuntimeEnvironmentController.class.getClassLoader(), null);
+
+ assertNotNull(ret);
+
+ mCachedResources.put(apkPath, ret);
+ return ret;
+ }
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java
index 1dd5e1d..239c806 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java
@@ -16,8 +16,13 @@
package android.platform.test.ravenwood;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_RESOURCE_APK;
+
import android.content.ClipboardManager;
import android.content.Context;
+import android.content.res.AssetManager;
+import android.content.res.Resources;
+import android.content.res.Resources.Theme;
import android.hardware.ISerialManager;
import android.hardware.SerialManager;
import android.os.Handler;
@@ -31,11 +36,18 @@
import android.util.ArrayMap;
import android.util.Singleton;
+import com.android.internal.annotations.GuardedBy;
+
+import java.io.File;
+import java.io.IOException;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.function.Supplier;
public class RavenwoodContext extends RavenwoodBaseContext {
+ private static final String TAG = "Ravenwood";
+
+ private final Object mLock = new Object();
private final String mPackageName;
private final HandlerThread mMainThread;
@@ -44,15 +56,31 @@
private final ArrayMap<Class<?>, String> mClassToName = new ArrayMap<>();
private final ArrayMap<String, Supplier<?>> mNameToFactory = new ArrayMap<>();
+ private final File mFilesDir;
+ private final File mCacheDir;
+ private final Supplier<Resources> mResourcesSupplier;
+
+ private RavenwoodContext mAppContext;
+
+ @GuardedBy("mLock")
+ private Resources mResources;
+
+ @GuardedBy("mLock")
+ private Resources.Theme mTheme;
+
private void registerService(Class<?> serviceClass, String serviceName,
Supplier<?> serviceSupplier) {
mClassToName.put(serviceClass, serviceName);
mNameToFactory.put(serviceName, serviceSupplier);
}
- public RavenwoodContext(String packageName, HandlerThread mainThread) {
+ public RavenwoodContext(String packageName, HandlerThread mainThread,
+ Supplier<Resources> resourcesSupplier) throws IOException {
mPackageName = packageName;
mMainThread = mainThread;
+ mResourcesSupplier = resourcesSupplier;
+ mFilesDir = createTempDir(packageName + "_files-dir");
+ mCacheDir = createTempDir(packageName + "_cache-dir");
// Services provided by a typical shipping device
registerService(ClipboardManager.class,
@@ -85,6 +113,11 @@
}
}
+ void cleanUp() {
+ deleteDir(mFilesDir);
+ deleteDir(mCacheDir);
+ }
+
@Override
public String getSystemServiceName(Class<?> serviceClass) {
// TODO: pivot to using SystemServiceRegistry
@@ -100,34 +133,35 @@
@Override
public Looper getMainLooper() {
Objects.requireNonNull(mMainThread,
- "Test must request setProvideMainThread() via RavenwoodRule");
+ "Test must request setProvideMainThread() via RavenwoodConfig");
return mMainThread.getLooper();
}
@Override
public Handler getMainThreadHandler() {
Objects.requireNonNull(mMainThread,
- "Test must request setProvideMainThread() via RavenwoodRule");
+ "Test must request setProvideMainThread() via RavenwoodConfig");
return mMainThread.getThreadHandler();
}
@Override
public Executor getMainExecutor() {
Objects.requireNonNull(mMainThread,
- "Test must request setProvideMainThread() via RavenwoodRule");
+ "Test must request setProvideMainThread() via RavenwoodConfig");
return mMainThread.getThreadExecutor();
}
@Override
public String getPackageName() {
return Objects.requireNonNull(mPackageName,
- "Test must request setPackageName() via RavenwoodRule");
+ "Test must request setPackageName() (or setTargetPackageName())"
+ + " via RavenwoodConfig");
}
@Override
public String getOpPackageName() {
return Objects.requireNonNull(mPackageName,
- "Test must request setPackageName() via RavenwoodRule");
+ "Test must request setPackageName() via RavenwoodConfig");
}
@Override
@@ -150,6 +184,61 @@
return Context.DEVICE_ID_DEFAULT;
}
+ @Override
+ public File getFilesDir() {
+ return mFilesDir;
+ }
+
+ @Override
+ public File getCacheDir() {
+ return mCacheDir;
+ }
+
+ @Override
+ public boolean deleteFile(String name) {
+ File f = new File(name);
+ return f.delete();
+ }
+
+ @Override
+ public Resources getResources() {
+ synchronized (mLock) {
+ if (mResources == null) {
+ mResources = mResourcesSupplier.get();
+ }
+ return mResources;
+ }
+ }
+
+ @Override
+ public AssetManager getAssets() {
+ return getResources().getAssets();
+ }
+
+ @Override
+ public Theme getTheme() {
+ synchronized (mLock) {
+ if (mTheme == null) {
+ mTheme = getResources().newTheme();
+ }
+ return mTheme;
+ }
+ }
+
+ @Override
+ public String getPackageResourcePath() {
+ return new File(RAVENWOOD_RESOURCE_APK).getAbsolutePath();
+ }
+
+ public void setApplicationContext(RavenwoodContext appContext) {
+ mAppContext = appContext;
+ }
+
+ @Override
+ public Context getApplicationContext() {
+ return mAppContext;
+ }
+
/**
* Wrap the given {@link Supplier} to become memoized.
*
@@ -175,4 +264,26 @@
public interface ThrowingSupplier<T> {
T get() throws Exception;
}
+
+
+ static File createTempDir(String prefix) throws IOException {
+ // Create a temp file, delete it and recreate it as a directory.
+ final File dir = File.createTempFile(prefix + "-", "");
+ dir.delete();
+ dir.mkdirs();
+ return dir;
+ }
+
+ static void deleteDir(File dir) {
+ File[] children = dir.listFiles();
+ if (children != null) {
+ for (File child : children) {
+ if (child.isDirectory()) {
+ deleteDir(child);
+ } else {
+ child.delete();
+ }
+ }
+ }
+ }
}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodEnablementChecker.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodEnablementChecker.java
new file mode 100644
index 0000000..77275c4
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodEnablementChecker.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.annotations.EnabledOnRavenwood;
+import android.platform.test.annotations.IgnoreUnderRavenwood;
+
+import org.junit.runner.Description;
+
+/**
+ * Calculates which tests need to be executed on Ravenwood.
+ */
+public class RavenwoodEnablementChecker {
+ private static final String TAG = "RavenwoodDisablementChecker";
+
+ private RavenwoodEnablementChecker() {
+ }
+
+ /**
+ * Determine if the given {@link Description} should be enabled when running on the
+ * Ravenwood test environment.
+ *
+ * A more specific method-level annotation always takes precedence over any class-level
+ * annotation, and an {@link EnabledOnRavenwood} annotation always takes precedence over
+ * an {@link DisabledOnRavenwood} annotation.
+ */
+ public static boolean shouldEnableOnRavenwood(Description description,
+ boolean takeIntoAccountRunDisabledTestsFlag) {
+ // First, consult any method-level annotations
+ if (description.isTest()) {
+ Boolean result = null;
+
+ // Stopgap for http://g/ravenwood/EPAD-N5ntxM
+ if (description.getMethodName().endsWith("$noRavenwood")) {
+ result = false;
+ } else if (description.getAnnotation(EnabledOnRavenwood.class) != null) {
+ result = true;
+ } else if (description.getAnnotation(DisabledOnRavenwood.class) != null) {
+ result = false;
+ } else if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) {
+ result = false;
+ }
+ if (result != null) {
+ if (takeIntoAccountRunDisabledTestsFlag
+ && RavenwoodRule.private$ravenwood().isRunningDisabledTests()) {
+ result = !shouldStillIgnoreInProbeIgnoreMode(
+ description.getTestClass(), description.getMethodName());
+ }
+ }
+ if (result != null) {
+ return result;
+ }
+ }
+
+ // Otherwise, consult any class-level annotations
+ return shouldRunClassOnRavenwood(description.getTestClass(),
+ takeIntoAccountRunDisabledTestsFlag);
+ }
+
+ public static boolean shouldRunClassOnRavenwood(@NonNull Class<?> testClass,
+ boolean takeIntoAccountRunDisabledTestsFlag) {
+ boolean result = true;
+ if (testClass.getAnnotation(EnabledOnRavenwood.class) != null) {
+ result = true;
+ } else if (testClass.getAnnotation(DisabledOnRavenwood.class) != null) {
+ result = false;
+ } else if (testClass.getAnnotation(IgnoreUnderRavenwood.class) != null) {
+ result = false;
+ }
+ if (!result) {
+ if (takeIntoAccountRunDisabledTestsFlag
+ && RavenwoodRule.private$ravenwood().isRunningDisabledTests()) {
+ result = !shouldStillIgnoreInProbeIgnoreMode(testClass, null);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Check if a test should _still_ disabled even if {@code RUN_DISABLED_TESTS}
+ * is true, using {@code REALLY_DISABLED_PATTERN}.
+ *
+ * This only works on tests, not on classes.
+ */
+ static boolean shouldStillIgnoreInProbeIgnoreMode(
+ @NonNull Class<?> testClass, @Nullable String methodName) {
+ if (RavenwoodRule.private$ravenwood().getReallyDisabledPattern().pattern().isEmpty()) {
+ return false;
+ }
+
+ final var fullname = testClass.getName() + (methodName != null ? "#" + methodName : "");
+
+ System.out.println("XXX=" + fullname);
+
+ if (RavenwoodRule.private$ravenwood().getReallyDisabledPattern().matcher(fullname).find()) {
+ System.out.println("Still ignoring " + fullname);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java
new file mode 100644
index 0000000..e548611
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import com.android.ravenwood.common.RavenwoodCommonUtils;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * We use this class to load libandroid_runtime.
+ * In the future, we may load other native libraries.
+ */
+public final class RavenwoodNativeLoader {
+ public static final String CORE_NATIVE_CLASSES = "core_native_classes";
+ public static final String ICU_DATA_PATH = "icu.data.path";
+ public static final String KEYBOARD_PATHS = "keyboard_paths";
+ public static final String GRAPHICS_NATIVE_CLASSES = "graphics_native_classes";
+
+ public static final String LIBANDROID_RUNTIME_NAME = "android_runtime";
+
+ /**
+ * Classes with native methods that are backed by libandroid_runtime.
+ *
+ * See frameworks/base/core/jni/platform/host/HostRuntime.cpp
+ */
+ private static final Class<?>[] sLibandroidClasses = {
+ android.util.Log.class,
+ android.os.Parcel.class,
+ android.os.Binder.class,
+ android.content.res.ApkAssets.class,
+ android.content.res.AssetManager.class,
+ android.content.res.StringBlock.class,
+ android.content.res.XmlBlock.class,
+ };
+
+ /**
+ * Classes with native methods that are backed by libhwui.
+ *
+ * See frameworks/base/libs/hwui/apex/LayoutlibLoader.cpp
+ */
+ private static final Class<?>[] sLibhwuiClasses = {
+ android.graphics.Interpolator.class,
+ android.graphics.Matrix.class,
+ android.graphics.Path.class,
+ android.graphics.Color.class,
+ android.graphics.ColorSpace.class,
+ };
+
+ /**
+ * Extra strings needed to pass to register_android_graphics_classes().
+ *
+ * `android.graphics.Graphics` is not actually a class, so we just hardcode it here.
+ */
+ public final static String[] GRAPHICS_EXTRA_INIT_PARAMS = new String[] {
+ "android.graphics.Graphics"
+ };
+
+ private RavenwoodNativeLoader() {
+ }
+
+ private static void log(String message) {
+ System.out.println("RavenwoodNativeLoader: " + message);
+ }
+
+ private static void log(String fmt, Object... args) {
+ log(String.format(fmt, args));
+ }
+
+ private static void ensurePropertyNotSet(String key) {
+ if (System.getProperty(key) != null) {
+ throw new RuntimeException("System property \"" + key + "\" is set unexpectedly");
+ }
+ }
+
+ private static void setProperty(String key, String value) {
+ System.setProperty(key, value);
+ log("Property set: %s=\"%s\"", key, value);
+ }
+
+ private static void dumpSystemProperties() {
+ for (var prop : System.getProperties().entrySet()) {
+ log(" %s=\"%s\"", prop.getKey(), prop.getValue());
+ }
+ }
+
+ /**
+ * libandroid_runtime uses Java's system properties to decide what JNI methods to set up.
+ * Set up these properties and load the native library
+ */
+ public static void loadFrameworkNativeCode() {
+ if ("1".equals(System.getenv("RAVENWOOD_DUMP_PROPERTIES"))) {
+ log("Java system properties:");
+ dumpSystemProperties();
+ }
+
+ // Make sure these properties are not set.
+ ensurePropertyNotSet(CORE_NATIVE_CLASSES);
+ ensurePropertyNotSet(ICU_DATA_PATH);
+ ensurePropertyNotSet(KEYBOARD_PATHS);
+ ensurePropertyNotSet(GRAPHICS_NATIVE_CLASSES);
+
+ // Build the property values
+ final var joiner = Collectors.joining(",");
+ final var libandroidClasses =
+ Arrays.stream(sLibandroidClasses).map(Class::getName).collect(joiner);
+ final var libhwuiClasses = Stream.concat(
+ Arrays.stream(sLibhwuiClasses).map(Class::getName),
+ Arrays.stream(GRAPHICS_EXTRA_INIT_PARAMS)
+ ).collect(joiner);
+
+ // Load the libraries
+ setProperty(CORE_NATIVE_CLASSES, libandroidClasses);
+ setProperty(GRAPHICS_NATIVE_CLASSES, libhwuiClasses);
+ log("Loading " + LIBANDROID_RUNTIME_NAME + " for '" + libandroidClasses + "' and '"
+ + libhwuiClasses + "'");
+ RavenwoodCommonUtils.loadJniLibrary(LIBANDROID_RUNTIME_NAME);
+ }
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
deleted file mode 100644
index 4357f2b..0000000
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * 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.platform.test.ravenwood;
-
-import static org.junit.Assert.assertFalse;
-
-import android.app.ActivityManager;
-import android.app.Instrumentation;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.HandlerThread;
-import android.os.Looper;
-import android.os.ServiceManager;
-import android.util.Log;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-import com.android.internal.os.RuntimeInit;
-import com.android.server.LocalServices;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.Description;
-import org.junit.runner.RunWith;
-import org.junit.runners.model.Statement;
-
-import java.io.PrintStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-public class RavenwoodRuleImpl {
- private static final String MAIN_THREAD_NAME = "RavenwoodMain";
-
- /**
- * When enabled, attempt to dump all thread stacks just before we hit the
- * overall Tradefed timeout, to aid in debugging deadlocks.
- */
- private static final boolean ENABLE_TIMEOUT_STACKS = false;
- private static final int TIMEOUT_MILLIS = 9_000;
-
- private static final ScheduledExecutorService sTimeoutExecutor =
- Executors.newScheduledThreadPool(1);
-
- private static ScheduledFuture<?> sPendingTimeout;
-
- /**
- * When enabled, attempt to detect uncaught exceptions from background threads.
- */
- private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION = false;
-
- /**
- * When set, an unhandled exception was discovered (typically on a background thread), and we
- * capture it here to ensure it's reported as a test failure.
- */
- private static final AtomicReference<Throwable> sPendingUncaughtException =
- new AtomicReference<>();
-
- private static final Thread.UncaughtExceptionHandler sUncaughtExceptionHandler =
- (thread, throwable) -> {
- // Remember the first exception we discover
- sPendingUncaughtException.compareAndSet(null, throwable);
- };
-
- public static void init(RavenwoodRule rule) {
- if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
- maybeThrowPendingUncaughtException(false);
- Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
- }
-
- RuntimeInit.redirectLogStreams();
-
- android.os.Process.init$ravenwood(rule.mUid, rule.mPid);
- android.os.Binder.init$ravenwood();
-// android.os.SystemProperties.init$ravenwood(
-// rule.mSystemProperties.getValues(),
-// rule.mSystemProperties.getKeyReadablePredicate(),
-// rule.mSystemProperties.getKeyWritablePredicate());
- setSystemProperties(rule.mSystemProperties);
-
- ServiceManager.init$ravenwood();
- LocalServices.removeAllServicesForTest();
-
- ActivityManager.init$ravenwood(rule.mCurrentUser);
-
- final HandlerThread main;
- if (rule.mProvideMainThread) {
- main = new HandlerThread(MAIN_THREAD_NAME);
- main.start();
- Looper.setMainLooperForTest(main.getLooper());
- } else {
- main = null;
- }
-
- rule.mContext = new RavenwoodContext(rule.mPackageName, main);
- rule.mInstrumentation = new Instrumentation();
- rule.mInstrumentation.basicInit(rule.mContext);
- InstrumentationRegistry.registerInstance(rule.mInstrumentation, Bundle.EMPTY);
-
- RavenwoodSystemServer.init(rule);
-
- if (ENABLE_TIMEOUT_STACKS) {
- sPendingTimeout = sTimeoutExecutor.schedule(RavenwoodRuleImpl::dumpStacks,
- TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
- }
-
- // Touch some references early to ensure they're <clinit>'ed
- Objects.requireNonNull(Build.TYPE);
- Objects.requireNonNull(Build.VERSION.SDK);
- }
-
- public static void reset(RavenwoodRule rule) {
- if (ENABLE_TIMEOUT_STACKS) {
- sPendingTimeout.cancel(false);
- }
-
- RavenwoodSystemServer.reset(rule);
-
- InstrumentationRegistry.registerInstance(null, Bundle.EMPTY);
- rule.mInstrumentation = null;
- rule.mContext = null;
-
- if (rule.mProvideMainThread) {
- Looper.getMainLooper().quit();
- Looper.clearMainLooperForTest();
- }
-
- ActivityManager.reset$ravenwood();
-
- LocalServices.removeAllServicesForTest();
- ServiceManager.reset$ravenwood();
-
- setSystemProperties(RavenwoodSystemProperties.DEFAULT_VALUES);
- android.os.Binder.reset$ravenwood();
- android.os.Process.reset$ravenwood();
-
- if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
- maybeThrowPendingUncaughtException(true);
- }
- }
-
- public static void logTestRunner(String label, Description description) {
- // This message string carefully matches the exact format emitted by on-device tests, to
- // aid developers in debugging raw text logs
- Log.e("TestRunner", label + ": " + description.getMethodName()
- + "(" + description.getTestClass().getName() + ")");
- }
-
- private static void dumpStacks() {
- final PrintStream out = System.err;
- out.println("-----BEGIN ALL THREAD STACKS-----");
- final Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
- for (Map.Entry<Thread, StackTraceElement[]> stack : stacks.entrySet()) {
- out.println();
- Thread t = stack.getKey();
- out.println(t.toString() + " ID=" + t.getId());
- for (StackTraceElement e : stack.getValue()) {
- out.println("\tat " + e);
- }
- }
- out.println("-----END ALL THREAD STACKS-----");
- }
-
- /**
- * If there's a pending uncaught exception, consume and throw it now. Typically used to
- * report an exception on a background thread as a failure for the currently running test.
- */
- private static void maybeThrowPendingUncaughtException(boolean duringReset) {
- final Throwable pending = sPendingUncaughtException.getAndSet(null);
- if (pending != null) {
- if (duringReset) {
- throw new IllegalStateException(
- "Found an uncaught exception during this test", pending);
- } else {
- throw new IllegalStateException(
- "Found an uncaught exception before this test started", pending);
- }
- }
- }
-
- public static void validate(Statement base, Description description,
- boolean enableOptionalValidation) {
- validateTestRunner(base, description, enableOptionalValidation);
- validateTestAnnotations(base, description, enableOptionalValidation);
- }
-
- private static void validateTestRunner(Statement base, Description description,
- boolean shouldFail) {
- final var testClass = description.getTestClass();
- final var runWith = testClass.getAnnotation(RunWith.class);
- if (runWith == null) {
- return;
- }
-
- // Due to build dependencies, we can't directly refer to androidx classes here,
- // so just check the class name instead.
- if (runWith.value().getCanonicalName().equals("androidx.test.runner.AndroidJUnit4")) {
- var message = "Test " + testClass.getCanonicalName() + " uses deprecated"
- + " test runner androidx.test.runner.AndroidJUnit4."
- + " Switch to androidx.test.ext.junit.runners.AndroidJUnit4.";
- if (shouldFail) {
- Assert.fail(message);
- } else {
- System.err.println("Warning: " + message);
- }
- }
- }
-
- /**
- * @return if a method has any of annotations.
- */
- private static boolean hasAnyAnnotations(Method m, Class<? extends Annotation>... annotations) {
- for (var anno : annotations) {
- if (m.getAnnotation(anno) != null) {
- return true;
- }
- }
- return false;
- }
-
- private static void validateTestAnnotations(Statement base, Description description,
- boolean enableOptionalValidation) {
- final var testClass = description.getTestClass();
-
- final var message = new StringBuilder();
-
- boolean hasErrors = false;
- for (Method m : collectMethods(testClass)) {
- if (Modifier.isPublic(m.getModifiers()) && m.getName().startsWith("test")) {
- if (!hasAnyAnnotations(m, Test.class, Before.class, After.class,
- BeforeClass.class, AfterClass.class)) {
- message.append("\nMethod " + m.getName() + "() doesn't have @Test");
- hasErrors = true;
- }
- }
- if ("setUp".equals(m.getName())) {
- if (!hasAnyAnnotations(m, Before.class)) {
- message.append("\nMethod " + m.getName() + "() doesn't have @Before");
- hasErrors = true;
- }
- if (!Modifier.isPublic(m.getModifiers())) {
- message.append("\nMethod " + m.getName() + "() must be public");
- hasErrors = true;
- }
- }
- if ("tearDown".equals(m.getName())) {
- if (!hasAnyAnnotations(m, After.class)) {
- message.append("\nMethod " + m.getName() + "() doesn't have @After");
- hasErrors = true;
- }
- if (!Modifier.isPublic(m.getModifiers())) {
- message.append("\nMethod " + m.getName() + "() must be public");
- hasErrors = true;
- }
- }
- }
- assertFalse("Problem(s) detected in class " + testClass.getCanonicalName() + ":"
- + message, hasErrors);
- }
-
- /**
- * Collect all (public or private or any) methods in a class, including inherited methods.
- */
- private static List<Method> collectMethods(Class<?> clazz) {
- var ret = new ArrayList<Method>();
- collectMethods(clazz, ret);
- return ret;
- }
-
- private static void collectMethods(Class<?> clazz, List<Method> result) {
- // Class.getMethods() only return public methods, so we need to use getDeclaredMethods()
- // instead, and recurse.
- for (var m : clazz.getDeclaredMethods()) {
- result.add(m);
- }
- if (clazz.getSuperclass() != null) {
- collectMethods(clazz.getSuperclass(), result);
- }
- }
-
- /**
- * Set the current configuration to the actual SystemProperties.
- */
- public static void setSystemProperties(RavenwoodSystemProperties ravenwoodSystemProperties) {
- var clone = new RavenwoodSystemProperties(ravenwoodSystemProperties, true);
-
- android.os.SystemProperties.init$ravenwood(
- clone.getValues(),
- clone.getKeyReadablePredicate(),
- clone.getKeyWritablePredicate());
- }
-}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java
new file mode 100644
index 0000000..03513ab
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import static com.android.ravenwood.common.RavenwoodCommonUtils.ensureIsPublicMember;
+
+import static org.junit.Assert.fail;
+
+import android.annotation.Nullable;
+
+import com.android.internal.annotations.GuardedBy;
+import com.android.ravenwood.common.RavenwoodRuntimeException;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.WeakHashMap;
+
+/**
+ * Used to store various states associated with the current test runner that's inly needed
+ * in junit-impl.
+ *
+ * We don't want to put it in junit-src to avoid having to recompile all the downstream
+ * dependencies after changing this class.
+ *
+ * All members must be called from the runner's main thread.
+ */
+public final class RavenwoodRunnerState {
+ private static final String TAG = "RavenwoodRunnerState";
+
+ @GuardedBy("sStates")
+ private static final WeakHashMap<RavenwoodAwareTestRunner, RavenwoodRunnerState> sStates =
+ new WeakHashMap<>();
+
+ private final RavenwoodAwareTestRunner mRunner;
+
+ /**
+ * Ctor.
+ */
+ public RavenwoodRunnerState(RavenwoodAwareTestRunner runner) {
+ mRunner = runner;
+ }
+
+ private Description mClassDescription;
+ private Description mMethodDescription;
+
+ private RavenwoodConfig mCurrentConfig;
+ private RavenwoodRule mCurrentRule;
+ private boolean mHasRavenwoodRule;
+
+ public Description getClassDescription() {
+ return mClassDescription;
+ }
+
+ public void enterTestClass(Description classDescription) throws IOException {
+ mClassDescription = classDescription;
+
+ mHasRavenwoodRule = hasRavenwoodRule(mRunner.getTestClass().getJavaClass());
+ mCurrentConfig = extractConfiguration(mRunner.getTestClass().getJavaClass());
+
+ if (mCurrentConfig != null) {
+ RavenwoodRuntimeEnvironmentController.init(mCurrentConfig);
+ }
+ }
+
+ public void exitTestClass() {
+ if (mCurrentConfig != null) {
+ try {
+ RavenwoodRuntimeEnvironmentController.reset();
+ } finally {
+ mClassDescription = null;
+ }
+ }
+ }
+
+ public void enterTestMethod(Description description) {
+ mMethodDescription = description;
+ }
+
+ public void exitTestMethod() {
+ mMethodDescription = null;
+ }
+
+ public void enterRavenwoodRule(RavenwoodRule rule) throws IOException {
+ if (!mHasRavenwoodRule) {
+ fail("If you have a RavenwoodRule in your test, make sure the field type is"
+ + " RavenwoodRule so Ravenwood can detect it.");
+ }
+ if (mCurrentConfig != null) {
+ fail("RavenwoodConfig and RavenwoodRule cannot be used in the same class."
+ + " Suggest migrating to RavenwoodConfig.");
+ }
+ if (mCurrentRule != null) {
+ fail("Multiple nesting RavenwoodRule's are detected in the same class,"
+ + " which is not supported.");
+ }
+ mCurrentRule = rule;
+ RavenwoodRuntimeEnvironmentController.init(rule.getConfiguration());
+ }
+
+ public void exitRavenwoodRule(RavenwoodRule rule) {
+ if (mCurrentRule != rule) {
+ return; // This happens if the rule did _not_ take effect somehow.
+ }
+
+ try {
+ RavenwoodRuntimeEnvironmentController.reset();
+ } finally {
+ mCurrentRule = null;
+ }
+ }
+
+ /**
+ * @return a configuration from a test class, if any.
+ */
+ @Nullable
+ private RavenwoodConfig extractConfiguration(Class<?> testClass) {
+ var field = findConfigurationField(testClass);
+ if (field == null) {
+ if (mHasRavenwoodRule) {
+ // Should be handled by RavenwoodRule
+ return null;
+ }
+
+ // If no RavenwoodConfig and no RavenwoodRule, return a default config
+ return new RavenwoodConfig.Builder().build();
+ }
+ if (mHasRavenwoodRule) {
+ fail("RavenwoodConfig and RavenwoodRule cannot be used in the same class."
+ + " Suggest migrating to RavenwoodConfig.");
+ }
+
+ try {
+ return (RavenwoodConfig) field.get(null);
+ } catch (IllegalAccessException e) {
+ throw new RavenwoodRuntimeException("Failed to fetch from the configuration field", e);
+ }
+ }
+
+ /**
+ * @return true if the current target class (or its super classes) has any @Rule / @ClassRule
+ * fields of type RavenwoodRule.
+ *
+ * Note, this check won't detect cases where a Rule is of type
+ * {@link TestRule} and still be a {@link RavenwoodRule}. But that'll be detected at runtime
+ * as a failure, in {@link #enterRavenwoodRule}.
+ */
+ private static boolean hasRavenwoodRule(Class<?> testClass) {
+ for (var field : testClass.getDeclaredFields()) {
+ if (!field.isAnnotationPresent(Rule.class)
+ && !field.isAnnotationPresent(ClassRule.class)) {
+ continue;
+ }
+ if (field.getType().equals(RavenwoodRule.class)) {
+ return true;
+ }
+ }
+ // JUnit supports rules as methods, so we need to check them too.
+ for (var method : testClass.getDeclaredMethods()) {
+ if (!method.isAnnotationPresent(Rule.class)
+ && !method.isAnnotationPresent(ClassRule.class)) {
+ continue;
+ }
+ if (method.getReturnType().equals(RavenwoodRule.class)) {
+ return true;
+ }
+ }
+ // Look into the super class.
+ if (!testClass.getSuperclass().equals(Object.class)) {
+ return hasRavenwoodRule(testClass.getSuperclass());
+ }
+ return false;
+ }
+
+ /**
+ * Find and return a field with @RavenwoodConfig.Config, which must be of type
+ * RavenwoodConfig.
+ */
+ @Nullable
+ private static Field findConfigurationField(Class<?> testClass) {
+ Field foundField = null;
+
+ for (var field : testClass.getDeclaredFields()) {
+ final var hasAnot = field.isAnnotationPresent(RavenwoodConfig.Config.class);
+ final var isType = field.getType().equals(RavenwoodConfig.class);
+
+ if (hasAnot) {
+ if (isType) {
+ // Good, use this field.
+ if (foundField != null) {
+ fail(String.format(
+ "Class %s has multiple fields with %s",
+ testClass.getCanonicalName(),
+ "@RavenwoodConfig.Config"));
+ }
+ // Make sure it's static public
+ ensureIsPublicMember(field, true);
+
+ foundField = field;
+ } else {
+ fail(String.format(
+ "Field %s.%s has %s but type is not %s",
+ testClass.getCanonicalName(),
+ field.getName(),
+ "@RavenwoodConfig.Config",
+ "RavenwoodConfig"));
+ return null; // unreachable
+ }
+ } else {
+ if (isType) {
+ fail(String.format(
+ "Field %s.%s does not have %s but type is %s",
+ testClass.getCanonicalName(),
+ field.getName(),
+ "@RavenwoodConfig.Config",
+ "RavenwoodConfig"));
+ return null; // unreachable
+ } else {
+ // Unrelated field, ignore.
+ continue;
+ }
+ }
+ }
+ if (foundField != null) {
+ return foundField;
+ }
+ if (!testClass.getSuperclass().equals(Object.class)) {
+ return findConfigurationField(testClass.getSuperclass());
+ }
+ return null;
+ }
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
new file mode 100644
index 0000000..40b14db
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
@@ -0,0 +1,370 @@
+/*
+ * 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.platform.test.ravenwood;
+
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_INST_RESOURCE_APK;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_RESOURCE_APK;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERSION_JAVA_SYSPROP;
+
+import android.app.ActivityManager;
+import android.app.Instrumentation;
+import android.app.ResourcesManager;
+import android.content.res.Resources;
+import android.os.Binder;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.os.ServiceManager;
+import android.system.ErrnoException;
+import android.system.Os;
+import android.util.Log;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.android.internal.os.RuntimeInit;
+import com.android.ravenwood.common.RavenwoodCommonUtils;
+import com.android.ravenwood.common.RavenwoodRuntimeException;
+import com.android.ravenwood.common.SneakyThrow;
+import com.android.server.LocalServices;
+
+import org.junit.runner.Description;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Supplier;
+
+/**
+ * Responsible for initializing and de-initializing the environment, according to a
+ * {@link RavenwoodConfig}.
+ */
+public class RavenwoodRuntimeEnvironmentController {
+ private static final String TAG = "RavenwoodRuntimeEnvironmentController";
+
+ private RavenwoodRuntimeEnvironmentController() {
+ }
+
+ private static final String MAIN_THREAD_NAME = "RavenwoodMain";
+
+ /**
+ * When enabled, attempt to dump all thread stacks just before we hit the
+ * overall Tradefed timeout, to aid in debugging deadlocks.
+ */
+ private static final boolean ENABLE_TIMEOUT_STACKS =
+ "1".equals(System.getenv("RAVENWOOD_ENABLE_TIMEOUT_STACKS"));
+
+ private static final int TIMEOUT_MILLIS = 9_000;
+
+ private static final ScheduledExecutorService sTimeoutExecutor =
+ Executors.newScheduledThreadPool(1);
+
+ private static ScheduledFuture<?> sPendingTimeout;
+
+ private static long sOriginalIdentityToken = -1;
+
+ /**
+ * When enabled, attempt to detect uncaught exceptions from background threads.
+ */
+ private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION =
+ "1".equals(System.getenv("RAVENWOOD_ENABLE_UNCAUGHT_EXCEPTION_DETECTION"));
+
+ /**
+ * When set, an unhandled exception was discovered (typically on a background thread), and we
+ * capture it here to ensure it's reported as a test failure.
+ */
+ private static final AtomicReference<Throwable> sPendingUncaughtException =
+ new AtomicReference<>();
+
+ private static final Thread.UncaughtExceptionHandler sUncaughtExceptionHandler =
+ (thread, throwable) -> {
+ // Remember the first exception we discover
+ sPendingUncaughtException.compareAndSet(null, throwable);
+ };
+
+ // TODO: expose packCallingIdentity function in libbinder and use it directly
+ // See: packCallingIdentity in frameworks/native/libs/binder/IPCThreadState.cpp
+ private static long packBinderIdentityToken(
+ boolean hasExplicitIdentity, int callingUid, int callingPid) {
+ long res = ((long) callingUid << 32) | callingPid;
+ if (hasExplicitIdentity) {
+ res |= (0x1 << 30);
+ } else {
+ res &= ~(0x1 << 30);
+ }
+ return res;
+ }
+
+ private static RavenwoodConfig sConfig;
+ private static boolean sInitialized = false;
+
+ /**
+ * Initialize the global environment.
+ */
+ public static void globalInitOnce() {
+ if (sInitialized) {
+ return;
+ }
+ sInitialized = true;
+
+ // We haven't initialized liblog yet, so directly write to System.out here.
+ RavenwoodCommonUtils.log(TAG, "globalInit()");
+
+ // Do the basic set up for the android sysprops.
+ setSystemProperties(RavenwoodSystemProperties.DEFAULT_VALUES);
+
+ // Make sure libandroid_runtime is loaded.
+ RavenwoodNativeLoader.loadFrameworkNativeCode();
+
+ // Redirect stdout/stdin to liblog.
+ RuntimeInit.redirectLogStreams();
+
+ if (RAVENWOOD_VERBOSE_LOGGING) {
+ RavenwoodCommonUtils.log(TAG, "Force enabling verbose logging");
+ try {
+ Os.setenv("ANDROID_LOG_TAGS", "*:v", true);
+ } catch (ErrnoException e) {
+ // Shouldn't happen.
+ }
+ }
+
+ System.setProperty(RAVENWOOD_VERSION_JAVA_SYSPROP, "1");
+ // This will let AndroidJUnit4 use the original runner.
+ System.setProperty("android.junit.runner",
+ "androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner");
+ }
+
+ /**
+ * Initialize the environment.
+ */
+ public static void init(RavenwoodConfig config) throws IOException {
+ if (RAVENWOOD_VERBOSE_LOGGING) {
+ Log.i(TAG, "init() called here", new RuntimeException("STACKTRACE"));
+ }
+ try {
+ initInner(config);
+ } catch (Exception th) {
+ Log.e(TAG, "init() failed", th);
+ reset();
+ SneakyThrow.sneakyThrow(th);
+ }
+ }
+
+ private static void initInner(RavenwoodConfig config) throws IOException {
+ if (sConfig != null) {
+ throw new RavenwoodRuntimeException("Internal error: init() called without reset()");
+ }
+ sConfig = config;
+ if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
+ maybeThrowPendingUncaughtException(false);
+ Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
+ }
+
+ android.os.Process.init$ravenwood(config.mUid, config.mPid);
+ sOriginalIdentityToken = Binder.clearCallingIdentity();
+ Binder.restoreCallingIdentity(packBinderIdentityToken(false, config.mUid, config.mPid));
+ setSystemProperties(config.mSystemProperties);
+
+ ServiceManager.init$ravenwood();
+ LocalServices.removeAllServicesForTest();
+
+ ActivityManager.init$ravenwood(config.mCurrentUser);
+
+ final HandlerThread main;
+ if (config.mProvideMainThread) {
+ main = new HandlerThread(MAIN_THREAD_NAME);
+ main.start();
+ Looper.setMainLooperForTest(main.getLooper());
+ } else {
+ main = null;
+ }
+
+ final boolean isSelfInstrumenting =
+ Objects.equals(config.mTestPackageName, config.mTargetPackageName);
+
+ // This will load the resources from the apk set to `resource_apk` in the build file.
+ // This is supposed to be the "target app"'s resources.
+ final Supplier<Resources> targetResourcesLoader = () -> {
+ var file = new File(RAVENWOOD_RESOURCE_APK);
+ return config.mState.loadResources(file.exists() ? file : null);
+ };
+
+ // Set up test context's (== instrumentation context's) resources.
+ // If the target package name == test package name, then we use the main resources.
+ final Supplier<Resources> instResourcesLoader;
+ if (isSelfInstrumenting) {
+ instResourcesLoader = targetResourcesLoader;
+ } else {
+ instResourcesLoader = () -> {
+ var file = new File(RAVENWOOD_INST_RESOURCE_APK);
+ return config.mState.loadResources(file.exists() ? file : null);
+ };
+ }
+
+ var instContext = new RavenwoodContext(
+ config.mTestPackageName, main, instResourcesLoader);
+ var targetContext = new RavenwoodContext(
+ config.mTargetPackageName, main, targetResourcesLoader);
+
+ // Set up app context.
+ var appContext = new RavenwoodContext(
+ config.mTargetPackageName, main, targetResourcesLoader);
+ appContext.setApplicationContext(appContext);
+ if (isSelfInstrumenting) {
+ instContext.setApplicationContext(appContext);
+ targetContext.setApplicationContext(appContext);
+ } else {
+ // When instrumenting into another APK, the test context doesn't have an app context.
+ targetContext.setApplicationContext(appContext);
+ }
+ config.mInstContext = instContext;
+ config.mTargetContext = targetContext;
+
+ // Prepare other fields.
+ config.mInstrumentation = new Instrumentation();
+ config.mInstrumentation.basicInit(config.mInstContext, config.mTargetContext);
+ InstrumentationRegistry.registerInstance(config.mInstrumentation, Bundle.EMPTY);
+
+ RavenwoodSystemServer.init(config);
+
+ if (ENABLE_TIMEOUT_STACKS) {
+ sPendingTimeout = sTimeoutExecutor.schedule(
+ RavenwoodRuntimeEnvironmentController::dumpStacks,
+ TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ }
+
+ // Touch some references early to ensure they're <clinit>'ed
+ Objects.requireNonNull(Build.TYPE);
+ Objects.requireNonNull(Build.VERSION.SDK);
+ }
+
+ /**
+ * De-initialize.
+ */
+ public static void reset() {
+ if (RAVENWOOD_VERBOSE_LOGGING) {
+ Log.i(TAG, "reset() called here", new RuntimeException("STACKTRACE"));
+ }
+ if (sConfig == null) {
+ throw new RavenwoodRuntimeException("Internal error: reset() already called");
+ }
+ var config = sConfig;
+ sConfig = null;
+
+ if (ENABLE_TIMEOUT_STACKS) {
+ sPendingTimeout.cancel(false);
+ }
+
+ RavenwoodSystemServer.reset(config);
+
+ InstrumentationRegistry.registerInstance(null, Bundle.EMPTY);
+ config.mInstrumentation = null;
+ if (config.mInstContext != null) {
+ ((RavenwoodContext) config.mInstContext).cleanUp();
+ }
+ if (config.mTargetContext != null) {
+ ((RavenwoodContext) config.mTargetContext).cleanUp();
+ }
+ config.mInstContext = null;
+ config.mTargetContext = null;
+
+ if (config.mProvideMainThread) {
+ Looper.getMainLooper().quit();
+ Looper.clearMainLooperForTest();
+ }
+
+ ActivityManager.reset$ravenwood();
+
+ LocalServices.removeAllServicesForTest();
+ ServiceManager.reset$ravenwood();
+
+ setSystemProperties(RavenwoodSystemProperties.DEFAULT_VALUES);
+ if (sOriginalIdentityToken != -1) {
+ Binder.restoreCallingIdentity(sOriginalIdentityToken);
+ }
+ android.os.Process.reset$ravenwood();
+
+ try {
+ ResourcesManager.setInstance(null); // Better structure needed.
+ } catch (Exception e) {
+ // AOSP-CHANGE: AOSP doesn't support resources yet.
+ }
+
+ if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
+ maybeThrowPendingUncaughtException(true);
+ }
+ }
+
+ public static void logTestRunner(String label, Description description) {
+ // This message string carefully matches the exact format emitted by on-device tests, to
+ // aid developers in debugging raw text logs
+ Log.e("TestRunner", label + ": " + description.getMethodName()
+ + "(" + description.getTestClass().getName() + ")");
+ }
+
+ private static void dumpStacks() {
+ final PrintStream out = System.err;
+ out.println("-----BEGIN ALL THREAD STACKS-----");
+ final Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
+ for (Map.Entry<Thread, StackTraceElement[]> stack : stacks.entrySet()) {
+ out.println();
+ Thread t = stack.getKey();
+ out.println(t.toString() + " ID=" + t.getId());
+ for (StackTraceElement e : stack.getValue()) {
+ out.println("\tat " + e);
+ }
+ }
+ out.println("-----END ALL THREAD STACKS-----");
+ }
+
+ /**
+ * If there's a pending uncaught exception, consume and throw it now. Typically used to
+ * report an exception on a background thread as a failure for the currently running test.
+ */
+ private static void maybeThrowPendingUncaughtException(boolean duringReset) {
+ final Throwable pending = sPendingUncaughtException.getAndSet(null);
+ if (pending != null) {
+ if (duringReset) {
+ throw new IllegalStateException(
+ "Found an uncaught exception during this test", pending);
+ } else {
+ throw new IllegalStateException(
+ "Found an uncaught exception before this test started", pending);
+ }
+ }
+ }
+
+ /**
+ * Set the current configuration to the actual SystemProperties.
+ */
+ public static void setSystemProperties(RavenwoodSystemProperties ravenwoodSystemProperties) {
+ var clone = new RavenwoodSystemProperties(ravenwoodSystemProperties, true);
+
+ android.os.SystemProperties.init$ravenwood(
+ clone.getValues(),
+ clone.getKeyReadablePredicate(),
+ clone.getKeyWritablePredicate());
+ }
+}
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java
index cd6b61d..3946dd84 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemServer.java
@@ -61,19 +61,19 @@
private static TimingsTraceAndSlog sTimings;
private static SystemServiceManager sServiceManager;
- public static void init(RavenwoodRule rule) {
+ public static void init(RavenwoodConfig config) {
// Avoid overhead if no services required
- if (rule.mServicesRequired.isEmpty()) return;
+ if (config.mServicesRequired.isEmpty()) return;
sStartedServices = new ArraySet<>();
sTimings = new TimingsTraceAndSlog();
- sServiceManager = new SystemServiceManager(rule.mContext);
+ sServiceManager = new SystemServiceManager(config.mInstContext);
sServiceManager.setStartInfo(false,
SystemClock.elapsedRealtime(),
SystemClock.uptimeMillis());
LocalServices.addService(SystemServiceManager.class, sServiceManager);
- startServices(rule.mServicesRequired);
+ startServices(config.mServicesRequired);
sServiceManager.sealStartedServices();
// TODO: expand to include additional boot phases when relevant
@@ -81,7 +81,7 @@
sServiceManager.startBootPhase(sTimings, SystemService.PHASE_BOOT_COMPLETED);
}
- public static void reset(RavenwoodRule rule) {
+ public static void reset(RavenwoodConfig config) {
// TODO: consider introducing shutdown boot phases
LocalServices.removeServiceForTest(SystemServiceManager.class);
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java
new file mode 100644
index 0000000..428eb57
--- /dev/null
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodTestStats.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import android.util.Log;
+
+import org.junit.runner.Description;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Collect test result stats and write them into a CSV file containing the test results.
+ *
+ * The output file is created as `/tmp/Ravenwood-stats_[TEST-MODULE=NAME]_[TIMESTAMP].csv`.
+ * A symlink to the latest result will be created as
+ * `/tmp/Ravenwood-stats_[TEST-MODULE=NAME]_latest.csv`.
+ */
+public class RavenwoodTestStats {
+ private static final String TAG = "RavenwoodTestStats";
+ private static final String HEADER = "Module,Class,ClassDesc,Passed,Failed,Skipped";
+
+ private static RavenwoodTestStats sInstance;
+
+ /**
+ * @return a singleton instance.
+ */
+ public static RavenwoodTestStats getInstance() {
+ if (sInstance == null) {
+ sInstance = new RavenwoodTestStats();
+ }
+ return sInstance;
+ }
+
+ /**
+ * Represents a test result.
+ */
+ public enum Result {
+ Passed,
+ Failed,
+ Skipped,
+ }
+
+ private final File mOutputFile;
+ private final PrintWriter mOutputWriter;
+ private final String mTestModuleName;
+
+ public final Map<Description, Map<Description, Result>> mStats = new HashMap<>();
+
+ /** Ctor */
+ public RavenwoodTestStats() {
+ mTestModuleName = guessTestModuleName();
+
+ var basename = "Ravenwood-stats_" + mTestModuleName + "_";
+
+ // Get the current time
+ LocalDateTime now = LocalDateTime.now();
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss");
+
+ var tmpdir = System.getProperty("java.io.tmpdir");
+ mOutputFile = new File(tmpdir, basename + now.format(fmt) + ".csv");
+
+ try {
+ mOutputWriter = new PrintWriter(mOutputFile);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to crete logfile. File=" + mOutputFile, e);
+ }
+
+ // Crete the "latest" symlink.
+ Path symlink = Paths.get(tmpdir, basename + "latest.csv");
+ try {
+ if (Files.exists(symlink)) {
+ Files.delete(symlink);
+ }
+ Files.createSymbolicLink(symlink, Paths.get(mOutputFile.getName()));
+
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to crete logfile. File=" + mOutputFile, e);
+ }
+
+ Log.i(TAG, "Test result stats file: " + mOutputFile);
+
+ // Print the header.
+ mOutputWriter.println(HEADER);
+ mOutputWriter.flush();
+ }
+
+ private String guessTestModuleName() {
+ // Assume the current directory name is the test module name.
+ File cwd;
+ try {
+ cwd = new File(".").getCanonicalFile();
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to get the current directory", e);
+ }
+ return cwd.getName();
+ }
+
+ private void addResult(Description classDescription, Description methodDescription,
+ Result result) {
+ mStats.compute(classDescription, (classDesc, value) -> {
+ if (value == null) {
+ value = new HashMap<>();
+ }
+ value.put(methodDescription, result);
+ return value;
+ });
+ }
+
+ /**
+ * Call it when a test class is skipped.
+ */
+ public void onClassSkipped(Description classDescription) {
+ addResult(classDescription, Description.EMPTY, Result.Skipped);
+ onClassFinished(classDescription);
+ }
+
+ /**
+ * Call it when a test method is finished.
+ */
+ public void onTestFinished(Description classDescription, Description testDescription,
+ Result result) {
+ addResult(classDescription, testDescription, result);
+ }
+
+ /**
+ * Call it when a test class is finished.
+ */
+ public void onClassFinished(Description classDescription) {
+ int passed = 0;
+ int skipped = 0;
+ int failed = 0;
+ var stats = mStats.get(classDescription);
+ if (stats == null) {
+ return;
+ }
+ for (var e : stats.values()) {
+ switch (e) {
+ case Passed: passed++; break;
+ case Skipped: skipped++; break;
+ case Failed: failed++; break;
+ }
+ }
+
+ var testClass = extractTestClass(classDescription);
+
+ mOutputWriter.printf("%s,%s,%s,%d,%d,%d\n",
+ mTestModuleName, (testClass == null ? "?" : testClass.getCanonicalName()),
+ classDescription, passed, failed, skipped);
+ mOutputWriter.flush();
+ }
+
+ /**
+ * Try to extract the class from a description, which is needed because
+ * ParameterizedAndroidJunit4's description doesn't contain a class.
+ */
+ private Class<?> extractTestClass(Description desc) {
+ if (desc.getTestClass() != null) {
+ return desc.getTestClass();
+ }
+ // Look into the children.
+ for (var child : desc.getChildren()) {
+ var fromChild = extractTestClass(child);
+ if (fromChild != null) {
+ return fromChild;
+ }
+ }
+ return null;
+ }
+}
diff --git a/ravenwood/junit-src/android/platform/test/annotations/DisabledOnNonRavenwood.java b/ravenwood/junit-src/android/platform/test/annotations/DisabledOnNonRavenwood.java
deleted file mode 100644
index 2fb8074..0000000
--- a/ravenwood/junit-src/android/platform/test/annotations/DisabledOnNonRavenwood.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2024 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.platform.test.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Tests marked with this annotation are only executed when running on Ravenwood, but not
- * on a device.
- *
- * This is basically equivalent to the opposite of {@link DisabledOnRavenwood}, but in order to
- * avoid complex structure, and there's no equivalent to the opposite {@link EnabledOnRavenwood},
- * which means if a test class has this annotation, you can't negate it in subclasses or
- * on a per-method basis.
- *
- * THIS ANNOTATION CANNOT BE ADDED TO CLASSES AT THIS PONINT.
- * See {@link com.android.ravenwoodtest.bivalenttest.RavenwoodClassRuleRavenwoodOnlyTest}
- * for the reason.
- *
- * The {@code RAVENWOOD_RUN_DISABLED_TESTS} environmental variable won't work because it won't be
- * propagated to the device. (We may support it in the future, possibly using a debug. sysprop.)
- *
- * @hide
- */
-@Inherited
-@Target({ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface DisabledOnNonRavenwood {
- /**
- * General free-form description of why this test is being ignored.
- */
- String reason() default "";
-}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/LargeTest.java b/ravenwood/junit-src/android/platform/test/annotations/NoRavenizer.java
similarity index 62%
rename from tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/LargeTest.java
rename to ravenwood/junit-src/android/platform/test/annotations/NoRavenizer.java
index 76bbcad..a84f16f 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/LargeTest.java
+++ b/ravenwood/junit-src/android/platform/test/annotations/NoRavenizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023 The Android Open Source Project
+ * Copyright (C) 2024 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.
@@ -13,16 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.hoststubgen.test.tinyframework;
+
+package android.platform.test.annotations;
import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * We don't want to use any android classes in this module, so we create our own copy of it here.
+ * Disable the ravenizer preprocessor for a class. This should be only used for testing
+ * ravenizer itself, or to workaround issues with the preprocessor. A test class probably won't run
+ * properly if it's not preprocessed.
+ *
+ * @hide
*/
+@Inherited
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
-public @interface LargeTest {}
+public @interface NoRavenizer {
+}
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java
new file mode 100644
index 0000000..5ba972df
--- /dev/null
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java
@@ -0,0 +1,733 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.ensureIsPublicVoidMethod;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.isOnRavenwood;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.util.Log;
+
+import org.junit.Assume;
+import org.junit.AssumptionViolatedException;
+import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runner.manipulation.Filterable;
+import org.junit.runner.manipulation.InvalidOrderingException;
+import org.junit.runner.manipulation.NoTestsRemainException;
+import org.junit.runner.manipulation.Orderable;
+import org.junit.runner.manipulation.Orderer;
+import org.junit.runner.manipulation.Sortable;
+import org.junit.runner.manipulation.Sorter;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runner.notification.StoppedByUserException;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.MultipleFailureException;
+import org.junit.runners.model.RunnerBuilder;
+import org.junit.runners.model.Statement;
+import org.junit.runners.model.TestClass;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Stack;
+import java.util.function.BiConsumer;
+
+/**
+ * A test runner used for Ravenwood.
+ *
+ * It will delegate to another runner specified with {@link InnerRunner}
+ * (default = {@link BlockJUnit4ClassRunner}) with the following features.
+ * - Add a {@link RavenwoodAwareTestRunnerHook#onRunnerInitializing} hook, which is called before
+ * the inner runner gets a chance to run. This can be used to initialize stuff used by the
+ * inner runner.
+ * - Add hook points, which are handed by RavenwoodAwareTestRunnerHook, with help from
+ * the four test rules such as {@link #sImplicitClassOuterRule}, which are also injected by
+ * the ravenizer tool.
+ *
+ * We use this runner to:
+ * - Initialize the bare minimum environmnet just to be enough to make the actual test runners
+ * happy.
+ * - Handle {@link android.platform.test.annotations.DisabledOnRavenwood}.
+ *
+ * This class is built such that it can also be used on a real device, but in that case
+ * it will basically just delegate to the inner wrapper, and won't do anything special.
+ * (no hooks, etc.)
+ */
+public final class RavenwoodAwareTestRunner extends Runner implements Filterable, Orderable {
+ public static final String TAG = "Ravenwood";
+
+ @Inherited
+ @Target({TYPE})
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface InnerRunner {
+ Class<? extends Runner> value();
+ }
+
+ /**
+ * An annotation similar to JUnit's BeforeClass, but this gets executed before
+ * the inner runner is instantiated, and only on Ravenwood.
+ * It can be used to initialize what's needed by the inner runner.
+ */
+ @Target({METHOD})
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface RavenwoodTestRunnerInitializing {
+ }
+
+ /** Scope of a hook. */
+ public enum Scope {
+ Class,
+ Instance,
+ }
+
+ /** Order of a hook. */
+ public enum Order {
+ Outer,
+ Inner,
+ }
+
+ // The following four rule instances will be injected to tests by the Ravenizer tool.
+ private static class RavenwoodClassOuterRule implements TestRule {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return getCurrentRunner().wrapWithHooks(base, description, Scope.Class, Order.Outer);
+ }
+ }
+
+ private static class RavenwoodClassInnerRule implements TestRule {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return getCurrentRunner().wrapWithHooks(base, description, Scope.Class, Order.Inner);
+ }
+ }
+
+ private static class RavenwoodInstanceOuterRule implements TestRule {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return getCurrentRunner().wrapWithHooks(
+ base, description, Scope.Instance, Order.Outer);
+ }
+ }
+
+ private static class RavenwoodInstanceInnerRule implements TestRule {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return getCurrentRunner().wrapWithHooks(
+ base, description, Scope.Instance, Order.Inner);
+ }
+ }
+
+ public static final TestRule sImplicitClassOuterRule = new RavenwoodClassOuterRule();
+ public static final TestRule sImplicitClassInnerRule = new RavenwoodClassInnerRule();
+ public static final TestRule sImplicitInstOuterRule = new RavenwoodInstanceOuterRule();
+ public static final TestRule sImplicitInstInnerRule = new RavenwoodInstanceOuterRule();
+
+ public static final String IMPLICIT_CLASS_OUTER_RULE_NAME = "sImplicitClassOuterRule";
+ public static final String IMPLICIT_CLASS_INNER_RULE_NAME = "sImplicitClassInnerRule";
+ public static final String IMPLICIT_INST_OUTER_RULE_NAME = "sImplicitInstOuterRule";
+ public static final String IMPLICIT_INST_INNER_RULE_NAME = "sImplicitInstInnerRule";
+
+ /** Keeps track of the runner on the current thread. */
+ private static final ThreadLocal<RavenwoodAwareTestRunner> sCurrentRunner = new ThreadLocal<>();
+
+ static RavenwoodAwareTestRunner getCurrentRunner() {
+ var runner = sCurrentRunner.get();
+ if (runner == null) {
+ throw new RuntimeException("Current test runner not set!");
+ }
+ return runner;
+ }
+
+ private final Class<?> mTestJavaClass;
+ private TestClass mTestClass = null;
+ private Runner mRealRunner = null;
+ private Description mDescription = null;
+ private Throwable mExceptionInConstructor = null;
+ private boolean mRealRunnerTakesRunnerBuilder = false;
+
+ /**
+ * Stores internal states / methods associated with this runner that's only needed in
+ * junit-impl.
+ */
+ final RavenwoodRunnerState mState = new RavenwoodRunnerState(this);
+
+ private Error logAndFail(String message, Throwable exception) {
+ Log.e(TAG, message, exception);
+ throw new AssertionError(message, exception);
+ }
+
+ public TestClass getTestClass() {
+ return mTestClass;
+ }
+
+ /**
+ * Constructor.
+ */
+ public RavenwoodAwareTestRunner(Class<?> testClass) {
+ mTestJavaClass = testClass;
+ try {
+ performGlobalInitialization();
+
+ /*
+ * If the class has @DisabledOnRavenwood, then we'll delegate to
+ * ClassSkippingTestRunner, which simply skips it.
+ *
+ * We need to do it before instantiating TestClass for b/367694651.
+ */
+ if (isOnRavenwood() && !RavenwoodAwareTestRunnerHook.shouldRunClassOnRavenwood(
+ testClass)) {
+ mRealRunner = new ClassSkippingTestRunner(testClass);
+ mDescription = mRealRunner.getDescription();
+ return;
+ }
+
+ mTestClass = new TestClass(testClass);
+
+ Log.v(TAG, "RavenwoodAwareTestRunner starting for " + testClass.getCanonicalName());
+
+ onRunnerInitializing();
+
+ // Find the real runner.
+ final Class<? extends Runner> realRunnerClass;
+ final InnerRunner innerRunnerAnnotation = mTestClass.getAnnotation(InnerRunner.class);
+ if (innerRunnerAnnotation != null) {
+ realRunnerClass = innerRunnerAnnotation.value();
+ } else {
+ // Default runner.
+ realRunnerClass = BlockJUnit4ClassRunner.class;
+ }
+
+ try {
+ Log.i(TAG, "Initializing the inner runner: " + realRunnerClass);
+
+ mRealRunner = instantiateRealRunner(realRunnerClass, testClass);
+ mDescription = mRealRunner.getDescription();
+
+ } catch (InstantiationException | IllegalAccessException
+ | InvocationTargetException | NoSuchMethodException e) {
+ throw logAndFail("Failed to instantiate " + realRunnerClass, e);
+ }
+ } catch (Throwable th) {
+ // If we throw in the constructor, Tradefed may not report it and just ignore the class,
+ // so record it and throw it when the test actually started.
+ Log.e(TAG, "Fatal: Exception detected in constructor", th);
+ mExceptionInConstructor = new RuntimeException("Exception detected in constructor",
+ th);
+ mDescription = Description.createTestDescription(testClass, "Constructor");
+
+ // This is for testing if tradefed is fixed.
+ if ("1".equals(System.getenv("RAVENWOOD_THROW_EXCEPTION_IN_TEST_RUNNER"))) {
+ throw th;
+ }
+ }
+ }
+
+ private Runner instantiateRealRunner(
+ Class<? extends Runner> realRunnerClass,
+ Class<?> testClass)
+ throws NoSuchMethodException, InvocationTargetException, InstantiationException,
+ IllegalAccessException {
+ try {
+ return realRunnerClass.getConstructor(Class.class).newInstance(testClass);
+ } catch (NoSuchMethodException e) {
+ var constructor = realRunnerClass.getConstructor(Class.class, RunnerBuilder.class);
+ mRealRunnerTakesRunnerBuilder = true;
+ return constructor.newInstance(testClass, new AllDefaultPossibilitiesBuilder());
+ }
+ }
+
+ private void performGlobalInitialization() {
+ if (!isOnRavenwood()) {
+ return;
+ }
+ RavenwoodAwareTestRunnerHook.performGlobalInitialization();
+ }
+
+ /**
+ * Run the bare minimum setup to initialize the wrapped runner.
+ */
+ // This method is called by the ctor, so never make it virtual.
+ private void onRunnerInitializing() {
+ if (!isOnRavenwood()) {
+ return;
+ }
+
+ RavenwoodAwareTestRunnerHook.onRunnerInitializing(this, mTestClass);
+
+ // Hook point to allow more customization.
+ runAnnotatedMethodsOnRavenwood(RavenwoodTestRunnerInitializing.class, null);
+ }
+
+ private void runAnnotatedMethodsOnRavenwood(Class<? extends Annotation> annotationClass,
+ Object instance) {
+ if (!isOnRavenwood()) {
+ return;
+ }
+ Log.v(TAG, "runAnnotatedMethodsOnRavenwood() " + annotationClass.getName());
+
+ for (var method : getTestClass().getAnnotatedMethods(annotationClass)) {
+ ensureIsPublicVoidMethod(method.getMethod(), /* isStatic=*/ instance == null);
+
+ var methodDesc = method.getDeclaringClass().getName() + "."
+ + method.getMethod().toString();
+ try {
+ method.getMethod().invoke(instance);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw logAndFail("Caught exception while running method " + methodDesc, e);
+ }
+ }
+ }
+
+ @Override
+ public Description getDescription() {
+ return mDescription;
+ }
+
+ @Override
+ public void run(RunNotifier realNotifier) {
+ final RavenwoodRunNotifier notifier = new RavenwoodRunNotifier(realNotifier);
+
+ if (mRealRunner instanceof ClassSkippingTestRunner) {
+ mRealRunner.run(notifier);
+ RavenwoodAwareTestRunnerHook.onClassSkipped(getDescription());
+ return;
+ }
+
+ Log.v(TAG, "Starting " + mTestJavaClass.getCanonicalName());
+ if (RAVENWOOD_VERBOSE_LOGGING) {
+ dumpDescription(getDescription());
+ }
+
+ if (maybeReportExceptionFromConstructor(notifier)) {
+ return;
+ }
+
+ // TODO(b/365976974): handle nested classes better
+ final boolean skipRunnerHook =
+ mRealRunnerTakesRunnerBuilder && mRealRunner instanceof Suite;
+
+ sCurrentRunner.set(this);
+ try {
+ if (!skipRunnerHook) {
+ try {
+ RavenwoodAwareTestRunnerHook.onBeforeInnerRunnerStart(
+ this, getDescription());
+ } catch (Throwable th) {
+ notifier.reportBeforeTestFailure(getDescription(), th);
+ return;
+ }
+ }
+
+ // Delegate to the inner runner.
+ mRealRunner.run(notifier);
+ } finally {
+ sCurrentRunner.remove();
+
+ if (!skipRunnerHook) {
+ try {
+ RavenwoodAwareTestRunnerHook.onAfterInnerRunnerFinished(
+ this, getDescription());
+ } catch (Throwable th) {
+ notifier.reportAfterTestFailure(th);
+ }
+ }
+ }
+ }
+
+ /** Throw the exception detected in the constructor, if any. */
+ private boolean maybeReportExceptionFromConstructor(RunNotifier notifier) {
+ if (mExceptionInConstructor == null) {
+ return false;
+ }
+ notifier.fireTestStarted(mDescription);
+ notifier.fireTestFailure(new Failure(mDescription, mExceptionInConstructor));
+ notifier.fireTestFinished(mDescription);
+
+ return true;
+ }
+
+ @Override
+ public void filter(Filter filter) throws NoTestsRemainException {
+ if (mRealRunner instanceof Filterable r) {
+ r.filter(filter);
+ }
+ }
+
+ @Override
+ public void order(Orderer orderer) throws InvalidOrderingException {
+ if (mRealRunner instanceof Orderable r) {
+ r.order(orderer);
+ }
+ }
+
+ @Override
+ public void sort(Sorter sorter) {
+ if (mRealRunner instanceof Sortable r) {
+ r.sort(sorter);
+ }
+ }
+
+ private Statement wrapWithHooks(Statement base, Description description, Scope scope,
+ Order order) {
+ if (!isOnRavenwood()) {
+ return base;
+ }
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ runWithHooks(description, scope, order, base);
+ }
+ };
+ }
+
+ private void runWithHooks(Description description, Scope scope, Order order, Runnable r)
+ throws Throwable {
+ runWithHooks(description, scope, order, new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ r.run();
+ }
+ });
+ }
+
+ private void runWithHooks(Description description, Scope scope, Order order, Statement s)
+ throws Throwable {
+ if (isOnRavenwood()) {
+ Assume.assumeTrue(
+ RavenwoodAwareTestRunnerHook.onBefore(this, description, scope, order));
+ }
+ try {
+ s.evaluate();
+ if (isOnRavenwood()) {
+ RavenwoodAwareTestRunnerHook.onAfter(this, description, scope, order, null);
+ }
+ } catch (Throwable t) {
+ boolean shouldThrow = true;
+ if (isOnRavenwood()) {
+ shouldThrow = RavenwoodAwareTestRunnerHook.onAfter(
+ this, description, scope, order, t);
+ }
+ if (shouldThrow) {
+ throw t;
+ }
+ }
+ }
+
+ /**
+ * A runner that simply skips a class. It still has to support {@link Filterable}
+ * because otherwise the result still says "SKIPPED" even when it's not included in the
+ * filter.
+ */
+ private static class ClassSkippingTestRunner extends Runner implements Filterable {
+ private final Description mDescription;
+ private boolean mFilteredOut;
+
+ ClassSkippingTestRunner(Class<?> testClass) {
+ mDescription = Description.createTestDescription(testClass, testClass.getSimpleName());
+ mFilteredOut = false;
+ }
+
+ @Override
+ public Description getDescription() {
+ return mDescription;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ if (mFilteredOut) {
+ return;
+ }
+ notifier.fireTestSuiteStarted(mDescription);
+ notifier.fireTestIgnored(mDescription);
+ notifier.fireTestSuiteFinished(mDescription);
+ }
+
+ @Override
+ public void filter(Filter filter) throws NoTestsRemainException {
+ if (filter.shouldRun(mDescription)) {
+ mFilteredOut = false;
+ } else {
+ throw new NoTestsRemainException();
+ }
+ }
+ }
+
+ private void dumpDescription(Description desc) {
+ dumpDescription(desc, "[TestDescription]=", " ");
+ }
+
+ private void dumpDescription(Description desc, String header, String indent) {
+ Log.v(TAG, indent + header + desc);
+
+ var children = desc.getChildren();
+ var childrenIndent = " " + indent;
+ for (int i = 0; i < children.size(); i++) {
+ dumpDescription(children.get(i), "#" + i + ": ", childrenIndent);
+ }
+ }
+
+ /**
+ * A run notifier that wraps another notifier and provides the following features:
+ * - Handle a failure that happened before testStarted and testEnded (typically that means
+ * it's from @BeforeClass or @AfterClass, or a @ClassRule) and deliver it as if
+ * individual tests in the class reported it. This is for b/364395552.
+ *
+ * - Logging.
+ */
+ private class RavenwoodRunNotifier extends RunNotifier {
+ private final RunNotifier mRealNotifier;
+
+ private final Stack<Description> mSuiteStack = new Stack<>();
+ private Description mCurrentSuite = null;
+ private final ArrayList<Throwable> mOutOfTestFailures = new ArrayList<>();
+
+ private boolean mBeforeTest = true;
+ private boolean mAfterTest = false;
+
+ private RavenwoodRunNotifier(RunNotifier realNotifier) {
+ mRealNotifier = realNotifier;
+ }
+
+ private boolean isInTest() {
+ return !mBeforeTest && !mAfterTest;
+ }
+
+ @Override
+ public void addListener(RunListener listener) {
+ mRealNotifier.addListener(listener);
+ }
+
+ @Override
+ public void removeListener(RunListener listener) {
+ mRealNotifier.removeListener(listener);
+ }
+
+ @Override
+ public void addFirstListener(RunListener listener) {
+ mRealNotifier.addFirstListener(listener);
+ }
+
+ @Override
+ public void fireTestRunStarted(Description description) {
+ Log.i(TAG, "testRunStarted: " + description);
+ mRealNotifier.fireTestRunStarted(description);
+ }
+
+ @Override
+ public void fireTestRunFinished(Result result) {
+ Log.i(TAG, "testRunFinished: "
+ + result.getRunCount() + ","
+ + result.getFailureCount() + ","
+ + result.getAssumptionFailureCount() + ","
+ + result.getIgnoreCount());
+ mRealNotifier.fireTestRunFinished(result);
+ }
+
+ @Override
+ public void fireTestSuiteStarted(Description description) {
+ Log.i(TAG, "testSuiteStarted: " + description);
+ mRealNotifier.fireTestSuiteStarted(description);
+
+ mBeforeTest = true;
+ mAfterTest = false;
+
+ // Keep track of the current suite, needed if the outer test is a Suite,
+ // in which case its children are test classes. (not test methods)
+ mCurrentSuite = description;
+ mSuiteStack.push(description);
+
+ mOutOfTestFailures.clear();
+ }
+
+ @Override
+ public void fireTestSuiteFinished(Description description) {
+ Log.i(TAG, "testSuiteFinished: " + description);
+ mRealNotifier.fireTestSuiteFinished(description);
+
+ maybeHandleOutOfTestFailures();
+
+ mBeforeTest = true;
+ mAfterTest = false;
+
+ // Restore the upper suite.
+ mSuiteStack.pop();
+ mCurrentSuite = mSuiteStack.size() == 0 ? null : mSuiteStack.peek();
+ }
+
+ @Override
+ public void fireTestStarted(Description description) throws StoppedByUserException {
+ Log.i(TAG, "testStarted: " + description);
+ mRealNotifier.fireTestStarted(description);
+
+ mAfterTest = false;
+ mBeforeTest = false;
+ }
+
+ @Override
+ public void fireTestFailure(Failure failure) {
+ Log.i(TAG, "testFailure: " + failure);
+
+ if (isInTest()) {
+ mRealNotifier.fireTestFailure(failure);
+ } else {
+ mOutOfTestFailures.add(failure.getException());
+ }
+ }
+
+ @Override
+ public void fireTestAssumptionFailed(Failure failure) {
+ Log.i(TAG, "testAssumptionFailed: " + failure);
+
+ if (isInTest()) {
+ mRealNotifier.fireTestAssumptionFailed(failure);
+ } else {
+ mOutOfTestFailures.add(failure.getException());
+ }
+ }
+
+ @Override
+ public void fireTestIgnored(Description description) {
+ Log.i(TAG, "testIgnored: " + description);
+ mRealNotifier.fireTestIgnored(description);
+ }
+
+ @Override
+ public void fireTestFinished(Description description) {
+ Log.i(TAG, "testFinished: " + description);
+ mRealNotifier.fireTestFinished(description);
+
+ mAfterTest = true;
+ }
+
+ @Override
+ public void pleaseStop() {
+ Log.w(TAG, "pleaseStop:");
+ mRealNotifier.pleaseStop();
+ }
+
+ /**
+ * At the end of each Suite, we handle failures happened out of test methods.
+ * (typically in @BeforeClass or @AfterClasses)
+ *
+ * This is to work around b/364395552.
+ */
+ private boolean maybeHandleOutOfTestFailures() {
+ if (mOutOfTestFailures.size() == 0) {
+ return false;
+ }
+ Throwable th;
+ if (mOutOfTestFailures.size() == 1) {
+ th = mOutOfTestFailures.get(0);
+ } else {
+ th = new MultipleFailureException(mOutOfTestFailures);
+ }
+ if (mBeforeTest) {
+ reportBeforeTestFailure(mCurrentSuite, th);
+ return true;
+ }
+ if (mAfterTest) {
+ reportAfterTestFailure(th);
+ return true;
+ }
+ return false;
+ }
+
+ public void reportBeforeTestFailure(Description suiteDesc, Throwable th) {
+ // If a failure happens befere running any tests, we'll need to pretend
+ // as if each test in the suite reported the failure, to work around b/364395552.
+ for (var child : suiteDesc.getChildren()) {
+ if (child.isSuite()) {
+ // If the chiil is still a "parent" -- a test class or a test suite
+ // -- propagate to its children.
+ mRealNotifier.fireTestSuiteStarted(child);
+ reportBeforeTestFailure(child, th);
+ mRealNotifier.fireTestSuiteFinished(child);
+ } else {
+ mRealNotifier.fireTestStarted(child);
+ Failure f = new Failure(child, th);
+ if (th instanceof AssumptionViolatedException) {
+ mRealNotifier.fireTestAssumptionFailed(f);
+ } else {
+ mRealNotifier.fireTestFailure(f);
+ }
+ mRealNotifier.fireTestFinished(child);
+ }
+ }
+ }
+
+ public void reportAfterTestFailure(Throwable th) {
+ // Unfortunately, there's no good way to report it, so kill the own process.
+ onCriticalError(
+ "Failures detected in @AfterClass, which would be swallowed by tradefed",
+ th);
+ }
+ }
+
+ private static volatile BiConsumer<String, Throwable> sCriticalErrorHanler;
+
+ private void onCriticalError(@NonNull String message, @Nullable Throwable th) {
+ Log.e(TAG, "Critical error! " + message, th);
+ var handler = sCriticalErrorHanler;
+ if (handler == null) {
+ handler = sDefaultCriticalErrorHandler;
+ }
+ handler.accept(message, th);
+ }
+
+ private static BiConsumer<String, Throwable> sDefaultCriticalErrorHandler = (message, th) -> {
+ Log.e(TAG, "Ravenwood cannot continue. Killing self process.", th);
+ System.exit(1);
+ };
+
+ /**
+ * Contains Ravenwood private APIs.
+ */
+ public static class RavenwoodPrivate {
+ private RavenwoodPrivate() {
+ }
+
+ /**
+ * Set a listener for onCriticalError(), for testing. If a listener is set, we won't call
+ * System.exit().
+ */
+ public void setCriticalErrorHandler(
+ @Nullable BiConsumer<String, Throwable> handler) {
+ sCriticalErrorHanler = handler;
+ }
+ }
+
+ private static final RavenwoodPrivate sRavenwoodPrivate = new RavenwoodPrivate();
+
+ public static RavenwoodPrivate private$ravenwood() {
+ return sRavenwoodPrivate;
+ }
+}
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodClassRule.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodClassRule.java
index f4b7ec36..85297fe 100644
--- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodClassRule.java
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodClassRule.java
@@ -16,42 +16,20 @@
package android.platform.test.ravenwood;
-import static android.platform.test.ravenwood.RavenwoodRule.ENABLE_PROBE_IGNORED;
-import static android.platform.test.ravenwood.RavenwoodRule.IS_ON_RAVENWOOD;
-import static android.platform.test.ravenwood.RavenwoodRule.shouldEnableOnDevice;
-import static android.platform.test.ravenwood.RavenwoodRule.shouldEnableOnRavenwood;
-import static android.platform.test.ravenwood.RavenwoodRule.shouldStillIgnoreInProbeIgnoreMode;
-
-import android.platform.test.annotations.DisabledOnRavenwood;
-import android.platform.test.annotations.EnabledOnRavenwood;
-
-import org.junit.Assert;
-import org.junit.Assume;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
/**
- * {@code @ClassRule} that respects Ravenwood-specific class annotations. This rule has no effect
- * when tests are run on non-Ravenwood test environments.
+ * No longer needed.
*
- * By default, all tests are executed on Ravenwood, but annotations such as
- * {@link DisabledOnRavenwood} and {@link EnabledOnRavenwood} can be used at both the method
- * and class level to "ignore" tests that may not be ready.
+ * @deprecated this class used to be used to handle the class level annotation, which
+ * is now done by the test runner, so this class is not needed.
*/
+@Deprecated
public class RavenwoodClassRule implements TestRule {
@Override
public Statement apply(Statement base, Description description) {
- if (!IS_ON_RAVENWOOD) {
- // This should be "Assume", not Assert, but if we use assume here, the device side
- // test runner would complain.
- // See the TODO comment in RavenwoodClassRuleRavenwoodOnlyTest.
- Assert.assertTrue(shouldEnableOnDevice(description));
- } else if (ENABLE_PROBE_IGNORED) {
- Assume.assumeFalse(shouldStillIgnoreInProbeIgnoreMode(description));
- } else {
- Assume.assumeTrue(shouldEnableOnRavenwood(description));
- }
return base;
}
}
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java
new file mode 100644
index 0000000..446f819
--- /dev/null
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import static android.os.Process.FIRST_APPLICATION_UID;
+import static android.os.Process.SYSTEM_UID;
+import static android.os.UserHandle.SYSTEM;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.Instrumentation;
+import android.content.Context;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Represents how to configure the ravenwood environment for a test class.
+ *
+ * If a ravenwood test class has a public static field with the {@link Config} annotation,
+ * Ravenwood will extract the config from it and initializes the environment. The type of the
+ * field must be of {@link RavenwoodConfig}.
+ */
+public final class RavenwoodConfig {
+ /**
+ * Use this to mark a field as the configuration.
+ * @hide
+ */
+ @Target({ElementType.FIELD})
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Config {
+ }
+
+ private static final int NOBODY_UID = 9999;
+
+ private static final AtomicInteger sNextPid = new AtomicInteger(100);
+
+ int mCurrentUser = SYSTEM.getIdentifier();
+
+ /**
+ * Unless the test author requests differently, run as "nobody", and give each collection of
+ * tests its own unique PID.
+ */
+ int mUid = NOBODY_UID;
+ int mPid = sNextPid.getAndIncrement();
+
+ String mTestPackageName;
+ String mTargetPackageName;
+
+ int mMinSdkLevel;
+
+ boolean mProvideMainThread = false;
+
+ final RavenwoodSystemProperties mSystemProperties = new RavenwoodSystemProperties();
+
+ final List<Class<?>> mServicesRequired = new ArrayList<>();
+
+ volatile Context mInstContext;
+ volatile Context mTargetContext;
+ volatile Instrumentation mInstrumentation;
+
+ /**
+ * Stores internal states / methods associated with this config that's only needed in
+ * junit-impl.
+ */
+ final RavenwoodConfigState mState = new RavenwoodConfigState(this);
+ private RavenwoodConfig() {
+ }
+
+ /**
+ * Return if the current process is running on a Ravenwood test environment.
+ */
+ public static boolean isOnRavenwood() {
+ return RavenwoodRule.isOnRavenwood();
+ }
+
+ private void setDefaults() {
+ if (mTargetPackageName == null) {
+ mTargetPackageName = mTestPackageName;
+ }
+ }
+
+ public static class Builder {
+ private final RavenwoodConfig mConfig = new RavenwoodConfig();
+
+ public Builder() {
+ }
+
+ /**
+ * Configure the identity of this process to be the system UID for the duration of the
+ * test. Has no effect on non-Ravenwood environments.
+ */
+ public Builder setProcessSystem() {
+ mConfig.mUid = SYSTEM_UID;
+ return this;
+ }
+
+ /**
+ * Configure the identity of this process to be an app UID for the duration of the
+ * test. Has no effect on non-Ravenwood environments.
+ */
+ public Builder setProcessApp() {
+ mConfig.mUid = FIRST_APPLICATION_UID;
+ return this;
+ }
+
+ /**
+ * Configure the package name of the test, which corresponds to
+ * {@link Instrumentation#getContext()}.
+ */
+ public Builder setPackageName(@NonNull String packageName) {
+ mConfig.mTestPackageName = Objects.requireNonNull(packageName);
+ return this;
+ }
+
+ /**
+ * Configure the package name of the target app, which corresponds to
+ * {@link Instrumentation#getTargetContext()}. Defaults to {@link #setPackageName}.
+ */
+ public Builder setTargetPackageName(@NonNull String packageName) {
+ mConfig.mTargetPackageName = Objects.requireNonNull(packageName);
+ return this;
+ }
+
+ /**
+ * Configure the min SDK level of the test.
+ */
+ public Builder setMinSdkLevel(int sdkLevel) {
+ mConfig.mMinSdkLevel = sdkLevel;
+ return this;
+ }
+
+ /**
+ * Configure a "main" thread to be available for the duration of the test, as defined
+ * by {@code Looper.getMainLooper()}. Has no effect on non-Ravenwood environments.
+ */
+ public Builder setProvideMainThread(boolean provideMainThread) {
+ mConfig.mProvideMainThread = provideMainThread;
+ return this;
+ }
+
+ /**
+ * Configure the given system property as immutable for the duration of the test.
+ * Read access to the key is allowed, and write access will fail. When {@code value} is
+ * {@code null}, the value is left as undefined.
+ *
+ * All properties in the {@code debug.*} namespace are automatically mutable, with no
+ * developer action required.
+ *
+ * Has no effect on non-Ravenwood environments.
+ */
+ public Builder setSystemPropertyImmutable(@NonNull String key,
+ @Nullable Object value) {
+ mConfig.mSystemProperties.setValue(key, value);
+ mConfig.mSystemProperties.setAccessReadOnly(key);
+ return this;
+ }
+
+ /**
+ * Configure the given system property as mutable for the duration of the test.
+ * Both read and write access to the key is allowed, and its value will be reset between
+ * each test. When {@code value} is {@code null}, the value is left as undefined.
+ *
+ * All properties in the {@code debug.*} namespace are automatically mutable, with no
+ * developer action required.
+ *
+ * Has no effect on non-Ravenwood environments.
+ */
+ public Builder setSystemPropertyMutable(@NonNull String key,
+ @Nullable Object value) {
+ mConfig.mSystemProperties.setValue(key, value);
+ mConfig.mSystemProperties.setAccessReadWrite(key);
+ return this;
+ }
+
+ /**
+ * Configure the set of system services that are required for this test to operate.
+ *
+ * For example, passing {@code android.hardware.SerialManager.class} as an argument will
+ * ensure that the underlying service is created, initialized, and ready to use for the
+ * duration of the test. The {@code SerialManager} instance can be obtained via
+ * {@code RavenwoodRule.getContext()} and {@code Context.getSystemService()}, and
+ * {@code SerialManagerInternal} can be obtained via {@code LocalServices.getService()}.
+ */
+ public Builder setServicesRequired(@NonNull Class<?>... services) {
+ mConfig.mServicesRequired.clear();
+ for (Class<?> service : services) {
+ mConfig.mServicesRequired.add(service);
+ }
+ return this;
+ }
+
+ public RavenwoodConfig build() {
+ mConfig.setDefaults();
+ return mConfig;
+ }
+ }
+}
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
index 825c91a..4196d8e 100644
--- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
@@ -16,56 +16,43 @@
package android.platform.test.ravenwood;
-import static android.os.Process.FIRST_APPLICATION_UID;
-import static android.os.Process.SYSTEM_UID;
-import static android.os.UserHandle.SYSTEM;
+import static com.android.ravenwood.common.RavenwoodCommonUtils.log;
-import static org.junit.Assert.fail;
-
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.app.Instrumentation;
import android.content.Context;
-import android.platform.test.annotations.DisabledOnNonRavenwood;
import android.platform.test.annotations.DisabledOnRavenwood;
-import android.platform.test.annotations.EnabledOnRavenwood;
-import android.platform.test.annotations.IgnoreUnderRavenwood;
import com.android.ravenwood.common.RavenwoodCommonUtils;
-import org.junit.Assume;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Objects;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
/**
- * {@code @Rule} that configures the Ravenwood test environment. This rule has no effect when
- * tests are run on non-Ravenwood test environments.
- *
- * This rule initializes and resets the Ravenwood environment between each test method to offer a
- * hermetic testing environment.
- *
- * By default, all tests are executed on Ravenwood, but annotations such as
- * {@link DisabledOnRavenwood} and {@link EnabledOnRavenwood} can be used at both the method
- * and class level to "ignore" tests that may not be ready. When needed, a
- * {@link RavenwoodClassRule} can be used in addition to a {@link RavenwoodRule} to ignore tests
- * before a test class is fully initialized.
+ * @deprecated Use {@link RavenwoodConfig} to configure the ravenwood environment instead.
+ * A {@link RavenwoodRule} is no longer needed for {@link DisabledOnRavenwood}. To get the
+ * {@link Context} and {@link Instrumentation}, use
+ * {@link androidx.test.platform.app.InstrumentationRegistry} instead.
*/
-public class RavenwoodRule implements TestRule {
+@Deprecated
+public final class RavenwoodRule implements TestRule {
+ private static final String TAG = "RavenwoodRule";
+
static final boolean IS_ON_RAVENWOOD = RavenwoodCommonUtils.isOnRavenwood();
/**
- * When probing is enabled, all tests will be unconditionally run on Ravenwood to detect
- * cases where a test is able to pass despite being marked as {@code IgnoreUnderRavenwood}.
+ * When this flag is enabled, all tests will be unconditionally run on Ravenwood to detect
+ * cases where a test is able to pass despite being marked as {@link DisabledOnRavenwood}.
*
* This is typically helpful for internal maintainers discovering tests that had previously
* been ignored, but now have enough Ravenwood-supported functionality to be enabled.
*/
- static final boolean ENABLE_PROBE_IGNORED = "1".equals(
+ private static final boolean RUN_DISABLED_TESTS = "1".equals(
System.getenv("RAVENWOOD_RUN_DISABLED_TESTS"));
/**
@@ -90,56 +77,34 @@
*
* Because we use a regex-find, setting "." would disable all tests.
*/
- private static final Pattern REALLY_DISABLE_PATTERN = Pattern.compile(
- Objects.requireNonNullElse(System.getenv("RAVENWOOD_REALLY_DISABLE"), ""));
+ private static final Pattern REALLY_DISABLED_PATTERN = Pattern.compile(
+ Objects.requireNonNullElse(System.getenv("RAVENWOOD_REALLY_DISABLED"), ""));
- private static final boolean ENABLE_REALLY_DISABLE_PATTERN =
- !REALLY_DISABLE_PATTERN.pattern().isEmpty();
-
- /**
- * If true, enable optional validation on running tests.
- */
- private static final boolean ENABLE_OPTIONAL_VALIDATION = "1".equals(
- System.getenv("RAVENWOOD_OPTIONAL_VALIDATION"));
+ private static final boolean HAS_REALLY_DISABLE_PATTERN =
+ !REALLY_DISABLED_PATTERN.pattern().isEmpty();
static {
- if (ENABLE_PROBE_IGNORED) {
- System.out.println("$RAVENWOOD_RUN_DISABLED_TESTS enabled: force running all tests");
- if (ENABLE_REALLY_DISABLE_PATTERN) {
- System.out.println("$RAVENWOOD_REALLY_DISABLE=" + REALLY_DISABLE_PATTERN.pattern());
+ if (RUN_DISABLED_TESTS) {
+ log(TAG, "$RAVENWOOD_RUN_DISABLED_TESTS enabled: force running all tests");
+ if (HAS_REALLY_DISABLE_PATTERN) {
+ log(TAG, "$RAVENWOOD_REALLY_DISABLED=" + REALLY_DISABLED_PATTERN.pattern());
}
}
}
- private static final int NOBODY_UID = 9999;
-
- private static final AtomicInteger sNextPid = new AtomicInteger(100);
-
- int mCurrentUser = SYSTEM.getIdentifier();
-
- /**
- * Unless the test author requests differently, run as "nobody", and give each collection of
- * tests its own unique PID.
- */
- int mUid = NOBODY_UID;
- int mPid = sNextPid.getAndIncrement();
-
- String mPackageName;
-
- boolean mProvideMainThread = false;
-
- final RavenwoodSystemProperties mSystemProperties = new RavenwoodSystemProperties();
-
- final List<Class<?>> mServicesRequired = new ArrayList<>();
-
- volatile Context mContext;
- volatile Instrumentation mInstrumentation;
+ private final RavenwoodConfig mConfiguration;
public RavenwoodRule() {
+ mConfiguration = new RavenwoodConfig.Builder().build();
+ }
+
+ private RavenwoodRule(RavenwoodConfig config) {
+ mConfiguration = config;
}
public static class Builder {
- private RavenwoodRule mRule = new RavenwoodRule();
+ private final RavenwoodConfig.Builder mBuilder =
+ new RavenwoodConfig.Builder();
public Builder() {
}
@@ -149,7 +114,7 @@
* test. Has no effect on non-Ravenwood environments.
*/
public Builder setProcessSystem() {
- mRule.mUid = SYSTEM_UID;
+ mBuilder.setProcessSystem();
return this;
}
@@ -158,7 +123,7 @@
* test. Has no effect on non-Ravenwood environments.
*/
public Builder setProcessApp() {
- mRule.mUid = FIRST_APPLICATION_UID;
+ mBuilder.setProcessApp();
return this;
}
@@ -166,8 +131,8 @@
* Configure the identity of this process to be the given package name for the duration
* of the test. Has no effect on non-Ravenwood environments.
*/
- public Builder setPackageName(/* @NonNull */ String packageName) {
- mRule.mPackageName = Objects.requireNonNull(packageName);
+ public Builder setPackageName(@NonNull String packageName) {
+ mBuilder.setPackageName(packageName);
return this;
}
@@ -176,7 +141,7 @@
* by {@code Looper.getMainLooper()}. Has no effect on non-Ravenwood environments.
*/
public Builder setProvideMainThread(boolean provideMainThread) {
- mRule.mProvideMainThread = provideMainThread;
+ mBuilder.setProvideMainThread(provideMainThread);
return this;
}
@@ -190,10 +155,8 @@
*
* Has no effect on non-Ravenwood environments.
*/
- public Builder setSystemPropertyImmutable(/* @NonNull */ String key,
- /* @Nullable */ Object value) {
- mRule.mSystemProperties.setValue(key, value);
- mRule.mSystemProperties.setAccessReadOnly(key);
+ public Builder setSystemPropertyImmutable(@NonNull String key, @Nullable Object value) {
+ mBuilder.setSystemPropertyImmutable(key, value);
return this;
}
@@ -207,10 +170,8 @@
*
* Has no effect on non-Ravenwood environments.
*/
- public Builder setSystemPropertyMutable(/* @NonNull */ String key,
- /* @Nullable */ Object value) {
- mRule.mSystemProperties.setValue(key, value);
- mRule.mSystemProperties.setAccessReadWrite(key);
+ public Builder setSystemPropertyMutable(@NonNull String key, @Nullable Object value) {
+ mBuilder.setSystemPropertyMutable(key, value);
return this;
}
@@ -223,16 +184,13 @@
* {@code RavenwoodRule.getContext()} and {@code Context.getSystemService()}, and
* {@code SerialManagerInternal} can be obtained via {@code LocalServices.getService()}.
*/
- public Builder setServicesRequired(Class<?>... services) {
- mRule.mServicesRequired.clear();
- for (Class<?> service : services) {
- mRule.mServicesRequired.add(service);
- }
+ public Builder setServicesRequired(@NonNull Class<?>... services) {
+ mBuilder.setServicesRequired(services);
return this;
}
public RavenwoodRule build() {
- return mRule;
+ return new RavenwoodRule(mBuilder.build());
}
}
@@ -252,184 +210,50 @@
}
/**
- * Return a {@code Context} available for usage during the currently running test case.
- *
- * Each test should obtain needed information or references via this method;
- * references must not be stored beyond the scope of a test case.
+ * @deprecated Use
+ * {@code androidx.test.platform.app.InstrumentationRegistry.getInstrumentation().getContext()}
+ * instead.
*/
+ @Deprecated
public Context getContext() {
- return Objects.requireNonNull(mContext,
+ return Objects.requireNonNull(mConfiguration.mInstContext,
"Context is only available during @Test execution");
}
/**
- * Return a {@code Instrumentation} available for usage during the currently running test case.
- *
- * Each test should obtain needed information or references via this method;
- * references must not be stored beyond the scope of a test case.
+ * @deprecated Use
+ * {@code androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()}
+ * instead.
*/
+ @Deprecated
public Instrumentation getInstrumentation() {
- return Objects.requireNonNull(mInstrumentation,
+ return Objects.requireNonNull(mConfiguration.mInstrumentation,
"Instrumentation is only available during @Test execution");
}
- static boolean shouldEnableOnDevice(Description description) {
- if (description.isTest()) {
- if (description.getAnnotation(DisabledOnNonRavenwood.class) != null) {
- return false;
- }
- }
- final var clazz = description.getTestClass();
- if (clazz != null) {
- if (clazz.getAnnotation(DisabledOnNonRavenwood.class) != null) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Determine if the given {@link Description} should be enabled when running on the
- * Ravenwood test environment.
- *
- * A more specific method-level annotation always takes precedence over any class-level
- * annotation, and an {@link EnabledOnRavenwood} annotation always takes precedence over
- * an {@link DisabledOnRavenwood} annotation.
- */
- static boolean shouldEnableOnRavenwood(Description description) {
- // First, consult any method-level annotations
- if (description.isTest()) {
- // Stopgap for http://g/ravenwood/EPAD-N5ntxM
- if (description.getMethodName().endsWith("$noRavenwood")) {
- return false;
- }
- if (description.getAnnotation(EnabledOnRavenwood.class) != null) {
- return true;
- }
- if (description.getAnnotation(DisabledOnRavenwood.class) != null) {
- return false;
- }
- if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) {
- return false;
- }
- }
-
- // Otherwise, consult any class-level annotations
- final var clazz = description.getTestClass();
- if (clazz != null) {
- if (description.getTestClass().getAnnotation(EnabledOnRavenwood.class) != null) {
- return true;
- }
- if (description.getTestClass().getAnnotation(DisabledOnRavenwood.class) != null) {
- return false;
- }
- if (description.getTestClass().getAnnotation(IgnoreUnderRavenwood.class) != null) {
- return false;
- }
- }
-
- // When no annotations have been requested, assume test should be included
- return true;
- }
-
- static boolean shouldStillIgnoreInProbeIgnoreMode(Description description) {
- if (!ENABLE_REALLY_DISABLE_PATTERN) {
- return false;
- }
-
- final var fullname = description.getTestClass().getName()
- + (description.isTest() ? "#" + description.getMethodName() : "");
-
- if (REALLY_DISABLE_PATTERN.matcher(fullname).find()) {
- System.out.println("Still ignoring " + fullname);
- return true;
- }
- return false;
- }
-
@Override
public Statement apply(Statement base, Description description) {
- // No special treatment when running outside Ravenwood; run tests as-is
- if (!IS_ON_RAVENWOOD) {
- Assume.assumeTrue(shouldEnableOnDevice(description));
+ if (!RavenwoodConfig.isOnRavenwood()) {
return base;
}
-
- if (ENABLE_PROBE_IGNORED) {
- return applyProbeIgnored(base, description);
- } else {
- return applyDefault(base, description);
- }
- }
-
- private void commonPrologue(Statement base, Description description) {
- RavenwoodRuleImpl.logTestRunner("started", description);
- RavenwoodRuleImpl.validate(base, description, ENABLE_OPTIONAL_VALIDATION);
- RavenwoodRuleImpl.init(RavenwoodRule.this);
- }
-
- /**
- * Run the given {@link Statement} with no special treatment.
- */
- private Statement applyDefault(Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
- Assume.assumeTrue(shouldEnableOnRavenwood(description));
-
- commonPrologue(base, description);
+ RavenwoodAwareTestRunnerHook.onRavenwoodRuleEnter(
+ RavenwoodAwareTestRunner.getCurrentRunner(), description,
+ RavenwoodRule.this);
try {
base.evaluate();
- RavenwoodRuleImpl.logTestRunner("finished", description);
- } catch (Throwable t) {
- RavenwoodRuleImpl.logTestRunner("failed", description);
- throw t;
} finally {
- RavenwoodRuleImpl.reset(RavenwoodRule.this);
+ RavenwoodAwareTestRunnerHook.onRavenwoodRuleExit(
+ RavenwoodAwareTestRunner.getCurrentRunner(), description,
+ RavenwoodRule.this);
}
}
};
}
/**
- * Run the given {@link Statement} with probing enabled. All tests will be unconditionally
- * run on Ravenwood to detect cases where a test is able to pass despite being marked as
- * {@code IgnoreUnderRavenwood}.
- */
- private Statement applyProbeIgnored(Statement base, Description description) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- Assume.assumeFalse(shouldStillIgnoreInProbeIgnoreMode(description));
-
- commonPrologue(base, description);
- try {
- base.evaluate();
- } catch (Throwable t) {
- // If the test isn't included, eat the exception and report the
- // assumption failure that test authors expect; otherwise throw
- Assume.assumeTrue(shouldEnableOnRavenwood(description));
- throw t;
- } finally {
- RavenwoodRuleImpl.logTestRunner("finished", description);
- RavenwoodRuleImpl.reset(RavenwoodRule.this);
- }
-
- if (!shouldEnableOnRavenwood(description)) {
- fail("Test wasn't included under Ravenwood, but it actually "
- + "passed under Ravenwood; consider updating annotations");
- }
- }
- };
- }
-
- public static class _$RavenwoodPrivate {
- public static boolean isOptionalValidationEnabled() {
- return ENABLE_OPTIONAL_VALIDATION;
- }
- }
-
- /**
* Returns the "real" result from {@link System#currentTimeMillis()}.
*
* Currently, it's the same thing as calling {@link System#currentTimeMillis()},
@@ -439,4 +263,51 @@
public long realCurrentTimeMillis() {
return System.currentTimeMillis();
}
+
+ // Below are internal to ravenwood. Don't use them from normal tests...
+
+ public static class RavenwoodPrivate {
+ private RavenwoodPrivate() {
+ }
+
+ private volatile Boolean mRunDisabledTestsOverride = null;
+
+ private volatile Pattern mReallyDisabledPattern = null;
+
+ public boolean isRunningDisabledTests() {
+ if (mRunDisabledTestsOverride != null) {
+ return mRunDisabledTestsOverride;
+ }
+ return RUN_DISABLED_TESTS;
+ }
+
+ public Pattern getReallyDisabledPattern() {
+ if (mReallyDisabledPattern != null) {
+ return mReallyDisabledPattern;
+ }
+ return REALLY_DISABLED_PATTERN;
+ }
+
+ public void overrideRunDisabledTest(boolean runDisabledTests,
+ @Nullable String reallyDisabledPattern) {
+ mRunDisabledTestsOverride = runDisabledTests;
+ mReallyDisabledPattern =
+ reallyDisabledPattern == null ? null : Pattern.compile(reallyDisabledPattern);
+ }
+
+ public void resetRunDisabledTest() {
+ mRunDisabledTestsOverride = null;
+ mReallyDisabledPattern = null;
+ }
+ }
+
+ private static final RavenwoodPrivate sRavenwoodPrivate = new RavenwoodPrivate();
+
+ public static RavenwoodPrivate private$ravenwood() {
+ return sRavenwoodPrivate;
+ }
+
+ RavenwoodConfig getConfiguration() {
+ return mConfiguration;
+ }
}
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java
index 5f1b0c2..ef8f584 100644
--- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java
@@ -48,11 +48,13 @@
switch (key) {
case "gsm.version.baseband":
case "no.such.thing":
+ case "qemu.sf.lcd_density":
case "ro.bootloader":
case "ro.debuggable":
case "ro.hardware":
case "ro.hw_timeout_multiplier":
case "ro.odm.build.media_performance_class":
+ case "ro.sf.lcd_density":
case "ro.treble.enabled":
case "ro.vndk.version":
return true;
diff --git a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java
new file mode 100644
index 0000000..aa8c299
--- /dev/null
+++ b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodAwareTestRunnerHook.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.Order;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner.Scope;
+
+import org.junit.runner.Description;
+import org.junit.runners.model.TestClass;
+
+/**
+ * Provide hook points created by {@link RavenwoodAwareTestRunner}. This is a version
+ * that's used on a device side test.
+ *
+ * All methods are no-op in real device tests.
+ *
+ * TODO: Use some kind of factory to provide different implementation for the device test
+ * and the ravenwood test.
+ */
+public class RavenwoodAwareTestRunnerHook {
+ private RavenwoodAwareTestRunnerHook() {
+ }
+
+ /**
+ * Called before any code starts. Internally it will only initialize the environment once.
+ */
+ public static void performGlobalInitialization() {
+ }
+
+ /**
+ * Called when a runner starts, before the inner runner gets a chance to run.
+ */
+ public static void onRunnerInitializing(RavenwoodAwareTestRunner runner, TestClass testClass) {
+ }
+
+ /**
+ * Called when a whole test class is skipped.
+ */
+ public static void onClassSkipped(Description description) {
+ }
+
+ /**
+ * Called before the inner runner starts.
+ */
+ public static void onBeforeInnerRunnerStart(
+ RavenwoodAwareTestRunner runner, Description description) throws Throwable {
+ }
+
+ /**
+ * Called after the inner runner finished.
+ */
+ public static void onAfterInnerRunnerFinished(
+ RavenwoodAwareTestRunner runner, Description description) throws Throwable {
+ }
+
+ /**
+ * Called before a test / class.
+ *
+ * Return false if it should be skipped.
+ */
+ public static boolean onBefore(RavenwoodAwareTestRunner runner, Description description,
+ Scope scope, Order order) throws Throwable {
+ return true;
+ }
+
+ public static void onRavenwoodRuleEnter(RavenwoodAwareTestRunner runner,
+ Description description, RavenwoodRule rule) throws Throwable {
+ }
+
+ public static void onRavenwoodRuleExit(RavenwoodAwareTestRunner runner,
+ Description description, RavenwoodRule rule) throws Throwable {
+ }
+
+
+ /**
+ * Called after a test / class.
+ *
+ * Return false if the exception should be ignored.
+ */
+ public static boolean onAfter(RavenwoodAwareTestRunner runner, Description description,
+ Scope scope, Order order, Throwable th) {
+ return true;
+ }
+
+ public static boolean shouldRunClassOnRavenwood(Class<?> clazz) {
+ return true;
+ }
+}
diff --git a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodConfigState.java b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodConfigState.java
new file mode 100644
index 0000000..43a28ba
--- /dev/null
+++ b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodConfigState.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+/** Stub class. The actual implementaetion is in junit-impl-src. */
+public class RavenwoodConfigState {
+ public RavenwoodConfigState(RavenwoodConfig config) {
+ }
+}
diff --git a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
deleted file mode 100644
index 483b98a..0000000
--- a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.platform.test.ravenwood;
-
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-public class RavenwoodRuleImpl {
- public static void init(RavenwoodRule rule) {
- // No-op when running on a real device
- }
-
- public static void reset(RavenwoodRule rule) {
- // No-op when running on a real device
- }
-
- public static void logTestRunner(String label, Description description) {
- // No-op when running on a real device
- }
-
- public static void validate(Statement base, Description description,
- boolean enableOptionalValidation) {
- }
-
- public static long realCurrentTimeMillis() {
- return System.currentTimeMillis();
- }
-}
diff --git a/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRunnerState.java b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRunnerState.java
new file mode 100644
index 0000000..83cbc52
--- /dev/null
+++ b/ravenwood/junit-stub-src/android/platform/test/ravenwood/RavenwoodRunnerState.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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.platform.test.ravenwood;
+
+/** Stub class. The actual implementaetion is in junit-impl-src. */
+public class RavenwoodRunnerState {
+ public RavenwoodRunnerState(RavenwoodAwareTestRunner runner) {
+ }
+}
diff --git a/ravenwood/minimum-test/test/com/android/ravenwood/RavenwoodMinimumTest.java b/ravenwood/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java
similarity index 97%
rename from ravenwood/minimum-test/test/com/android/ravenwood/RavenwoodMinimumTest.java
rename to ravenwood/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java
index b477117..30abaa2 100644
--- a/ravenwood/minimum-test/test/com/android/ravenwood/RavenwoodMinimumTest.java
+++ b/ravenwood/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.ravenwood;
+package com.android.ravenwoodtest;
import android.platform.test.annotations.IgnoreUnderRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
diff --git a/ravenwood/resapk_test/test/com/android/ravenwood/resapk_test/RavenwoodResApkTest.java b/ravenwood/resapk_test/test/com/android/ravenwoodtest/resapk_test/RavenwoodResApkTest.java
similarity index 96%
rename from ravenwood/resapk_test/test/com/android/ravenwood/resapk_test/RavenwoodResApkTest.java
rename to ravenwood/resapk_test/test/com/android/ravenwoodtest/resapk_test/RavenwoodResApkTest.java
index 1029ed2..e547114 100644
--- a/ravenwood/resapk_test/test/com/android/ravenwood/resapk_test/RavenwoodResApkTest.java
+++ b/ravenwood/resapk_test/test/com/android/ravenwoodtest/resapk_test/RavenwoodResApkTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.ravenwood.resapk_test;
+package com.android.ravenwoodtest.resapk_test;
import static junit.framework.TestCase.assertTrue;
diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java
index 0238baa..02153a7 100644
--- a/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java
+++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/JvmWorkaround.java
@@ -38,7 +38,6 @@
*/
public abstract void setFdInt(FileDescriptor fd, int fdInt);
-
/**
* Equivalent to Android's FileDescriptor.getInt$().
*/
@@ -49,6 +48,10 @@
*/
public abstract void closeFd(FileDescriptor fd) throws IOException;
+ public abstract long addressOf(Object o);
+
+ public abstract <T> T fromAddress(long address);
+
/**
* Placeholder implementation for the host side.
*
@@ -75,5 +78,15 @@
public void closeFd(FileDescriptor fd) {
throw calledOnHostside();
}
+
+ @Override
+ public long addressOf(Object o) {
+ throw calledOnHostside();
+ }
+
+ @Override
+ public <T> T fromAddress(long address) {
+ throw calledOnHostside();
+ }
}
}
diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java
index a260147..2323c65 100644
--- a/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java
+++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/OpenJdkWorkaround.java
@@ -18,8 +18,16 @@
import java.io.FileDescriptor;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.WeakHashMap;
class OpenJdkWorkaround extends JvmWorkaround {
+
+ // @GuardedBy("sAddressMap")
+ private static final Map<Object, Long> sAddressMap = new WeakHashMap<>();
+ // @GuardedBy("sAddressMap")
+ private static long sCurrentAddress = 1;
+
@Override
public void setFdInt(FileDescriptor fd, int fdInt) {
try {
@@ -60,4 +68,28 @@
+ " perhaps JRE has changed?", e);
}
}
+
+ @Override
+ public long addressOf(Object o) {
+ synchronized (sAddressMap) {
+ Long address = sAddressMap.get(o);
+ if (address == null) {
+ address = sCurrentAddress++;
+ sAddressMap.put(o, address);
+ }
+ return address;
+ }
+ }
+
+ @Override
+ public <T> T fromAddress(long address) {
+ synchronized (sAddressMap) {
+ for (var e : sAddressMap.entrySet()) {
+ if (e.getValue() == address) {
+ return (T) e.getKey();
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java
index c8cc8d9..989bb6b 100644
--- a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java
+++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java
@@ -15,12 +15,20 @@
*/
package com.android.ravenwood.common;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+
import com.android.ravenwood.common.divergence.RavenwoodDivergence;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.Arrays;
public class RavenwoodCommonUtils {
@@ -31,6 +39,14 @@
private static final Object sLock = new Object();
+ /**
+ * If set to "1", we enable the verbose logging.
+ *
+ * (See also InitLogging() in http://ac/system/libbase/logging.cpp)
+ */
+ public static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv(
+ "RAVENWOOD_VERBOSE"));
+
/** Name of `libravenwood_runtime` */
private static final String RAVENWOOD_NATIVE_RUNTIME_NAME = "ravenwood_runtime";
@@ -42,10 +58,19 @@
private static final boolean IS_ON_RAVENWOOD = RavenwoodDivergence.isOnRavenwood();
- private static final String RAVEWOOD_RUNTIME_PATH = getRavenwoodRuntimePathInternal();
+ private static final String RAVENWOOD_RUNTIME_PATH = getRavenwoodRuntimePathInternal();
public static final String RAVENWOOD_SYSPROP = "ro.is_on_ravenwood";
+ public static final String RAVENWOOD_RESOURCE_APK = "ravenwood-res-apks/ravenwood-res.apk";
+ public static final String RAVENWOOD_INST_RESOURCE_APK =
+ "ravenwood-res-apks/ravenwood-inst-res.apk";
+
+ public static final String RAVENWOOD_EMPTY_RESOURCES_APK =
+ RAVENWOOD_RUNTIME_PATH + "ravenwood-data/ravenwood-empty-res.apk";
+
+ public static final String RAVENWOOD_VERSION_JAVA_SYSPROP = "android.ravenwood.version";
+
// @GuardedBy("sLock")
private static boolean sIntegrityChecked = false;
@@ -72,6 +97,18 @@
return sEnableExtraRuntimeCheck;
}
+ /** Simple logging method. */
+ public static void log(String tag, String message) {
+ // Avoid using Android's Log class, which could be broken for various reasons.
+ // (e.g. the JNI file doesn't exist for whatever reason)
+ System.out.print(tag + ": " + message + "\n");
+ }
+
+ /** Simple logging method. */
+ private void log(String tag, String format, Object... args) {
+ log(tag, String.format(format, args));
+ }
+
/**
* Load the main runtime JNI library.
*/
@@ -176,7 +213,7 @@
*/
public static String getRavenwoodRuntimePath() {
ensureOnRavenwood();
- return RAVEWOOD_RUNTIME_PATH;
+ return RAVENWOOD_RUNTIME_PATH;
}
private static String getRavenwoodRuntimePathInternal() {
@@ -231,4 +268,37 @@
var is = new FileInputStream(fd);
RavenwoodCommonUtils.closeQuietly(is);
}
+
+ public static void ensureIsPublicVoidMethod(Method method, boolean isStatic) {
+ var ok = Modifier.isPublic(method.getModifiers())
+ && (Modifier.isStatic(method.getModifiers()) == isStatic)
+ && (method.getReturnType() == void.class);
+ if (ok) {
+ return; // okay
+ }
+ throw new AssertionError(String.format(
+ "Method %s.%s() expected to be public %svoid",
+ method.getDeclaringClass().getName(), method.getName(),
+ (isStatic ? "static " : "")));
+ }
+
+ public static void ensureIsPublicMember(Member member, boolean isStatic) {
+ var ok = Modifier.isPublic(member.getModifiers())
+ && (Modifier.isStatic(member.getModifiers()) == isStatic);
+ if (ok) {
+ return; // okay
+ }
+ throw new AssertionError(String.format(
+ "%s.%s expected to be public %s",
+ member.getDeclaringClass().getName(), member.getName(),
+ (isStatic ? "static" : "")));
+ }
+
+ @NonNull
+ public static String getStackTraceString(@Nullable Throwable th) {
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter writer = new PrintWriter(stringWriter);
+ th.printStackTrace(writer);
+ return stringWriter.toString();
+ }
}
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/CursorWindow_host.java b/ravenwood/runtime-helper-src/framework/android/database/CursorWindow_host.java
similarity index 89%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/CursorWindow_host.java
rename to ravenwood/runtime-helper-src/framework/android/database/CursorWindow_host.java
index f38d565..e21a9cd 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/CursorWindow_host.java
+++ b/ravenwood/runtime-helper-src/framework/android/database/CursorWindow_host.java
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package android.database;
-import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.os.Parcel;
import android.util.Base64;
@@ -35,8 +34,8 @@
private String mName;
private int mColumnNum;
private static class Row {
- String[] fields;
- int[] types;
+ String[] mFields;
+ int[] mTypes;
}
private final List<Row> mRows = new ArrayList<>();
@@ -69,9 +68,9 @@
public static boolean nativeAllocRow(long windowPtr) {
CursorWindow_host instance = sInstances.get(windowPtr);
Row row = new Row();
- row.fields = new String[instance.mColumnNum];
- row.types = new int[instance.mColumnNum];
- Arrays.fill(row.types, Cursor.FIELD_TYPE_NULL);
+ row.mFields = new String[instance.mColumnNum];
+ row.mTypes = new int[instance.mColumnNum];
+ Arrays.fill(row.mTypes, Cursor.FIELD_TYPE_NULL);
instance.mRows.add(row);
return true;
}
@@ -82,8 +81,8 @@
return false;
}
Row r = instance.mRows.get(row);
- r.fields[column] = value;
- r.types[column] = type;
+ r.mFields[column] = value;
+ r.mTypes[column] = type;
return true;
}
@@ -93,7 +92,7 @@
return Cursor.FIELD_TYPE_NULL;
}
- return instance.mRows.get(row).types[column];
+ return instance.mRows.get(row).mTypes[column];
}
public static boolean nativePutString(long windowPtr, String value,
@@ -107,7 +106,7 @@
return null;
}
- return instance.mRows.get(row).fields[column];
+ return instance.mRows.get(row).mFields[column];
}
public static boolean nativePutLong(long windowPtr, long value, int row, int column) {
@@ -170,8 +169,8 @@
parcel.writeInt(window.mColumnNum);
parcel.writeInt(window.mRows.size());
for (int row = 0; row < window.mRows.size(); row++) {
- parcel.writeStringArray(window.mRows.get(row).fields);
- parcel.writeIntArray(window.mRows.get(row).types);
+ parcel.writeStringArray(window.mRows.get(row).mFields);
+ parcel.writeIntArray(window.mRows.get(row).mTypes);
}
}
@@ -183,8 +182,8 @@
int rowCount = parcel.readInt();
for (int row = 0; row < rowCount; row++) {
Row r = new Row();
- r.fields = parcel.createStringArray();
- r.types = parcel.createIntArray();
+ r.mFields = parcel.createStringArray();
+ r.mTypes = parcel.createIntArray();
window.mRows.add(r);
}
return windowPtr;
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/MessageQueue_host.java b/ravenwood/runtime-helper-src/framework/android/os/MessageQueue_host.java
similarity index 97%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/MessageQueue_host.java
rename to ravenwood/runtime-helper-src/framework/android/os/MessageQueue_host.java
index 5e81124..1b63adc 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/MessageQueue_host.java
+++ b/ravenwood/runtime-helper-src/framework/android/os/MessageQueue_host.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package android.os;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/SystemProperties_host.java b/ravenwood/runtime-helper-src/framework/android/os/SystemProperties_host.java
similarity index 89%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/SystemProperties_host.java
rename to ravenwood/runtime-helper-src/framework/android/os/SystemProperties_host.java
index e7479d3..b09bf31 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/SystemProperties_host.java
+++ b/ravenwood/runtime-helper-src/framework/android/os/SystemProperties_host.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package android.os;
import android.util.SparseArray;
@@ -36,9 +36,6 @@
/** Predicate tested to determine if a given key can be written. */
@GuardedBy("sLock")
private static Predicate<String> sKeyWritablePredicate;
- /** Callback to trigger when values are changed */
- @GuardedBy("sLock")
- private static Runnable sChangeCallback;
/**
* Reverse mapping that provides a way back to an original key from the
@@ -48,7 +45,7 @@
private static SparseArray<String> sKeyHandles = new SparseArray<>();
/**
- * Basically the same as {@link #native_init$ravenwood}, but it'll only run if no values are
+ * Basically the same as {@link #init$ravenwood}, but it'll only run if no values are
* set yet.
*/
public static void initializeIfNeeded(Map<String, String> values,
@@ -57,30 +54,32 @@
if (sValues != null) {
return; // Already initialized.
}
- native_init$ravenwood(values, keyReadablePredicate, keyWritablePredicate,
- () -> {});
+ init$ravenwood(values, keyReadablePredicate, keyWritablePredicate);
}
}
- public static void native_init$ravenwood(Map<String, String> values,
- Predicate<String> keyReadablePredicate, Predicate<String> keyWritablePredicate,
- Runnable changeCallback) {
+ public static void init$ravenwood(Map<String, String> values,
+ Predicate<String> keyReadablePredicate, Predicate<String> keyWritablePredicate) {
synchronized (sLock) {
sValues = Objects.requireNonNull(values);
sKeyReadablePredicate = Objects.requireNonNull(keyReadablePredicate);
sKeyWritablePredicate = Objects.requireNonNull(keyWritablePredicate);
- sChangeCallback = Objects.requireNonNull(changeCallback);
sKeyHandles.clear();
+ synchronized (SystemProperties.sChangeCallbacks) {
+ SystemProperties.sChangeCallbacks.clear();
+ }
}
}
- public static void native_reset$ravenwood() {
+ public static void reset$ravenwood() {
synchronized (sLock) {
sValues = null;
sKeyReadablePredicate = null;
sKeyWritablePredicate = null;
- sChangeCallback = null;
sKeyHandles.clear();
+ synchronized (SystemProperties.sChangeCallbacks) {
+ SystemProperties.sChangeCallbacks.clear();
+ }
}
}
@@ -101,7 +100,7 @@
} else {
sValues.put(key, val);
}
- sChangeCallback.run();
+ SystemProperties.callChangeCallbacks();
}
}
@@ -183,7 +182,7 @@
// Report through callback always registered via init above
synchronized (sLock) {
Preconditions.requireNonNullViaRavenwoodRule(sValues);
- sChangeCallback.run();
+ SystemProperties.callChangeCallbacks();
}
}
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/EventLog_host.java b/ravenwood/runtime-helper-src/framework/android/util/EventLog_host.java
similarity index 83%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/EventLog_host.java
rename to ravenwood/runtime-helper-src/framework/android/util/EventLog_host.java
index 55d4ffb..878a0ff 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/EventLog_host.java
+++ b/ravenwood/runtime-helper-src/framework/android/util/EventLog_host.java
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package android.util;
import com.android.internal.os.RuntimeInit;
import java.io.PrintStream;
-import java.util.Collection;
public class EventLog_host {
public static int writeEvent(int tag, int value) {
@@ -58,15 +57,6 @@
return sb.length();
}
- public static void readEvents(int[] tags, Collection<android.util.EventLog.Event> output) {
- throw new UnsupportedOperationException();
- }
-
- public static void readEventsOnWrapping(int[] tags, long timestamp,
- Collection<android.util.EventLog.Event> output) {
- throw new UnsupportedOperationException();
- }
-
/**
* Return the "real" {@code System.out} if it's been swapped by {@code RavenwoodRuleImpl}, so
* that we don't end up in a recursive loop.
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Log_host.java b/ravenwood/runtime-helper-src/framework/android/util/Log_host.java
similarity index 95%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Log_host.java
rename to ravenwood/runtime-helper-src/framework/android/util/Log_host.java
index f301b9c..d232ef2 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Log_host.java
+++ b/ravenwood/runtime-helper-src/framework/android/util/Log_host.java
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package android.util;
-import android.util.Log;
import android.util.Log.Level;
import com.android.internal.os.RuntimeInit;
@@ -44,7 +43,7 @@
case Log.LOG_ID_SYSTEM: buffer = "system"; break;
case Log.LOG_ID_CRASH: buffer = "crash"; break;
default: buffer = "buf:" + bufID; break;
- };
+ }
final String prio;
switch (priority) {
@@ -55,7 +54,7 @@
case Log.ERROR: prio = "E"; break;
case Log.ASSERT: prio = "A"; break;
default: prio = "prio:" + priority; break;
- };
+ }
for (String s : msg.split("\\n")) {
getRealOut().println(String.format("logd: [%s] %s %s: %s", buffer, prio, tag, s));
diff --git a/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongArrayContainer_host.java b/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongArrayContainer_host.java
new file mode 100644
index 0000000..c18c307
--- /dev/null
+++ b/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongArrayContainer_host.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2024 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 com.android.internal.os;
+
+import java.util.Arrays;
+import java.util.HashMap;
+
+public class LongArrayContainer_host {
+ private static final HashMap<Long, long[]> sInstances = new HashMap<>();
+ private static long sNextId = 1;
+
+ public static long native_init(int arrayLength) {
+ long[] array = new long[arrayLength];
+ long instanceId = sNextId++;
+ sInstances.put(instanceId, array);
+ return instanceId;
+ }
+
+ static long[] getInstance(long instanceId) {
+ return sInstances.get(instanceId);
+ }
+
+ public static void native_setValues(long instanceId, long[] values) {
+ System.arraycopy(values, 0, getInstance(instanceId), 0, values.length);
+ }
+
+ public static void native_getValues(long instanceId, long[] values) {
+ System.arraycopy(getInstance(instanceId), 0, values, 0, values.length);
+ }
+
+ public static boolean native_combineValues(long instanceId, long[] array, int[] indexMap) {
+ long[] values = getInstance(instanceId);
+
+ boolean nonZero = false;
+ Arrays.fill(array, 0);
+
+ for (int i = 0; i < values.length; i++) {
+ int index = indexMap[i];
+ if (index < 0 || index >= array.length) {
+ throw new IndexOutOfBoundsException("Index " + index + " is out of bounds: [0, "
+ + (array.length - 1) + "]");
+ }
+ if (values[i] != 0) {
+ array[index] += values[i];
+ nonZero = true;
+ }
+ }
+ return nonZero;
+ }
+}
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/LongArrayMultiStateCounter_host.java b/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongArrayMultiStateCounter_host.java
similarity index 87%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/LongArrayMultiStateCounter_host.java
rename to ravenwood/runtime-helper-src/framework/com/android/internal/os/LongArrayMultiStateCounter_host.java
index 0f65544..9ce8ea8 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/LongArrayMultiStateCounter_host.java
+++ b/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongArrayMultiStateCounter_host.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package com.android.internal.os;
import android.os.BadParcelableException;
import android.os.Parcel;
@@ -28,7 +28,7 @@
public class LongArrayMultiStateCounter_host {
/**
- * A reimplementation of {@link com.android.internal.os.LongArrayMultiStateCounter}, only in
+ * A reimplementation of {@link LongArrayMultiStateCounter}, only in
* Java instead of native. The majority of the code (in C++) can be found in
* /frameworks/native/libs/battery/MultiStateCounter.h
*/
@@ -257,50 +257,6 @@
}
}
- public static class LongArrayContainer_host {
- private static final HashMap<Long, long[]> sInstances = new HashMap<>();
- private static long sNextId = 1;
-
- public static long native_init(int arrayLength) {
- long[] array = new long[arrayLength];
- long instanceId = sNextId++;
- sInstances.put(instanceId, array);
- return instanceId;
- }
-
- static long[] getInstance(long instanceId) {
- return sInstances.get(instanceId);
- }
-
- public static void native_setValues(long instanceId, long[] values) {
- System.arraycopy(values, 0, getInstance(instanceId), 0, values.length);
- }
-
- public static void native_getValues(long instanceId, long[] values) {
- System.arraycopy(getInstance(instanceId), 0, values, 0, values.length);
- }
-
- public static boolean native_combineValues(long instanceId, long[] array, int[] indexMap) {
- long[] values = getInstance(instanceId);
-
- boolean nonZero = false;
- Arrays.fill(array, 0);
-
- for (int i = 0; i < values.length; i++) {
- int index = indexMap[i];
- if (index < 0 || index >= array.length) {
- throw new IndexOutOfBoundsException("Index " + index + " is out of bounds: [0, "
- + (array.length - 1) + "]");
- }
- if (values[i] != 0) {
- array[index] += values[i];
- nonZero = true;
- }
- }
- return nonZero;
- }
- }
-
private static final HashMap<Long, LongArrayMultiStateCounterRavenwood> sInstances =
new HashMap<>();
private static long sNextId = 1;
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/LongMultiStateCounter_host.java b/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongMultiStateCounter_host.java
similarity index 98%
rename from ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/LongMultiStateCounter_host.java
rename to ravenwood/runtime-helper-src/framework/com/android/internal/os/LongMultiStateCounter_host.java
index 9486651..1d95aa1 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/LongMultiStateCounter_host.java
+++ b/ravenwood/runtime-helper-src/framework/com/android/internal/os/LongMultiStateCounter_host.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.platform.test.ravenwood.nativesubstitution;
+package com.android.internal.os;
import android.os.BadParcelableException;
import android.os.Parcel;
diff --git a/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java b/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java
new file mode 100644
index 0000000..e12ff24
--- /dev/null
+++ b/ravenwood/runtime-helper-src/framework/com/android/internal/ravenwood/RavenwoodEnvironment_host.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2024 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 com.android.internal.ravenwood;
+
+import com.android.ravenwood.common.JvmWorkaround;
+import com.android.ravenwood.common.RavenwoodCommonUtils;
+
+public class RavenwoodEnvironment_host {
+ private RavenwoodEnvironment_host() {
+ }
+
+ /**
+ * Called from {@link RavenwoodEnvironment#ensureRavenwoodInitialized()}.
+ */
+ public static void ensureRavenwoodInitialized() {
+ // Initialization is now done by RavenwoodAwareTestRunner.
+ // Should we remove it?
+ }
+
+ /**
+ * Called from {@link RavenwoodEnvironment#getRavenwoodRuntimePath()}.
+ */
+ public static String getRavenwoodRuntimePath(RavenwoodEnvironment env) {
+ return RavenwoodCommonUtils.getRavenwoodRuntimePath();
+ }
+
+ /**
+ * Called from {@link RavenwoodEnvironment#fromAddress(long)}.
+ */
+ public static <T> T fromAddress(RavenwoodEnvironment env, long address) {
+ return JvmWorkaround.getInstance().fromAddress(address);
+ }
+}
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java
deleted file mode 100644
index 5a3589d..0000000
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/ParcelFileDescriptor_host.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.platform.test.ravenwood.nativesubstitution;
-
-import com.android.ravenwood.common.JvmWorkaround;
-
-import java.io.FileDescriptor;
-
-public class ParcelFileDescriptor_host {
- public static void setFdInt(FileDescriptor fd, int fdInt) {
- JvmWorkaround.getInstance().setFdInt(fd, fdInt);
- }
-
- public static int getFdInt(FileDescriptor fd) {
- return JvmWorkaround.getInstance().getFdInt(fd);
- }
-}
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java
deleted file mode 100644
index 2df93cd..0000000
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * 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 com.android.platform.test.ravenwood.nativesubstitution;
-
-import android.system.ErrnoException;
-import android.system.Os;
-import android.util.Log;
-
-import java.io.FileDescriptor;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Tentative, partial implementation of the Parcel native methods, using Java's
- * {@code byte[]}.
- * (We don't use a {@link ByteBuffer} because there's enough semantics differences between Parcel
- * and {@link ByteBuffer}, and it didn't work out.
- * e.g. Parcel seems to allow moving the data position to be beyond its size? Which
- * {@link ByteBuffer} wouldn't allow...)
- */
-public class Parcel_host {
- private static final String TAG = "Parcel";
-
- private Parcel_host() {
- }
-
- private static final AtomicLong sNextId = new AtomicLong(1);
-
- private static final Map<Long, Parcel_host> sInstances = new ConcurrentHashMap<>();
-
- private boolean mDeleted = false;
-
- private byte[] mBuffer;
- private int mSize;
- private int mPos;
-
- private boolean mSensitive;
- private boolean mAllowFds;
-
- // TODO Use the actual value from Parcel.java.
- private static final int OK = 0;
-
- private final Map<Integer, FileDescriptor> mFdMap = new ConcurrentHashMap<>();
-
- private static final int FD_PLACEHOLDER = 0xDEADBEEF;
- private static final int FD_PAYLOAD_SIZE = 8;
-
- private void validate() {
- if (mDeleted) {
- // TODO: Put more info
- throw new RuntimeException("Parcel already destroyed");
- }
- }
-
- private static Parcel_host getInstance(long id) {
- Parcel_host p = sInstances.get(id);
- if (p == null) {
- // TODO: Put more info
- throw new RuntimeException("Parcel doesn't exist with id=" + id);
- }
- p.validate();
- return p;
- }
-
- /** Native method substitution */
- public static long nativeCreate() {
- final long id = sNextId.getAndIncrement();
- final Parcel_host p = new Parcel_host();
- sInstances.put(id, p);
- p.init();
- return id;
- }
-
- private void init() {
- mBuffer = new byte[0];
- mSize = 0;
- mPos = 0;
- mSensitive = false;
- mAllowFds = true;
- mFdMap.clear();
- }
-
- private void updateSize() {
- if (mSize < mPos) {
- mSize = mPos;
- }
- }
-
- /** Native method substitution */
- public static void nativeDestroy(long nativePtr) {
- getInstance(nativePtr).mDeleted = true;
- sInstances.remove(nativePtr);
- }
-
- /** Native method substitution */
- public static void nativeFreeBuffer(long nativePtr) {
- getInstance(nativePtr).freeBuffer();
- }
-
- /** Native method substitution */
- private void freeBuffer() {
- init();
- }
-
- private int getCapacity() {
- return mBuffer.length;
- }
-
- private void ensureMoreCapacity(int size) {
- ensureCapacity(mPos + size);
- }
-
- private void ensureCapacity(int targetSize) {
- if (targetSize <= getCapacity()) {
- return;
- }
- var newSize = getCapacity() * 2;
- if (newSize < targetSize) {
- newSize = targetSize;
- }
- forceSetCapacity(newSize);
- }
-
- private void forceSetCapacity(int newSize) {
- var newBuf = new byte[newSize];
-
- // Copy
- System.arraycopy(mBuffer, 0, newBuf, 0, Math.min(newSize, getCapacity()));
-
- this.mBuffer = newBuf;
- }
-
- private void ensureDataAvailable(int requestSize) {
- if (mSize - mPos < requestSize) {
- throw new RuntimeException(String.format(
- "Pacel data underflow. size=%d, pos=%d, request=%d", mSize, mPos, requestSize));
- }
- }
-
- /** Native method substitution */
- public static void nativeMarkSensitive(long nativePtr) {
- getInstance(nativePtr).mSensitive = true;
- }
-
- /** Native method substitution */
- public static int nativeDataSize(long nativePtr) {
- return getInstance(nativePtr).mSize;
- }
-
- /** Native method substitution */
- public static int nativeDataAvail(long nativePtr) {
- var p = getInstance(nativePtr);
- return p.mSize - p.mPos;
- }
-
- /** Native method substitution */
- public static int nativeDataPosition(long nativePtr) {
- return getInstance(nativePtr).mPos;
- }
-
- /** Native method substitution */
- public static int nativeDataCapacity(long nativePtr) {
- return getInstance(nativePtr).mBuffer.length;
- }
-
- /** Native method substitution */
- public static void nativeSetDataSize(long nativePtr, int size) {
- var p = getInstance(nativePtr);
- p.ensureCapacity(size);
- getInstance(nativePtr).mSize = size;
- }
-
- /** Native method substitution */
- public static void nativeSetDataPosition(long nativePtr, int pos) {
- var p = getInstance(nativePtr);
- // TODO: Should this change the size or the capacity??
- p.mPos = pos;
- }
-
- /** Native method substitution */
- public static void nativeSetDataCapacity(long nativePtr, int size) {
- if (size < 0) {
- throw new IllegalArgumentException("size < 0: size=" + size);
- }
- var p = getInstance(nativePtr);
- if (p.getCapacity() < size) {
- p.forceSetCapacity(size);
- }
- }
-
- /** Native method substitution */
- public static boolean nativePushAllowFds(long nativePtr, boolean allowFds) {
- var p = getInstance(nativePtr);
- var prev = p.mAllowFds;
- p.mAllowFds = allowFds;
- return prev;
- }
-
- /** Native method substitution */
- public static void nativeRestoreAllowFds(long nativePtr, boolean lastValue) {
- getInstance(nativePtr).mAllowFds = lastValue;
- }
-
- /** Native method substitution */
- public static void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len) {
- nativeWriteBlob(nativePtr, b, offset, len);
- }
-
- /** Native method substitution */
- public static void nativeWriteBlob(long nativePtr, byte[] b, int offset, int len) {
- var p = getInstance(nativePtr);
-
- if (b == null) {
- nativeWriteInt(nativePtr, -1);
- } else {
- final var alignedSize = align4(len);
-
- nativeWriteInt(nativePtr, len);
-
- p.ensureMoreCapacity(alignedSize);
-
- System.arraycopy(b, offset, p.mBuffer, p.mPos, len);
- p.mPos += alignedSize;
- p.updateSize();
- }
- }
-
- /** Native method substitution */
- public static int nativeWriteInt(long nativePtr, int value) {
- var p = getInstance(nativePtr);
- p.ensureMoreCapacity(Integer.BYTES);
-
- p.mBuffer[p.mPos++] = (byte) ((value >> 24) & 0xff);
- p.mBuffer[p.mPos++] = (byte) ((value >> 16) & 0xff);
- p.mBuffer[p.mPos++] = (byte) ((value >> 8) & 0xff);
- p.mBuffer[p.mPos++] = (byte) ((value >> 0) & 0xff);
-
- p.updateSize();
-
- return OK;
- }
-
- /** Native method substitution */
- public static int nativeWriteLong(long nativePtr, long value) {
- nativeWriteInt(nativePtr, (int) (value >>> 32));
- nativeWriteInt(nativePtr, (int) (value));
- return OK;
- }
-
- /** Native method substitution */
- public static int nativeWriteFloat(long nativePtr, float val) {
- return nativeWriteInt(nativePtr, Float.floatToIntBits(val));
- }
-
- /** Native method substitution */
- public static int nativeWriteDouble(long nativePtr, double val) {
- return nativeWriteLong(nativePtr, Double.doubleToLongBits(val));
- }
-
- private static int align4(int val) {
- return ((val + 3) / 4) * 4;
- }
-
- /** Native method substitution */
- public static void nativeWriteString8(long nativePtr, String val) {
- if (val == null) {
- nativeWriteBlob(nativePtr, null, 0, 0);
- } else {
- var bytes = val.getBytes(StandardCharsets.UTF_8);
- nativeWriteBlob(nativePtr, bytes, 0, bytes.length);
- }
- }
-
- /** Native method substitution */
- public static void nativeWriteString16(long nativePtr, String val) {
- // Just reuse String8
- nativeWriteString8(nativePtr, val);
- }
-
- /** Native method substitution */
- public static byte[] nativeCreateByteArray(long nativePtr) {
- return nativeReadBlob(nativePtr);
- }
-
- /** Native method substitution */
- public static boolean nativeReadByteArray(long nativePtr, byte[] dest, int destLen) {
- if (dest == null) {
- return false;
- }
- var data = nativeReadBlob(nativePtr);
- if (data == null) {
- System.err.println("Percel has NULL, which is unexpected."); // TODO: Is this correct?
- return false;
- }
- // TODO: Make sure the check logic is correct.
- if (data.length != destLen) {
- System.err.println("Byte array size mismatch: expected="
- + data.length + " given=" + destLen);
- return false;
- }
- System.arraycopy(data, 0, dest, 0, data.length);
- return true;
- }
-
- /** Native method substitution */
- public static byte[] nativeReadBlob(long nativePtr) {
- var p = getInstance(nativePtr);
- if (p.mSize - p.mPos < 4) {
- // Match native impl that returns "null" when not enough data
- return null;
- }
- final var size = nativeReadInt(nativePtr);
- if (size == -1) {
- return null;
- }
- try {
- p.ensureDataAvailable(align4(size));
- } catch (Exception e) {
- System.err.println(e.toString());
- return null;
- }
-
- var bytes = new byte[size];
- System.arraycopy(p.mBuffer, p.mPos, bytes, 0, size);
-
- p.mPos += align4(size);
-
- return bytes;
- }
-
- /** Native method substitution */
- public static int nativeReadInt(long nativePtr) {
- var p = getInstance(nativePtr);
-
- if (p.mSize - p.mPos < 4) {
- // Match native impl that returns "0" when not enough data
- return 0;
- }
-
- var ret = (((p.mBuffer[p.mPos++] & 0xff) << 24)
- | ((p.mBuffer[p.mPos++] & 0xff) << 16)
- | ((p.mBuffer[p.mPos++] & 0xff) << 8)
- | ((p.mBuffer[p.mPos++] & 0xff) << 0));
-
- return ret;
- }
-
- /** Native method substitution */
- public static long nativeReadLong(long nativePtr) {
- return (((long) nativeReadInt(nativePtr)) << 32)
- | (((long) nativeReadInt(nativePtr)) & 0xffff_ffffL);
- }
-
- /** Native method substitution */
- public static float nativeReadFloat(long nativePtr) {
- return Float.intBitsToFloat(nativeReadInt(nativePtr));
- }
-
- /** Native method substitution */
- public static double nativeReadDouble(long nativePtr) {
- return Double.longBitsToDouble(nativeReadLong(nativePtr));
- }
-
- /** Native method substitution */
- public static String nativeReadString8(long nativePtr) {
- final var bytes = nativeReadBlob(nativePtr);
- if (bytes == null) {
- return null;
- }
- return new String(bytes, StandardCharsets.UTF_8);
- }
- public static String nativeReadString16(long nativePtr) {
- return nativeReadString8(nativePtr);
- }
-
- /** Native method substitution */
- public static byte[] nativeMarshall(long nativePtr) {
- var p = getInstance(nativePtr);
- return Arrays.copyOf(p.mBuffer, p.mSize);
- }
-
- /** Native method substitution */
- public static void nativeUnmarshall(
- long nativePtr, byte[] data, int offset, int length) {
- var p = getInstance(nativePtr);
- p.ensureMoreCapacity(length);
- System.arraycopy(data, offset, p.mBuffer, p.mPos, length);
- p.mPos += length;
- p.updateSize();
- }
-
- /** Native method substitution */
- public static int nativeCompareData(long thisNativePtr, long otherNativePtr) {
- var a = getInstance(thisNativePtr);
- var b = getInstance(otherNativePtr);
- if ((a.mSize == b.mSize) && Arrays.equals(a.mBuffer, b.mBuffer)) {
- return 0;
- } else {
- return -1;
- }
- }
-
- /** Native method substitution */
- public static boolean nativeCompareDataInRange(
- long ptrA, int offsetA, long ptrB, int offsetB, int length) {
- var a = getInstance(ptrA);
- var b = getInstance(ptrB);
- if (offsetA < 0 || offsetA + length > a.mSize) {
- throw new IllegalArgumentException();
- }
- if (offsetB < 0 || offsetB + length > b.mSize) {
- throw new IllegalArgumentException();
- }
- return Arrays.equals(Arrays.copyOfRange(a.mBuffer, offsetA, offsetA + length),
- Arrays.copyOfRange(b.mBuffer, offsetB, offsetB + length));
- }
-
- /** Native method substitution */
- public static void nativeAppendFrom(
- long thisNativePtr, long otherNativePtr, int srcOffset, int length) {
- var dst = getInstance(thisNativePtr);
- var src = getInstance(otherNativePtr);
-
- dst.ensureMoreCapacity(length);
-
- System.arraycopy(src.mBuffer, srcOffset, dst.mBuffer, dst.mPos, length);
- dst.mPos += length; // TODO: 4 byte align?
- dst.updateSize();
-
- // TODO: Update the other's position?
- }
-
- /** Native method substitution */
- public static boolean nativeHasBinders(long nativePtr) {
- // Assume false for now, because we don't support adding binders.
- return false;
- }
-
- /** Native method substitution */
- public static boolean nativeHasBindersInRange(
- long nativePtr, int offset, int length) {
- // Assume false for now, because we don't support writing FDs yet.
- return false;
- }
-
- /** Native method substitution */
- public static void nativeWriteFileDescriptor(long nativePtr, java.io.FileDescriptor val) {
- var p = getInstance(nativePtr);
-
- if (!p.mAllowFds) {
- // Simulate the FDS_NOT_ALLOWED case in frameworks/base/core/jni/android_util_Binder.cpp
- throw new RuntimeException("Not allowed to write file descriptors here");
- }
-
- FileDescriptor dup = null;
- try {
- dup = Os.dup(val);
- } catch (ErrnoException e) {
- throw new RuntimeException(e);
- }
- p.mFdMap.put(p.mPos, dup);
-
- // Parcel.cpp writes two int32s for a FD.
- // Make sure FD_PAYLOAD_SIZE is in sync with this code.
- nativeWriteInt(nativePtr, FD_PLACEHOLDER);
- nativeWriteInt(nativePtr, FD_PLACEHOLDER);
- }
-
- /** Native method substitution */
- public static java.io.FileDescriptor nativeReadFileDescriptor(long nativePtr) {
- var p = getInstance(nativePtr);
-
- var pos = p.mPos;
- var fd = p.mFdMap.get(pos);
-
- if (fd == null) {
- Log.w(TAG, "nativeReadFileDescriptor: Not a FD at pos #" + pos);
- return null;
- }
- nativeReadInt(nativePtr);
- return fd;
- }
-
- /** Native method substitution */
- public static boolean nativeHasFileDescriptors(long nativePtr) {
- var p = getInstance(nativePtr);
- return p.mFdMap.size() > 0;
- }
-
- /** Native method substitution */
- public static boolean nativeHasFileDescriptorsInRange(long nativePtr, int offset, int length) {
- var p = getInstance(nativePtr);
-
- // Original code: hasFileDescriptorsInRange() in frameworks/native/libs/binder/Parcel.cpp
- if (offset < 0 || length < 0) {
- throw new IllegalArgumentException("Negative value not allowed: offset=" + offset
- + " length=" + length);
- }
- long limit = (long) offset + (long) length;
- if (limit > p.mSize) {
- throw new IllegalArgumentException("Out of range: offset=" + offset
- + " length=" + length + " dataSize=" + p.mSize);
- }
-
- for (var pos : p.mFdMap.keySet()) {
- if (offset <= pos && (pos + FD_PAYLOAD_SIZE - 1) < (offset + length)) {
- return true;
- }
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/RavenwoodEnvironment_host.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/RavenwoodEnvironment_host.java
deleted file mode 100644
index b00cee0..0000000
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/RavenwoodEnvironment_host.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.platform.test.ravenwood.nativesubstitution;
-
-import android.platform.test.ravenwood.RavenwoodSystemProperties;
-import android.util.Log;
-
-import com.android.internal.ravenwood.RavenwoodEnvironment;
-import com.android.ravenwood.common.RavenwoodCommonUtils;
-
-public class RavenwoodEnvironment_host {
- private static final String TAG = RavenwoodEnvironment.TAG;
-
- private static final Object sInitializeLock = new Object();
-
- // @GuardedBy("sInitializeLock")
- private static boolean sInitialized;
-
- private RavenwoodEnvironment_host() {
- }
-
- /**
- * Called from {@link RavenwoodEnvironment#ensureRavenwoodInitialized()}.
- */
- public static void ensureRavenwoodInitializedInternal() {
- synchronized (sInitializeLock) {
- if (sInitialized) {
- return;
- }
- Log.i(TAG, "Initializing Ravenwood environment");
-
- // Set the default values.
- var sysProps = RavenwoodSystemProperties.DEFAULT_VALUES;
-
- // We have a method that does it in RavenwoodRuleImpl, but we can't use that class
- // here, So just inline it.
- SystemProperties_host.initializeIfNeeded(
- sysProps.getValues(),
- sysProps.getKeyReadablePredicate(),
- sysProps.getKeyWritablePredicate());
-
- sInitialized = true;
- }
- }
-}
\ No newline at end of file
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java
index e198646..be8c443 100644
--- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java
+++ b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/runtimehelper/ClassLoadHook.java
@@ -15,49 +15,10 @@
*/
package com.android.platform.test.ravenwood.runtimehelper;
-import com.android.ravenwood.common.RavenwoodCommonUtils;
-
-import java.io.File;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-
/**
* Standard class loader hook.
- *
- * Currently, we use this class to load libandroid_runtime (if needed). In the future, we may
- * load other JNI or do other set up here.
*/
public class ClassLoadHook {
- /**
- * If true, we won't load `libandroid_runtime`
- *
- * <p>Looks like there's some complexity in running a host test with JNI with `atest`,
- * so we need a way to remove the dependency.
- */
- private static final boolean SKIP_LOADING_LIBANDROID = "1".equals(System.getenv(
- "RAVENWOOD_SKIP_LOADING_LIBANDROID"));
-
- public static final String CORE_NATIVE_CLASSES = "core_native_classes";
- public static final String ICU_DATA_PATH = "icu.data.path";
- public static final String KEYBOARD_PATHS = "keyboard_paths";
- public static final String GRAPHICS_NATIVE_CLASSES = "graphics_native_classes";
-
- public static final String LIBANDROID_RUNTIME_NAME = "android_runtime";
-
- /**
- * Extra strings needed to pass to register_android_graphics_classes().
- *
- * `android.graphics.Graphics` is not actually a class, so we can't use the same initialization
- * strategy than the "normal" classes. So we just hardcode it here.
- */
- public static final String GRAPHICS_EXTRA_INIT_PARAMS = ",android.graphics.Graphics";
-
- private static String sInitialDir = new File("").getAbsolutePath();
-
- static {
- log("Initialized. Current dir=" + sInitialDir);
- }
-
private ClassLoadHook() {
}
@@ -70,129 +31,12 @@
public static void onClassLoaded(Class<?> clazz) {
System.out.println("Framework class loaded: " + clazz.getCanonicalName());
- loadFrameworkNativeCode();
- }
-
- private static void log(String message) {
- System.out.println("ClassLoadHook: " + message);
- }
-
- private static void log(String fmt, Object... args) {
- log(String.format(fmt, args));
- }
-
- private static void ensurePropertyNotSet(String key) {
- if (System.getProperty(key) != null) {
- throw new RuntimeException("System property \"" + key + "\" is set unexpectedly");
+ // Always try to initialize the environment in case classes are loaded before
+ // RavenwoodAwareTestRunner is initialized
+ try {
+ Class.forName("android.platform.test.ravenwood.RavenwoodRuntimeEnvironmentController")
+ .getMethod("globalInitOnce").invoke(null);
+ } catch (ReflectiveOperationException ignored) {
}
}
-
- private static void setProperty(String key, String value) {
- System.setProperty(key, value);
- log("Property set: %s=\"%s\"", key, value);
- }
-
- private static void dumpSystemProperties() {
- for (var prop : System.getProperties().entrySet()) {
- log(" %s=\"%s\"", prop.getKey(), prop.getValue());
- }
- }
-
- private static boolean sLoadFrameworkNativeCodeCalled = false;
-
- /**
- * Load `libandroid_runtime` if needed.
- */
- private static void loadFrameworkNativeCode() {
- // This is called from class-initializers, so no synchronization is needed.
- if (sLoadFrameworkNativeCodeCalled) {
- return;
- }
- sLoadFrameworkNativeCodeCalled = true;
-
- // libandroid_runtime uses Java's system properties to decide what JNI methods to set up.
- // Set up these properties for host-side tests.
-
- if ("1".equals(System.getenv("RAVENWOOD_DUMP_PROPERTIES"))) {
- log("Java system properties:");
- dumpSystemProperties();
- }
-
- if (SKIP_LOADING_LIBANDROID) {
- log("Skip loading native runtime.");
- return;
- }
-
- // Make sure these properties are not set.
- ensurePropertyNotSet(CORE_NATIVE_CLASSES);
- ensurePropertyNotSet(ICU_DATA_PATH);
- ensurePropertyNotSet(KEYBOARD_PATHS);
- ensurePropertyNotSet(GRAPHICS_NATIVE_CLASSES);
-
- // Load the libraries, if needed.
- final var libanrdoidClasses = getClassesWithNativeMethods(sLibandroidClasses);
- final var libhwuiClasses = getClassesWithNativeMethods(sLibhwuiClasses);
- if (libanrdoidClasses.isEmpty() && libhwuiClasses.isEmpty()) {
- log("No classes require JNI methods, skip loading native runtime.");
- return;
- }
- setProperty(CORE_NATIVE_CLASSES, libanrdoidClasses);
- setProperty(GRAPHICS_NATIVE_CLASSES, libhwuiClasses + GRAPHICS_EXTRA_INIT_PARAMS);
-
- log("Loading " + LIBANDROID_RUNTIME_NAME + " for '" + libanrdoidClasses + "' and '"
- + libhwuiClasses + "'");
- RavenwoodCommonUtils.loadJniLibrary(LIBANDROID_RUNTIME_NAME);
- }
-
- /**
- * Classes with native methods that are backed by libandroid_runtime.
- *
- * See frameworks/base/core/jni/platform/host/HostRuntime.cpp
- */
- private static final Class<?>[] sLibandroidClasses = {
- android.util.Log.class,
- };
-
- /**
- * Classes with native methods that are backed by libhwui.
- *
- * See frameworks/base/libs/hwui/apex/LayoutlibLoader.cpp
- */
- private static final Class<?>[] sLibhwuiClasses = {
- android.graphics.Interpolator.class,
- android.graphics.Matrix.class,
- android.graphics.Path.class,
- android.graphics.Color.class,
- android.graphics.ColorSpace.class,
- };
-
- /**
- * @return if a given class and its nested classes, if any, have any native method or not.
- */
- private static boolean hasNativeMethod(Class<?> clazz) {
- for (var nestedClass : clazz.getNestMembers()) {
- for (var method : nestedClass.getDeclaredMethods()) {
- if (Modifier.isNative(method.getModifiers())) {
- return true;
- }
- }
- }
- return false;
- }
- /**
- * Create a list of classes as comma-separated that require JNI methods to be set up from
- * a given class list, ignoring classes with no native methods.
- */
- private static String getClassesWithNativeMethods(Class<?>[] classes) {
- final var coreNativeClassesToLoad = new ArrayList<String>();
-
- for (var clazz : classes) {
- if (hasNativeMethod(clazz)) {
- log("Class %s has native methods", clazz.getCanonicalName());
- coreNativeClassesToLoad.add(clazz.getName());
- }
- }
-
- return String.join(",", coreNativeClassesToLoad);
- }
}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java b/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java
index ecaa816..c94ef31 100644
--- a/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java
+++ b/ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java
@@ -15,11 +15,15 @@
*/
package android.system;
+import com.android.ravenwood.RavenwoodRuntimeNative;
import com.android.ravenwood.common.JvmWorkaround;
-import com.android.ravenwood.common.RavenwoodRuntimeNative;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousCloseException;
/**
* OS class replacement used on Ravenwood. For now, we just implement APIs as we need them...
@@ -36,6 +40,11 @@
return RavenwoodRuntimeNative.pipe2(flags);
}
+ /** Ravenwood version of the OS API. */
+ public static FileDescriptor[] pipe() throws ErrnoException {
+ return RavenwoodRuntimeNative.pipe2(0);
+ }
+
public static FileDescriptor dup(FileDescriptor fd) throws ErrnoException {
return RavenwoodRuntimeNative.dup(fd);
}
@@ -69,4 +78,23 @@
public static FileDescriptor open(String path, int flags, int mode) throws ErrnoException {
return RavenwoodRuntimeNative.open(path, flags, mode);
}
+
+ /** Ravenwood version of the OS API. */
+ public static int pread(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount,
+ long offset) throws ErrnoException, InterruptedIOException {
+ var channel = new FileInputStream(fd).getChannel();
+ var buf = ByteBuffer.wrap(bytes, byteOffset, byteCount);
+ try {
+ return channel.read(buf, offset);
+ } catch (AsynchronousCloseException e) {
+ throw new InterruptedIOException(e.getMessage());
+ } catch (IOException e) {
+ // Most likely EIO
+ throw new ErrnoException("pread", OsConstants.EIO, e);
+ }
+ }
+
+ public static void setenv(String name, String value, boolean overwrite) throws ErrnoException {
+ RavenwoodRuntimeNative.setenv(name, value, overwrite);
+ }
}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java
new file mode 100644
index 0000000..96aed4b
--- /dev/null
+++ b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwood;
+
+import com.android.ravenwood.common.JvmWorkaround;
+
+import java.io.FileDescriptor;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Class to host APIs that exist in libcore, but not in standard JRE.
+ */
+public class RavenwoodJdkPatch {
+ /**
+ * Implements FileDescriptor.getInt$()
+ */
+ public static int getInt$(FileDescriptor fd) {
+ return JvmWorkaround.getInstance().getFdInt(fd);
+ }
+
+ /**
+ * Implements FileDescriptor.setInt$(int)
+ */
+ public static void setInt$(FileDescriptor fd, int rawFd) {
+ JvmWorkaround.getInstance().setFdInt(fd, rawFd);
+ }
+
+ /**
+ * Implements LinkedHashMap.eldest()
+ */
+ public static <K, V> Map.Entry<K, V> eldest(LinkedHashMap<K, V> map) {
+ final var it = map.entrySet().iterator();
+ return it.hasNext() ? it.next() : null;
+ }
+}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/common/RavenwoodRuntimeNative.java b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java
similarity index 92%
rename from ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/common/RavenwoodRuntimeNative.java
rename to ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java
index beba833..ad80d92 100644
--- a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/common/RavenwoodRuntimeNative.java
+++ b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java
@@ -13,11 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.ravenwood.common;
+package com.android.ravenwood;
import android.system.ErrnoException;
import android.system.StructStat;
+import com.android.ravenwood.common.JvmWorkaround;
+import com.android.ravenwood.common.RavenwoodCommonUtils;
+
import java.io.FileDescriptor;
/**
@@ -50,6 +53,9 @@
private static native int nOpen(String path, int flags, int mode) throws ErrnoException;
+ public static native void setenv(String name, String value, boolean overwrite)
+ throws ErrnoException;
+
public static long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException {
return nLseek(JvmWorkaround.getInstance().getFdInt(fd), offset, whence);
}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java b/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java
index 7d2b00d..ba89f71 100644
--- a/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java
+++ b/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java
@@ -19,6 +19,8 @@
// The original is here:
// $ANDROID_BUILD_TOP/libcore/libart/src/main/java/dalvik/system/VMRuntime.java
+import com.android.ravenwood.common.JvmWorkaround;
+
import java.lang.reflect.Array;
public class VMRuntime {
@@ -32,14 +34,22 @@
}
public boolean is64Bit() {
- return true;
+ return "amd64".equals(System.getProperty("os.arch"));
}
public static boolean is64BitAbi(String abi) {
- return true;
+ return abi.contains("64");
}
public Object newUnpaddedArray(Class<?> componentType, int minLength) {
return Array.newInstance(componentType, minLength);
}
+
+ public Object newNonMovableArray(Class<?> componentType, int length) {
+ return Array.newInstance(componentType, length);
+ }
+
+ public long addressOf(Object obj) {
+ return JvmWorkaround.getInstance().addressOf(obj);
+ }
}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoUtils.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoUtils.java
index 65c285e..2bd1ae8 100644
--- a/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoUtils.java
+++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoUtils.java
@@ -16,7 +16,13 @@
package libcore.io;
+import android.system.ErrnoException;
+import android.system.Os;
+
+import com.android.ravenwood.common.JvmWorkaround;
+
import java.io.File;
+import java.io.FileDescriptor;
import java.io.IOException;
import java.net.Socket;
@@ -47,6 +53,13 @@
}
}
+ public static void closeQuietly(FileDescriptor fd) {
+ try {
+ Os.close(fd);
+ } catch (ErrnoException ignored) {
+ }
+ }
+
public static void deleteContents(File dir) throws IOException {
File[] files = dir.listFiles();
if (files != null) {
@@ -58,4 +71,17 @@
}
}
}
+
+ /**
+ * FD owners currently unsupported under Ravenwood; ignored
+ */
+ public static void setFdOwner(FileDescriptor fd, Object owner) {
+ }
+
+ /**
+ * FD owners currently unsupported under Ravenwood; return FD directly
+ */
+ public static int acquireRawFd(FileDescriptor fd) {
+ return JvmWorkaround.getInstance().getFdInt(fd);
+ }
}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/FP16.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/FP16.java
new file mode 100644
index 0000000..478503b
--- /dev/null
+++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/FP16.java
@@ -0,0 +1,814 @@
+/*
+ * Copyright (C) 2019 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 libcore.util;
+
+/**
+ * <p>The {@code FP16} class is a wrapper and a utility class to manipulate half-precision 16-bit
+ * <a href="https://en.wikipedia.org/wiki/Half-precision_floating-point_format">IEEE 754</a>
+ * floating point data types (also called fp16 or binary16). A half-precision float can be
+ * created from or converted to single-precision floats, and is stored in a short data type.
+ *
+ * <p>The IEEE 754 standard specifies an fp16 as having the following format:</p>
+ * <ul>
+ * <li>Sign bit: 1 bit</li>
+ * <li>Exponent width: 5 bits</li>
+ * <li>Significand: 10 bits</li>
+ * </ul>
+ *
+ * <p>The format is laid out as follows:</p>
+ * <pre>
+ * 1 11111 1111111111
+ * ^ --^-- -----^----
+ * sign | |_______ significand
+ * |
+ * -- exponent
+ * </pre>
+ *
+ * <p>Half-precision floating points can be useful to save memory and/or
+ * bandwidth at the expense of range and precision when compared to single-precision
+ * floating points (fp32).</p>
+ * <p>To help you decide whether fp16 is the right storage type for you need, please
+ * refer to the table below that shows the available precision throughout the range of
+ * possible values. The <em>precision</em> column indicates the step size between two
+ * consecutive numbers in a specific part of the range.</p>
+ *
+ * <table summary="Precision of fp16 across the range">
+ * <tr><th>Range start</th><th>Precision</th></tr>
+ * <tr><td>0</td><td>1 ⁄ 16,777,216</td></tr>
+ * <tr><td>1 ⁄ 16,384</td><td>1 ⁄ 16,777,216</td></tr>
+ * <tr><td>1 ⁄ 8,192</td><td>1 ⁄ 8,388,608</td></tr>
+ * <tr><td>1 ⁄ 4,096</td><td>1 ⁄ 4,194,304</td></tr>
+ * <tr><td>1 ⁄ 2,048</td><td>1 ⁄ 2,097,152</td></tr>
+ * <tr><td>1 ⁄ 1,024</td><td>1 ⁄ 1,048,576</td></tr>
+ * <tr><td>1 ⁄ 512</td><td>1 ⁄ 524,288</td></tr>
+ * <tr><td>1 ⁄ 256</td><td>1 ⁄ 262,144</td></tr>
+ * <tr><td>1 ⁄ 128</td><td>1 ⁄ 131,072</td></tr>
+ * <tr><td>1 ⁄ 64</td><td>1 ⁄ 65,536</td></tr>
+ * <tr><td>1 ⁄ 32</td><td>1 ⁄ 32,768</td></tr>
+ * <tr><td>1 ⁄ 16</td><td>1 ⁄ 16,384</td></tr>
+ * <tr><td>1 ⁄ 8</td><td>1 ⁄ 8,192</td></tr>
+ * <tr><td>1 ⁄ 4</td><td>1 ⁄ 4,096</td></tr>
+ * <tr><td>1 ⁄ 2</td><td>1 ⁄ 2,048</td></tr>
+ * <tr><td>1</td><td>1 ⁄ 1,024</td></tr>
+ * <tr><td>2</td><td>1 ⁄ 512</td></tr>
+ * <tr><td>4</td><td>1 ⁄ 256</td></tr>
+ * <tr><td>8</td><td>1 ⁄ 128</td></tr>
+ * <tr><td>16</td><td>1 ⁄ 64</td></tr>
+ * <tr><td>32</td><td>1 ⁄ 32</td></tr>
+ * <tr><td>64</td><td>1 ⁄ 16</td></tr>
+ * <tr><td>128</td><td>1 ⁄ 8</td></tr>
+ * <tr><td>256</td><td>1 ⁄ 4</td></tr>
+ * <tr><td>512</td><td>1 ⁄ 2</td></tr>
+ * <tr><td>1,024</td><td>1</td></tr>
+ * <tr><td>2,048</td><td>2</td></tr>
+ * <tr><td>4,096</td><td>4</td></tr>
+ * <tr><td>8,192</td><td>8</td></tr>
+ * <tr><td>16,384</td><td>16</td></tr>
+ * <tr><td>32,768</td><td>32</td></tr>
+ * </table>
+ *
+ * <p>This table shows that numbers higher than 1024 lose all fractional precision.</p>
+ *
+ * @hide
+ */
+
+public final class FP16 {
+ /**
+ * The number of bits used to represent a half-precision float value.
+ *
+ * @hide
+ */
+ public static final int SIZE = 16;
+
+ /**
+ * Epsilon is the difference between 1.0 and the next value representable
+ * by a half-precision floating-point.
+ *
+ * @hide
+ */
+ public static final short EPSILON = (short) 0x1400;
+
+ /**
+ * Maximum exponent a finite half-precision float may have.
+ *
+ * @hide
+ */
+ public static final int MAX_EXPONENT = 15;
+ /**
+ * Minimum exponent a normalized half-precision float may have.
+ *
+ * @hide
+ */
+ public static final int MIN_EXPONENT = -14;
+
+ /**
+ * Smallest negative value a half-precision float may have.
+ *
+ * @hide
+ */
+ public static final short LOWEST_VALUE = (short) 0xfbff;
+ /**
+ * Maximum positive finite value a half-precision float may have.
+ *
+ * @hide
+ */
+ public static final short MAX_VALUE = (short) 0x7bff;
+ /**
+ * Smallest positive normal value a half-precision float may have.
+ *
+ * @hide
+ */
+ public static final short MIN_NORMAL = (short) 0x0400;
+ /**
+ * Smallest positive non-zero value a half-precision float may have.
+ *
+ * @hide
+ */
+ public static final short MIN_VALUE = (short) 0x0001;
+ /**
+ * A Not-a-Number representation of a half-precision float.
+ *
+ * @hide
+ */
+ public static final short NaN = (short) 0x7e00;
+ /**
+ * Negative infinity of type half-precision float.
+ *
+ * @hide
+ */
+ public static final short NEGATIVE_INFINITY = (short) 0xfc00;
+ /**
+ * Negative 0 of type half-precision float.
+ *
+ * @hide
+ */
+ public static final short NEGATIVE_ZERO = (short) 0x8000;
+ /**
+ * Positive infinity of type half-precision float.
+ *
+ * @hide
+ */
+ public static final short POSITIVE_INFINITY = (short) 0x7c00;
+ /**
+ * Positive 0 of type half-precision float.
+ *
+ * @hide
+ */
+ public static final short POSITIVE_ZERO = (short) 0x0000;
+
+ /**
+ * The offset to shift by to obtain the sign bit.
+ *
+ * @hide
+ */
+ public static final int SIGN_SHIFT = 15;
+
+ /**
+ * The offset to shift by to obtain the exponent bits.
+ *
+ * @hide
+ */
+ public static final int EXPONENT_SHIFT = 10;
+
+ /**
+ * The bitmask to AND a number with to obtain the sign bit.
+ *
+ * @hide
+ */
+ public static final int SIGN_MASK = 0x8000;
+
+ /**
+ * The bitmask to AND a number shifted by {@link #EXPONENT_SHIFT} right, to obtain exponent bits.
+ *
+ * @hide
+ */
+ public static final int SHIFTED_EXPONENT_MASK = 0x1f;
+
+ /**
+ * The bitmask to AND a number with to obtain significand bits.
+ *
+ * @hide
+ */
+ public static final int SIGNIFICAND_MASK = 0x3ff;
+
+ /**
+ * The bitmask to AND with to obtain exponent and significand bits.
+ *
+ * @hide
+ */
+ public static final int EXPONENT_SIGNIFICAND_MASK = 0x7fff;
+
+ /**
+ * The offset of the exponent from the actual value.
+ *
+ * @hide
+ */
+ public static final int EXPONENT_BIAS = 15;
+
+ private static final int FP32_SIGN_SHIFT = 31;
+ private static final int FP32_EXPONENT_SHIFT = 23;
+ private static final int FP32_SHIFTED_EXPONENT_MASK = 0xff;
+ private static final int FP32_SIGNIFICAND_MASK = 0x7fffff;
+ private static final int FP32_EXPONENT_BIAS = 127;
+ private static final int FP32_QNAN_MASK = 0x400000;
+ private static final int FP32_DENORMAL_MAGIC = 126 << 23;
+ private static final float FP32_DENORMAL_FLOAT = Float.intBitsToFloat(FP32_DENORMAL_MAGIC);
+
+ /** Hidden constructor to prevent instantiation. */
+ private FP16() {}
+
+ /**
+ * <p>Compares the two specified half-precision float values. The following
+ * conditions apply during the comparison:</p>
+ *
+ * <ul>
+ * <li>{@link #NaN} is considered by this method to be equal to itself and greater
+ * than all other half-precision float values (including {@code #POSITIVE_INFINITY})</li>
+ * <li>{@link #POSITIVE_ZERO} is considered by this method to be greater than
+ * {@link #NEGATIVE_ZERO}.</li>
+ * </ul>
+ *
+ * @param x The first half-precision float value to compare.
+ * @param y The second half-precision float value to compare
+ *
+ * @return The value {@code 0} if {@code x} is numerically equal to {@code y}, a
+ * value less than {@code 0} if {@code x} is numerically less than {@code y},
+ * and a value greater than {@code 0} if {@code x} is numerically greater
+ * than {@code y}
+ *
+ * @hide
+ */
+ public static int compare(short x, short y) {
+ if (less(x, y)) return -1;
+ if (greater(x, y)) return 1;
+
+ // Collapse NaNs, akin to halfToIntBits(), but we want to keep
+ // (signed) short value types to preserve the ordering of -0.0
+ // and +0.0
+ short xBits = isNaN(x) ? NaN : x;
+ short yBits = isNaN(y) ? NaN : y;
+
+ return (xBits == yBits ? 0 : (xBits < yBits ? -1 : 1));
+ }
+
+ /**
+ * Returns the closest integral half-precision float value to the specified
+ * half-precision float value. Special values are handled in the
+ * following ways:
+ * <ul>
+ * <li>If the specified half-precision float is NaN, the result is NaN</li>
+ * <li>If the specified half-precision float is infinity (negative or positive),
+ * the result is infinity (with the same sign)</li>
+ * <li>If the specified half-precision float is zero (negative or positive),
+ * the result is zero (with the same sign)</li>
+ * </ul>
+ *
+ * @param h A half-precision float value
+ * @return The value of the specified half-precision float rounded to the nearest
+ * half-precision float value
+ *
+ * @hide
+ */
+ public static short rint(short h) {
+ int bits = h & 0xffff;
+ int abs = bits & EXPONENT_SIGNIFICAND_MASK;
+ int result = bits;
+
+ if (abs < 0x3c00) {
+ result &= SIGN_MASK;
+ if (abs > 0x3800){
+ result |= 0x3c00;
+ }
+ } else if (abs < 0x6400) {
+ int exp = 25 - (abs >> 10);
+ int mask = (1 << exp) - 1;
+ result += ((1 << (exp - 1)) - (~(abs >> exp) & 1));
+ result &= ~mask;
+ }
+ if (isNaN((short) result)) {
+ // if result is NaN mask with qNaN
+ // (i.e. mask the most significant mantissa bit with 1)
+ // to comply with hardware implementations (ARM64, Intel, etc).
+ result |= NaN;
+ }
+
+ return (short) result;
+ }
+
+ /**
+ * Returns the smallest half-precision float value toward negative infinity
+ * greater than or equal to the specified half-precision float value.
+ * Special values are handled in the following ways:
+ * <ul>
+ * <li>If the specified half-precision float is NaN, the result is NaN</li>
+ * <li>If the specified half-precision float is infinity (negative or positive),
+ * the result is infinity (with the same sign)</li>
+ * <li>If the specified half-precision float is zero (negative or positive),
+ * the result is zero (with the same sign)</li>
+ * </ul>
+ *
+ * @param h A half-precision float value
+ * @return The smallest half-precision float value toward negative infinity
+ * greater than or equal to the specified half-precision float value
+ *
+ * @hide
+ */
+ public static short ceil(short h) {
+ int bits = h & 0xffff;
+ int abs = bits & EXPONENT_SIGNIFICAND_MASK;
+ int result = bits;
+
+ if (abs < 0x3c00) {
+ result &= SIGN_MASK;
+ result |= 0x3c00 & -(~(bits >> 15) & (abs != 0 ? 1 : 0));
+ } else if (abs < 0x6400) {
+ abs = 25 - (abs >> 10);
+ int mask = (1 << abs) - 1;
+ result += mask & ((bits >> 15) - 1);
+ result &= ~mask;
+ }
+ if (isNaN((short) result)) {
+ // if result is NaN mask with qNaN
+ // (i.e. mask the most significant mantissa bit with 1)
+ // to comply with hardware implementations (ARM64, Intel, etc).
+ result |= NaN;
+ }
+
+ return (short) result;
+ }
+
+ /**
+ * Returns the largest half-precision float value toward positive infinity
+ * less than or equal to the specified half-precision float value.
+ * Special values are handled in the following ways:
+ * <ul>
+ * <li>If the specified half-precision float is NaN, the result is NaN</li>
+ * <li>If the specified half-precision float is infinity (negative or positive),
+ * the result is infinity (with the same sign)</li>
+ * <li>If the specified half-precision float is zero (negative or positive),
+ * the result is zero (with the same sign)</li>
+ * </ul>
+ *
+ * @param h A half-precision float value
+ * @return The largest half-precision float value toward positive infinity
+ * less than or equal to the specified half-precision float value
+ *
+ * @hide
+ */
+ public static short floor(short h) {
+ int bits = h & 0xffff;
+ int abs = bits & EXPONENT_SIGNIFICAND_MASK;
+ int result = bits;
+
+ if (abs < 0x3c00) {
+ result &= SIGN_MASK;
+ result |= 0x3c00 & (bits > 0x8000 ? 0xffff : 0x0);
+ } else if (abs < 0x6400) {
+ abs = 25 - (abs >> 10);
+ int mask = (1 << abs) - 1;
+ result += mask & -(bits >> 15);
+ result &= ~mask;
+ }
+ if (isNaN((short) result)) {
+ // if result is NaN mask with qNaN
+ // i.e. (Mask the most significant mantissa bit with 1)
+ result |= NaN;
+ }
+
+ return (short) result;
+ }
+
+ /**
+ * Returns the truncated half-precision float value of the specified
+ * half-precision float value. Special values are handled in the following ways:
+ * <ul>
+ * <li>If the specified half-precision float is NaN, the result is NaN</li>
+ * <li>If the specified half-precision float is infinity (negative or positive),
+ * the result is infinity (with the same sign)</li>
+ * <li>If the specified half-precision float is zero (negative or positive),
+ * the result is zero (with the same sign)</li>
+ * </ul>
+ *
+ * @param h A half-precision float value
+ * @return The truncated half-precision float value of the specified
+ * half-precision float value
+ *
+ * @hide
+ */
+ public static short trunc(short h) {
+ int bits = h & 0xffff;
+ int abs = bits & EXPONENT_SIGNIFICAND_MASK;
+ int result = bits;
+
+ if (abs < 0x3c00) {
+ result &= SIGN_MASK;
+ } else if (abs < 0x6400) {
+ abs = 25 - (abs >> 10);
+ int mask = (1 << abs) - 1;
+ result &= ~mask;
+ }
+
+ return (short) result;
+ }
+
+ /**
+ * Returns the smaller of two half-precision float values (the value closest
+ * to negative infinity). Special values are handled in the following ways:
+ * <ul>
+ * <li>If either value is NaN, the result is NaN</li>
+ * <li>{@link #NEGATIVE_ZERO} is smaller than {@link #POSITIVE_ZERO}</li>
+ * </ul>
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ * @return The smaller of the two specified half-precision values
+ *
+ * @hide
+ */
+ public static short min(short x, short y) {
+ if (isNaN(x)) return NaN;
+ if (isNaN(y)) return NaN;
+
+ if ((x & EXPONENT_SIGNIFICAND_MASK) == 0 && (y & EXPONENT_SIGNIFICAND_MASK) == 0) {
+ return (x & SIGN_MASK) != 0 ? x : y;
+ }
+
+ return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) <
+ ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff) ? x : y;
+ }
+
+ /**
+ * Returns the larger of two half-precision float values (the value closest
+ * to positive infinity). Special values are handled in the following ways:
+ * <ul>
+ * <li>If either value is NaN, the result is NaN</li>
+ * <li>{@link #POSITIVE_ZERO} is greater than {@link #NEGATIVE_ZERO}</li>
+ * </ul>
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ *
+ * @return The larger of the two specified half-precision values
+ *
+ * @hide
+ */
+ public static short max(short x, short y) {
+ if (isNaN(x)) return NaN;
+ if (isNaN(y)) return NaN;
+
+ if ((x & EXPONENT_SIGNIFICAND_MASK) == 0 && (y & EXPONENT_SIGNIFICAND_MASK) == 0) {
+ return (x & SIGN_MASK) != 0 ? y : x;
+ }
+
+ return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) >
+ ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff) ? x : y;
+ }
+
+ /**
+ * Returns true if the first half-precision float value is less (smaller
+ * toward negative infinity) than the second half-precision float value.
+ * If either of the values is NaN, the result is false.
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ *
+ * @return True if x is less than y, false otherwise
+ *
+ * @hide
+ */
+ public static boolean less(short x, short y) {
+ if (isNaN(x)) return false;
+ if (isNaN(y)) return false;
+
+ return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) <
+ ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff);
+ }
+
+ /**
+ * Returns true if the first half-precision float value is less (smaller
+ * toward negative infinity) than or equal to the second half-precision
+ * float value. If either of the values is NaN, the result is false.
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ *
+ * @return True if x is less than or equal to y, false otherwise
+ *
+ * @hide
+ */
+ public static boolean lessEquals(short x, short y) {
+ if (isNaN(x)) return false;
+ if (isNaN(y)) return false;
+
+ return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) <=
+ ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff);
+ }
+
+ /**
+ * Returns true if the first half-precision float value is greater (larger
+ * toward positive infinity) than the second half-precision float value.
+ * If either of the values is NaN, the result is false.
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ *
+ * @return True if x is greater than y, false otherwise
+ *
+ * @hide
+ */
+ public static boolean greater(short x, short y) {
+ if (isNaN(x)) return false;
+ if (isNaN(y)) return false;
+
+ return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) >
+ ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff);
+ }
+
+ /**
+ * Returns true if the first half-precision float value is greater (larger
+ * toward positive infinity) than or equal to the second half-precision float
+ * value. If either of the values is NaN, the result is false.
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ *
+ * @return True if x is greater than y, false otherwise
+ *
+ * @hide
+ */
+ public static boolean greaterEquals(short x, short y) {
+ if (isNaN(x)) return false;
+ if (isNaN(y)) return false;
+
+ return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) >=
+ ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff);
+ }
+
+ /**
+ * Returns true if the two half-precision float values are equal.
+ * If either of the values is NaN, the result is false. {@link #POSITIVE_ZERO}
+ * and {@link #NEGATIVE_ZERO} are considered equal.
+ *
+ * @param x The first half-precision value
+ * @param y The second half-precision value
+ *
+ * @return True if x is equal to y, false otherwise
+ *
+ * @hide
+ */
+ public static boolean equals(short x, short y) {
+ if (isNaN(x)) return false;
+ if (isNaN(y)) return false;
+
+ return x == y || ((x | y) & EXPONENT_SIGNIFICAND_MASK) == 0;
+ }
+
+ /**
+ * Returns true if the specified half-precision float value represents
+ * infinity, false otherwise.
+ *
+ * @param h A half-precision float value
+ * @return True if the value is positive infinity or negative infinity,
+ * false otherwise
+ *
+ * @hide
+ */
+ public static boolean isInfinite(short h) {
+ return (h & EXPONENT_SIGNIFICAND_MASK) == POSITIVE_INFINITY;
+ }
+
+ /**
+ * Returns true if the specified half-precision float value represents
+ * a Not-a-Number, false otherwise.
+ *
+ * @param h A half-precision float value
+ * @return True if the value is a NaN, false otherwise
+ *
+ * @hide
+ */
+ public static boolean isNaN(short h) {
+ return (h & EXPONENT_SIGNIFICAND_MASK) > POSITIVE_INFINITY;
+ }
+
+ /**
+ * Returns true if the specified half-precision float value is normalized
+ * (does not have a subnormal representation). If the specified value is
+ * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY},
+ * {@link #POSITIVE_ZERO}, {@link #NEGATIVE_ZERO}, NaN or any subnormal
+ * number, this method returns false.
+ *
+ * @param h A half-precision float value
+ * @return True if the value is normalized, false otherwise
+ *
+ * @hide
+ */
+ public static boolean isNormalized(short h) {
+ return (h & POSITIVE_INFINITY) != 0 && (h & POSITIVE_INFINITY) != POSITIVE_INFINITY;
+ }
+
+ /**
+ * <p>Converts the specified half-precision float value into a
+ * single-precision float value. The following special cases are handled:</p>
+ * <ul>
+ * <li>If the input is {@link #NaN}, the returned value is {@link Float#NaN}</li>
+ * <li>If the input is {@link #POSITIVE_INFINITY} or
+ * {@link #NEGATIVE_INFINITY}, the returned value is respectively
+ * {@link Float#POSITIVE_INFINITY} or {@link Float#NEGATIVE_INFINITY}</li>
+ * <li>If the input is 0 (positive or negative), the returned value is +/-0.0f</li>
+ * <li>Otherwise, the returned value is a normalized single-precision float value</li>
+ * </ul>
+ *
+ * @param h The half-precision float value to convert to single-precision
+ * @return A normalized single-precision float value
+ *
+ * @hide
+ */
+ public static float toFloat(short h) {
+ int bits = h & 0xffff;
+ int s = bits & SIGN_MASK;
+ int e = (bits >>> EXPONENT_SHIFT) & SHIFTED_EXPONENT_MASK;
+ int m = (bits ) & SIGNIFICAND_MASK;
+
+ int outE = 0;
+ int outM = 0;
+
+ if (e == 0) { // Denormal or 0
+ if (m != 0) {
+ // Convert denorm fp16 into normalized fp32
+ float o = Float.intBitsToFloat(FP32_DENORMAL_MAGIC + m);
+ o -= FP32_DENORMAL_FLOAT;
+ return s == 0 ? o : -o;
+ }
+ } else {
+ outM = m << 13;
+ if (e == 0x1f) { // Infinite or NaN
+ outE = 0xff;
+ if (outM != 0) { // SNaNs are quieted
+ outM |= FP32_QNAN_MASK;
+ }
+ } else {
+ outE = e - EXPONENT_BIAS + FP32_EXPONENT_BIAS;
+ }
+ }
+
+ int out = (s << 16) | (outE << FP32_EXPONENT_SHIFT) | outM;
+ return Float.intBitsToFloat(out);
+ }
+
+ /**
+ * <p>Converts the specified single-precision float value into a
+ * half-precision float value. The following special cases are handled:</p>
+ * <ul>
+ * <li>If the input is NaN (see {@link Float#isNaN(float)}), the returned
+ * value is {@link #NaN}</li>
+ * <li>If the input is {@link Float#POSITIVE_INFINITY} or
+ * {@link Float#NEGATIVE_INFINITY}, the returned value is respectively
+ * {@link #POSITIVE_INFINITY} or {@link #NEGATIVE_INFINITY}</li>
+ * <li>If the input is 0 (positive or negative), the returned value is
+ * {@link #POSITIVE_ZERO} or {@link #NEGATIVE_ZERO}</li>
+ * <li>If the input is a less than {@link #MIN_VALUE}, the returned value
+ * is flushed to {@link #POSITIVE_ZERO} or {@link #NEGATIVE_ZERO}</li>
+ * <li>If the input is a less than {@link #MIN_NORMAL}, the returned value
+ * is a denorm half-precision float</li>
+ * <li>Otherwise, the returned value is rounded to the nearest
+ * representable half-precision float value</li>
+ * </ul>
+ *
+ * @param f The single-precision float value to convert to half-precision
+ * @return A half-precision float value
+ *
+ * @hide
+ */
+ public static short toHalf(float f) {
+ int bits = Float.floatToRawIntBits(f);
+ int s = (bits >>> FP32_SIGN_SHIFT );
+ int e = (bits >>> FP32_EXPONENT_SHIFT) & FP32_SHIFTED_EXPONENT_MASK;
+ int m = (bits ) & FP32_SIGNIFICAND_MASK;
+
+ int outE = 0;
+ int outM = 0;
+
+ if (e == 0xff) { // Infinite or NaN
+ outE = 0x1f;
+ outM = m != 0 ? 0x200 : 0;
+ } else {
+ e = e - FP32_EXPONENT_BIAS + EXPONENT_BIAS;
+ if (e >= 0x1f) { // Overflow
+ outE = 0x1f;
+ } else if (e <= 0) { // Underflow
+ if (e < -10) {
+ // The absolute fp32 value is less than MIN_VALUE, flush to +/-0
+ } else {
+ // The fp32 value is a normalized float less than MIN_NORMAL,
+ // we convert to a denorm fp16
+ m = m | 0x800000;
+ int shift = 14 - e;
+ outM = m >> shift;
+
+ int lowm = m & ((1 << shift) - 1);
+ int hway = 1 << (shift - 1);
+ // if above halfway or exactly halfway and outM is odd
+ if (lowm + (outM & 1) > hway){
+ // Round to nearest even
+ // Can overflow into exponent bit, which surprisingly is OK.
+ // This increment relies on the +outM in the return statement below
+ outM++;
+ }
+ }
+ } else {
+ outE = e;
+ outM = m >> 13;
+ // if above halfway or exactly halfway and outM is odd
+ if ((m & 0x1fff) + (outM & 0x1) > 0x1000) {
+ // Round to nearest even
+ // Can overflow into exponent bit, which surprisingly is OK.
+ // This increment relies on the +outM in the return statement below
+ outM++;
+ }
+ }
+ }
+ // The outM is added here as the +1 increments for outM above can
+ // cause an overflow in the exponent bit which is OK.
+ return (short) ((s << SIGN_SHIFT) | (outE << EXPONENT_SHIFT) + outM);
+ }
+
+ /**
+ * <p>Returns a hexadecimal string representation of the specified half-precision
+ * float value. If the value is a NaN, the result is <code>"NaN"</code>,
+ * otherwise the result follows this format:</p>
+ * <ul>
+ * <li>If the sign is positive, no sign character appears in the result</li>
+ * <li>If the sign is negative, the first character is <code>'-'</code></li>
+ * <li>If the value is inifinity, the string is <code>"Infinity"</code></li>
+ * <li>If the value is 0, the string is <code>"0x0.0p0"</code></li>
+ * <li>If the value has a normalized representation, the exponent and
+ * significand are represented in the string in two fields. The significand
+ * starts with <code>"0x1."</code> followed by its lowercase hexadecimal
+ * representation. Trailing zeroes are removed unless all digits are 0, then
+ * a single zero is used. The significand representation is followed by the
+ * exponent, represented by <code>"p"</code>, itself followed by a decimal
+ * string of the unbiased exponent</li>
+ * <li>If the value has a subnormal representation, the significand starts
+ * with <code>"0x0."</code> followed by its lowercase hexadecimal
+ * representation. Trailing zeroes are removed unless all digits are 0, then
+ * a single zero is used. The significand representation is followed by the
+ * exponent, represented by <code>"p-14"</code></li>
+ * </ul>
+ *
+ * @param h A half-precision float value
+ * @return A hexadecimal string representation of the specified value
+ *
+ * @hide
+ */
+ public static String toHexString(short h) {
+ StringBuilder o = new StringBuilder();
+
+ int bits = h & 0xffff;
+ int s = (bits >>> SIGN_SHIFT );
+ int e = (bits >>> EXPONENT_SHIFT) & SHIFTED_EXPONENT_MASK;
+ int m = (bits ) & SIGNIFICAND_MASK;
+
+ if (e == 0x1f) { // Infinite or NaN
+ if (m == 0) {
+ if (s != 0) o.append('-');
+ o.append("Infinity");
+ } else {
+ o.append("NaN");
+ }
+ } else {
+ if (s == 1) o.append('-');
+ if (e == 0) {
+ if (m == 0) {
+ o.append("0x0.0p0");
+ } else {
+ o.append("0x0.");
+ String significand = Integer.toHexString(m);
+ o.append(significand.replaceFirst("0{2,}$", ""));
+ o.append("p-14");
+ }
+ } else {
+ o.append("0x1.");
+ String significand = Integer.toHexString(m);
+ o.append(significand.replaceFirst("0{2,}$", ""));
+ o.append('p');
+ o.append(Integer.toString(e - EXPONENT_BIAS));
+ }
+ }
+
+ return o.toString();
+ }
+}
diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java
index 14b5a4f..4e7dc5d 100644
--- a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java
+++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java
@@ -15,7 +15,7 @@
*/
package libcore.util;
-import com.android.ravenwood.common.RavenwoodRuntimeNative;
+import com.android.ravenwood.RavenwoodRuntimeNative;
import java.lang.ref.Cleaner;
import java.lang.ref.Reference;
diff --git a/ravenwood/runtime-jni/ravenwood_runtime.cpp b/ravenwood/runtime-jni/ravenwood_runtime.cpp
index c804928..c255be5 100644
--- a/ravenwood/runtime-jni/ravenwood_runtime.cpp
+++ b/ravenwood/runtime-jni/ravenwood_runtime.cpp
@@ -214,6 +214,19 @@
return throwIfMinusOne(env, "open", TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode)));
}
+static void Linux_setenv(JNIEnv* env, jobject, jstring javaName, jstring javaValue,
+ jboolean overwrite) {
+ ScopedRealUtf8Chars name(env, javaName);
+ if (name.c_str() == NULL) {
+ jniThrowNullPointerException(env);
+ }
+ ScopedRealUtf8Chars value(env, javaValue);
+ if (value.c_str() == NULL) {
+ jniThrowNullPointerException(env);
+ }
+ throwIfMinusOne(env, "setenv", setenv(name.c_str(), value.c_str(), overwrite ? 1 : 0));
+}
+
// ---- Registration ----
static const JNINativeMethod sMethods[] =
@@ -227,6 +240,7 @@
{ "lstat", "(Ljava/lang/String;)Landroid/system/StructStat;", (void*)Linux_lstat },
{ "stat", "(Ljava/lang/String;)Landroid/system/StructStat;", (void*)Linux_stat },
{ "nOpen", "(Ljava/lang/String;II)I", (void*)Linux_open },
+ { "setenv", "(Ljava/lang/String;Ljava/lang/String;Z)V", (void*)Linux_setenv },
};
extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
@@ -245,7 +259,7 @@
g_StructStat = findClass(env, "android/system/StructStat");
g_StructTimespecClass = findClass(env, "android/system/StructTimespec");
- jint res = jniRegisterNativeMethods(env, "com/android/ravenwood/common/RavenwoodRuntimeNative",
+ jint res = jniRegisterNativeMethods(env, "com/android/ravenwood/RavenwoodRuntimeNative",
sMethods, NELEM(sMethods));
if (res < 0) {
return res;
diff --git a/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsConstantsTest.java b/ravenwood/runtime-test/test/com/android/ravenwoodtest/runtimetest/OsConstantsTest.java
similarity index 99%
rename from ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsConstantsTest.java
rename to ravenwood/runtime-test/test/com/android/ravenwoodtest/runtimetest/OsConstantsTest.java
index 3332e24..633ed4e 100644
--- a/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsConstantsTest.java
+++ b/ravenwood/runtime-test/test/com/android/ravenwoodtest/runtimetest/OsConstantsTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.ravenwood.runtimetest;
+package com.android.ravenwoodtest.runtimetest;
// Copied from libcore/luni/src/test/java/libcore/android/system/OsConstantsTest.java
diff --git a/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java b/ravenwood/runtime-test/test/com/android/ravenwoodtest/runtimetest/OsTest.java
similarity index 99%
rename from ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java
rename to ravenwood/runtime-test/test/com/android/ravenwoodtest/runtimetest/OsTest.java
index 05275b2..c2230c7 100644
--- a/ravenwood/runtime-test/test/com/android/ravenwood/runtimetest/OsTest.java
+++ b/ravenwood/runtime-test/test/com/android/ravenwoodtest/runtimetest/OsTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.ravenwood.runtimetest;
+package com.android.ravenwoodtest.runtimetest;
import static android.system.OsConstants.S_ISBLK;
import static android.system.OsConstants.S_ISCHR;
diff --git a/ravenwood/scripts/list-ravenwood-tests.sh b/ravenwood/scripts/list-ravenwood-tests.sh
index fb9b823..05f3fdf 100755
--- a/ravenwood/scripts/list-ravenwood-tests.sh
+++ b/ravenwood/scripts/list-ravenwood-tests.sh
@@ -15,4 +15,4 @@
# List all the ravenwood test modules.
-jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json"
+jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json" | sort
diff --git a/ravenwood/tools/ravenizer-fake/ravenizer b/ravenwood/scripts/remove-ravenizer-output.sh
similarity index 60%
rename from ravenwood/tools/ravenizer-fake/ravenizer
rename to ravenwood/scripts/remove-ravenizer-output.sh
index 84b3c8e..be15b71 100755
--- a/ravenwood/tools/ravenizer-fake/ravenizer
+++ b/ravenwood/scripts/remove-ravenizer-output.sh
@@ -13,19 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# "Fake" ravenizer, which just copies the file.
-# We need it to add ravenizer support to Soong on AOSP,
-# when the actual ravenizer is not in AOSP yet.
+# Delete all the ravenizer output jar files from Soong's intermediate directory.
-invalid_arg() {
- echo "Ravenizer(fake): invalid args" 1>&2
- exit 1
-}
+# `-a -prune` is needed because otherwise find would be confused if the directory disappears.
-(( $# >= 4 )) || invalid_arg
-[[ "$1" == "--in-jar" ]] || invalid_arg
-[[ "$3" == "--out-jar" ]] || invalid_arg
-
-echo "Ravenizer(fake): copiyng $2 to $4"
-
-cp "$2" "$4"
+find "${ANDROID_BUILD_TOP:?}/out/soong/.intermediates/" \
+ -type d \
+ -name 'ravenizer' \
+ -print \
+ -exec rm -fr \{\} \; \
+ -a -prune
diff --git a/ravenwood/scripts/shrink-systemui-test b/ravenwood/scripts/shrink-systemui-test
new file mode 100755
index 0000000..8589c1d
--- /dev/null
+++ b/ravenwood/scripts/shrink-systemui-test
@@ -0,0 +1,131 @@
+#!/bin/bash
+# Copyright (C) 2024 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.
+
+set -e
+
+SCRIPT_NAME="${0##*/}"
+
+usage() {
+ cat <<"EOF"
+
+$SCRIPT_NAME: Shrink / unshrink SystemUiRavenTests.
+
+ SystemUiRavenTests has a lot of kotlin source files, so it's slow to build,
+ which is painful when you want to run it after updating ravenwood code
+ that SystemUiRavenTests depends on. (example: junit-src/)
+
+ This script basically removes the test files in SystemUI/multivalentTests
+ that don't have @EnabledOnRavenwood. But if we actaully remove them,
+ soong would re-generate the ninja file, which will take a long time,
+ so instead it'll truncate them.
+
+ This script will also tell git to ignore these files, so they won't shw up
+ in `git status`.
+ (Use `git ls-files -v | sed -ne "s/^[a-zS] //p"` to show ignored filse.)
+
+Usage:
+ $SCRIPT_NAME -s # Shrink the test files.
+
+ $SCRIPT_NAME -u # Undo it.
+
+EOF
+}
+
+TEST_PATH=${ANDROID_BUILD_TOP}/frameworks/base/packages/SystemUI/multivalentTests
+cd "$TEST_PATH"
+
+command=""
+case "$1" in
+ "-s") command=shrink ;;
+ "-u") command=unshrink ;;
+ *) usage ; exit 1 ;;
+esac
+
+
+echo "Listing test files...."
+files=( $(find . -name '*Test.kt' -o -name '*Test.java') )
+
+exemption='(BaseHeadsUpManagerTest)'
+
+shrink() {
+ local target=()
+ for file in ${files[@]}; do
+ # Check for exemption
+ if echo $file | egrep -q "$exemption"; then
+ echo " Skip exempted file"
+ continue
+ fi
+
+ echo "Checking $file"
+ if ! [[ -f $file ]] ; then
+ echo " Skip non regular file"
+ continue
+ fi
+
+ if ! [[ -s $file ]] ; then
+ echo " Skip empty file"
+ continue
+ fi
+
+ if grep -q '@EnabledOnRavenwood' $file ; then
+ echo " Skip ravenwood test file".
+ continue
+ fi
+
+ # It's a non ravenwood test file. Empty it.
+ : > $file
+
+ # Tell git to ignore the file
+
+ target+=($file)
+
+ echo " Emptied"
+
+ done
+ if (( ${#target[@]} == 0 )) ; then
+ echo "No files emptied."
+ return 0
+ fi
+
+ git update-index --skip-worktree ${target[@]}
+
+ echo "Emptied ${#target[@]} files"
+ return 0
+}
+
+unshrink() {
+ local target=()
+
+ # Collect empty files
+ for file in ${files[@]}; do
+ if [[ -s $file ]] ; then
+ continue
+ fi
+
+ target+=($file)
+ : > $file
+ done
+ if (( ${#target[@]} == 0 )) ; then
+ echo "No files to restore."
+ return 0
+ fi
+ # Un-ignore the files, and check out the original files
+ echo "Restoring ${#target[@]} files..."
+ git update-index --no-skip-worktree ${target[@]}
+ git checkout goog/main ${target[@]}
+ return 0
+}
+
+$command
diff --git a/ravenwood/scripts/update-test-mapping.sh b/ravenwood/scripts/update-test-mapping.sh
new file mode 100755
index 0000000..e478b50
--- /dev/null
+++ b/ravenwood/scripts/update-test-mapping.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+# Copyright (C) 2024 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.
+
+# Update f/b/r/TEST_MAPPING with all the ravenwood tests as presubmit.
+#
+# Note, before running it, make sure module-info.json is up-to-date by running
+# (any) build.
+
+set -e
+
+# Tests that shouldn't be in presubmit.
+EXEMPT='^(SystemUiRavenTests)$'
+
+main() {
+ local script_name="${0##*/}"
+ local script_dir="${0%/*}"
+ local test_mapping="$script_dir/../TEST_MAPPING"
+ local test_mapping_bak="$script_dir/../TEST_MAPPING.bak"
+
+ local header="$(sed -ne '1,/AUTO-GENERATED-START/p' "$test_mapping")"
+ local footer="$(sed -ne '/AUTO-GENERATED-END/,$p' "$test_mapping")"
+
+ echo "Getting all tests"
+ local tests=( $("$script_dir/list-ravenwood-tests.sh" | grep -vP "$EXEMPT") )
+
+ local num_tests="${#tests[@]}"
+
+ if (( $num_tests == 0 )) ; then
+ echo "Something went wrong. No ravenwood tests detected." 1>&2
+ return 1
+ fi
+
+ echo "Tests: ${tests[@]}"
+
+ echo "Creating backup at $test_mapping_bak"
+ cp "$test_mapping" "$test_mapping_bak"
+
+ echo "Updating $test_mapping"
+ {
+ echo "$header"
+
+ echo " // DO NOT MODIFY MANUALLY"
+ echo " // Use scripts/$script_name to update it."
+
+ local i=0
+ while (( $i < $num_tests )) ; do
+ local comma=","
+ if (( $i == ($num_tests - 1) )); then
+ comma=""
+ fi
+ echo " {"
+ echo " \"name\": \"${tests[$i]}\","
+ echo " \"host\": true"
+ echo " }$comma"
+
+ i=$(( $i + 1 ))
+ done
+
+ echo "$footer"
+ } >"$test_mapping"
+
+ if cmp "$test_mapping_bak" "$test_mapping" ; then
+ echo "No change detecetd."
+ return 0
+ fi
+ echo "Updated $test_mapping"
+
+ # `|| true` is needed because of `set -e`.
+ diff -u "$test_mapping_bak" "$test_mapping" || true
+ return 0
+}
+
+main
diff --git a/ravenwood/services-test/test/com/android/ravenwoodtest/servicestest/RavenwoodServicesTest.java b/ravenwood/services-test/test/com/android/ravenwoodtest/servicestest/RavenwoodServicesTest.java
index 044239f..8ce15f0 100644
--- a/ravenwood/services-test/test/com/android/ravenwoodtest/servicestest/RavenwoodServicesTest.java
+++ b/ravenwood/services-test/test/com/android/ravenwoodtest/servicestest/RavenwoodServicesTest.java
@@ -16,12 +16,14 @@
package com.android.ravenwoodtest.servicestest;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import android.content.Context;
import android.hardware.SerialManager;
import android.hardware.SerialManagerInternal;
+import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -56,13 +58,16 @@
}
@Test
+ @DisabledOnRavenwood(reason="AOSP is missing resources support")
public void testSimple() {
// Verify that we can obtain a manager, and talk to the backend service, and that no
// serial ports are configured by default
final SerialManager service = (SerialManager)
mRavenwood.getContext().getSystemService(Context.SERIAL_SERVICE);
final String[] ports = service.getSerialPorts();
- assertEquals(0, ports.length);
+ final String[] refPorts = mRavenwood.getContext().getResources().getStringArray(
+ com.android.internal.R.array.config_serialPorts);
+ assertArrayEquals(refPorts, ports);
}
@Test
diff --git a/ravenwood/test-authors.md b/ravenwood/test-authors.md
index 0a0b200..c29fb7f 100644
--- a/ravenwood/test-authors.md
+++ b/ravenwood/test-authors.md
@@ -46,7 +46,7 @@
* Write your unit test just like you would for an Android device:
```
-import android.platform.test.annotations.IgnoreUnderRavenwood;
+import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -66,7 +66,7 @@
* APIs available under Ravenwood are stateless by default. If your test requires explicit states (such as defining the UID you’re running under, or requiring a main `Looper` thread), add a `RavenwoodRule` to declare that:
```
-import android.platform.test.annotations.IgnoreUnderRavenwood;
+import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.ravenwood.RavenwoodRule;
import androidx.test.runner.AndroidJUnit4;
@@ -165,7 +165,7 @@
}
@Test
- @IgnoreUnderRavenwood(blockedBy = PackageManager.class)
+ @DisabledOnRavenwood(blockedBy = PackageManager.class)
public void testComplex() {
// Complex test that runs on devices, but is ignored under Ravenwood
}
diff --git a/ravenwood/tests/bivalentinst/Android.bp b/ravenwood/tests/bivalentinst/Android.bp
new file mode 100644
index 0000000..41e45e5
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/Android.bp
@@ -0,0 +1,148 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_base_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_base_license"],
+}
+
+android_ravenwood_test {
+ name: "RavenwoodBivalentInstTest_self_inst",
+
+ srcs: [
+ "test/**/*.java",
+ ],
+ exclude_srcs: [
+ "test/**/*_nonself.java",
+ ],
+
+ static_libs: [
+ "RavenwoodBivalentInstTest_self_inst_device_R",
+
+ "androidx.annotation_annotation",
+ "androidx.test.ext.junit",
+ "androidx.test.rules",
+
+ "junit",
+ "truth",
+ ],
+ resource_apk: "RavenwoodBivalentInstTest_self_inst_device",
+ auto_gen_config: true,
+}
+
+android_ravenwood_test {
+ name: "RavenwoodBivalentInstTest_nonself_inst",
+
+ srcs: [
+ "test/**/*.java",
+ ],
+ exclude_srcs: [
+ "test/**/*_self.java",
+ ],
+
+ static_libs: [
+ "RavenwoodBivalentInstTestTarget_R",
+ "RavenwoodBivalentInstTest_nonself_inst_device_R",
+
+ "androidx.annotation_annotation",
+ "androidx.test.ext.junit",
+ "androidx.test.rules",
+
+ "junit",
+ "truth",
+ ],
+ resource_apk: "RavenwoodBivalentInstTestTarget",
+ inst_resource_apk: "RavenwoodBivalentInstTest_nonself_inst_device",
+ auto_gen_config: true,
+}
+
+// We have 3 R.javas from the 3 packages (2 test apks below, and 1 target APK)
+// RavenwoodBivalentInstTest needs to use all of them, but we can't add all the
+// {.aapt.srcjar}'s together because that'd cause
+// "duplicate declaration of androidx.test.core.R$string."
+// So we build them as separate libraries, and include them as static_libs.
+java_library {
+ name: "RavenwoodBivalentInstTestTarget_R",
+ srcs: [
+ ":RavenwoodBivalentInstTestTarget{.aapt.srcjar}",
+ ],
+}
+
+java_library {
+ name: "RavenwoodBivalentInstTest_self_inst_device_R",
+ srcs: [
+ ":RavenwoodBivalentInstTest_self_inst_device{.aapt.srcjar}",
+ ],
+}
+
+java_library {
+ name: "RavenwoodBivalentInstTest_nonself_inst_device_R",
+ srcs: [
+ ":RavenwoodBivalentInstTest_nonself_inst_device{.aapt.srcjar}",
+ ],
+}
+
+android_test {
+ name: "RavenwoodBivalentInstTest_self_inst_device",
+
+ srcs: [
+ "test/**/*.java",
+ ],
+ exclude_srcs: [
+ "test/**/*_nonself.java",
+ ],
+ static_libs: [
+ "junit",
+ "truth",
+
+ "androidx.annotation_annotation",
+ "androidx.test.ext.junit",
+ "androidx.test.rules",
+
+ "ravenwood-junit",
+ ],
+ test_suites: [
+ "device-tests",
+ ],
+ use_resource_processor: false,
+ manifest: "AndroidManifest-self-inst.xml",
+ test_config: "AndroidTest-self-inst.xml",
+ optimize: {
+ enabled: false,
+ },
+}
+
+android_test {
+ name: "RavenwoodBivalentInstTest_nonself_inst_device",
+
+ srcs: [
+ "test/**/*.java",
+ ],
+ exclude_srcs: [
+ "test/**/*_self.java",
+ ],
+ static_libs: [
+ "junit",
+ "truth",
+
+ "androidx.annotation_annotation",
+ "androidx.test.ext.junit",
+ "androidx.test.rules",
+
+ "ravenwood-junit",
+ ],
+ data: [
+ ":RavenwoodBivalentInstTestTarget",
+ ],
+ test_suites: [
+ "device-tests",
+ ],
+ use_resource_processor: false,
+ manifest: "AndroidManifest-nonself-inst.xml",
+ test_config: "AndroidTest-nonself-inst.xml",
+ instrumentation_for: "RavenwoodBivalentInstTestTarget",
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/ravenwood/tests/bivalentinst/AndroidManifest-nonself-inst.xml b/ravenwood/tests/bivalentinst/AndroidManifest-nonself-inst.xml
new file mode 100644
index 0000000..a5a1f17
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/AndroidManifest-nonself-inst.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.ravenwood.bivalentinsttest_nonself_inst">
+
+ <application android:debuggable="true" >
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.ravenwood.bivalentinst_target_app"
+ />
+</manifest>
diff --git a/ravenwood/tests/bivalentinst/AndroidManifest-self-inst.xml b/ravenwood/tests/bivalentinst/AndroidManifest-self-inst.xml
new file mode 100644
index 0000000..3dc4c56
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/AndroidManifest-self-inst.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.ravenwood.bivalentinsttest_self_inst">
+
+ <application android:debuggable="true" >
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.ravenwood.bivalentinsttest_self_inst"
+ />
+</manifest>
diff --git a/ravenwood/tests/bivalentinst/AndroidTest-nonself-inst.xml b/ravenwood/tests/bivalentinst/AndroidTest-nonself-inst.xml
new file mode 100644
index 0000000..9491c53
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/AndroidTest-nonself-inst.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+<configuration>
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-instrumentation" />
+
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="RavenwoodBivalentInstTestTarget.apk" />
+ <option name="test-file-name" value="RavenwoodBivalentInstTest_nonself_inst_device.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.ravenwood.bivalentinsttest_nonself_inst" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+ </test>
+</configuration>
diff --git a/ravenwood/tests/bivalentinst/AndroidTest-self-inst.xml b/ravenwood/tests/bivalentinst/AndroidTest-self-inst.xml
new file mode 100644
index 0000000..3079c06
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/AndroidTest-self-inst.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+<configuration>
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-instrumentation" />
+
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="RavenwoodBivalentInstTest_self_inst_device.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.ravenwood.bivalentinsttest_self_inst" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+ </test>
+</configuration>
diff --git a/ravenwood/tests/bivalentinst/res/values/strings.xml b/ravenwood/tests/bivalentinst/res/values/strings.xml
new file mode 100644
index 0000000..73ef650
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/res/values/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string translatable="false" name="test_string_in_test">String in test APK</string>
+</resources>
diff --git a/ravenwood/tools/ravenizer-fake/Android.bp b/ravenwood/tests/bivalentinst/targetapp/Android.bp
similarity index 61%
rename from ravenwood/tools/ravenizer-fake/Android.bp
rename to ravenwood/tests/bivalentinst/targetapp/Android.bp
index 7e2c407..7528a62 100644
--- a/ravenwood/tools/ravenizer-fake/Android.bp
+++ b/ravenwood/tests/bivalentinst/targetapp/Android.bp
@@ -7,8 +7,14 @@
default_applicable_licenses: ["frameworks_base_license"],
}
-sh_binary_host {
- name: "ravenizer",
- src: "ravenizer",
- visibility: ["//visibility:public"],
+android_app {
+ name: "RavenwoodBivalentInstTestTarget",
+ srcs: [
+ "src/**/*.java",
+ ],
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ use_resource_processor: false,
}
diff --git a/ravenwood/tests/bivalentinst/targetapp/AndroidManifest.xml b/ravenwood/tests/bivalentinst/targetapp/AndroidManifest.xml
new file mode 100644
index 0000000..0715f5d
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/targetapp/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.ravenwood.bivalentinst_target_app">
+ <application>
+ </application>
+</manifest>
diff --git a/ravenwood/tests/bivalentinst/targetapp/res/values/strings.xml b/ravenwood/tests/bivalentinst/targetapp/res/values/strings.xml
new file mode 100644
index 0000000..395bc2a
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/targetapp/res/values/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string translatable="false" name="test_string_in_target">Test string in target APK</string>
+</resources>
diff --git a/ravenwood/tests/bivalentinst/targetapp/src/com/android/ravenwoodtest/bivalentinst/Empty.java b/ravenwood/tests/bivalentinst/targetapp/src/com/android/ravenwoodtest/bivalentinst/Empty.java
new file mode 100644
index 0000000..15e50ec
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/targetapp/src/com/android/ravenwoodtest/bivalentinst/Empty.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalentinst;
+
+/**
+ * Empty class. We need it because an instrumentation target APK must have code.
+ */
+public class Empty {
+}
diff --git a/ravenwood/tests/bivalentinst/test/com/android/ravenwoodtest/bivalentinst/RavenwoodInstrumentationTest_nonself.java b/ravenwood/tests/bivalentinst/test/com/android/ravenwoodtest/bivalentinst/RavenwoodInstrumentationTest_nonself.java
new file mode 100644
index 0000000..ed1992c
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/test/com/android/ravenwoodtest/bivalentinst/RavenwoodInstrumentationTest_nonself.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalentinst;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Instrumentation;
+import android.content.Context;
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.ravenwood.RavenwoodConfig;
+import android.platform.test.ravenwood.RavenwoodConfig.Config;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for the case where the instrumentation target is _not_ the test APK itself.
+ */
+@RunWith(AndroidJUnit4.class)
+@DisabledOnRavenwood(reason="AOSP is missing resources support")
+public class RavenwoodInstrumentationTest_nonself {
+ private static final String TARGET_PACKAGE_NAME =
+ "com.android.ravenwood.bivalentinst_target_app";
+ private static final String TEST_PACKAGE_NAME =
+ "com.android.ravenwood.bivalentinsttest_nonself_inst";
+
+ @Config
+ public static final RavenwoodConfig sConfig = new RavenwoodConfig.Builder()
+ .setPackageName(TEST_PACKAGE_NAME)
+ .setTargetPackageName(TARGET_PACKAGE_NAME)
+ .build();
+
+ private static Instrumentation sInstrumentation;
+ private static Context sTestContext;
+ private static Context sTargetContext;
+
+ @BeforeClass
+ public static void beforeClass() {
+ sInstrumentation = InstrumentationRegistry.getInstrumentation();
+ sTestContext = sInstrumentation.getContext();
+ sTargetContext = sInstrumentation.getTargetContext();
+ }
+
+ @Test
+ public void testTestContextPackageName() {
+ assertThat(sTestContext.getPackageName()).isEqualTo(TEST_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTargetContextPackageName() {
+ assertThat(sTargetContext.getPackageName()).isEqualTo(TARGET_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTestAppContext() {
+ // Test context doesn't have an app context.
+ assertThat(sTestContext.getApplicationContext()).isNull();
+ }
+
+ @Test
+ public void testTargetAppContextPackageName() {
+ assertThat(sTargetContext.getApplicationContext().getPackageName())
+ .isEqualTo(TARGET_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTargetAppAppContextPackageName() {
+ assertThat(sTargetContext.getApplicationContext()
+ .getApplicationContext().getPackageName())
+ .isEqualTo(TARGET_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testContextSameness() {
+ assertThat(sTargetContext).isNotSameInstanceAs(sTestContext);
+
+ assertThat(sTargetContext).isNotSameInstanceAs(sTargetContext.getApplicationContext());
+
+ assertThat(sTargetContext.getApplicationContext()).isSameInstanceAs(
+ sTargetContext.getApplicationContext().getApplicationContext());
+ }
+
+ @Test
+ public void testTargetAppResource() {
+ assertThat(sTargetContext.getString(
+ com.android.ravenwood.bivalentinst_target_app.R.string.test_string_in_target))
+ .isEqualTo("Test string in target APK");
+ }
+
+ @Test
+ public void testTestAppResource() {
+ assertThat(sTestContext.getString(
+ com.android.ravenwood.bivalentinsttest_nonself_inst.R.string.test_string_in_test))
+ .isEqualTo("String in test APK");
+ }
+}
diff --git a/ravenwood/tests/bivalentinst/test/com/android/ravenwoodtest/bivalentinst/RavenwoodInstrumentationTest_self.java b/ravenwood/tests/bivalentinst/test/com/android/ravenwoodtest/bivalentinst/RavenwoodInstrumentationTest_self.java
new file mode 100644
index 0000000..b5bafc4
--- /dev/null
+++ b/ravenwood/tests/bivalentinst/test/com/android/ravenwoodtest/bivalentinst/RavenwoodInstrumentationTest_self.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.bivalentinst;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Instrumentation;
+import android.content.Context;
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.ravenwood.RavenwoodConfig;
+import android.platform.test.ravenwood.RavenwoodConfig.Config;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for the case where the instrumentation target is the test APK itself.
+ */
+@RunWith(AndroidJUnit4.class)
+@DisabledOnRavenwood(reason="AOSP is missing resources support")
+public class RavenwoodInstrumentationTest_self {
+
+ private static final String TARGET_PACKAGE_NAME =
+ "com.android.ravenwood.bivalentinsttest_self_inst";
+ private static final String TEST_PACKAGE_NAME =
+ "com.android.ravenwood.bivalentinsttest_self_inst";
+
+ @Config
+ public static final RavenwoodConfig sConfig = new RavenwoodConfig.Builder()
+ .setPackageName(TEST_PACKAGE_NAME)
+ .setTargetPackageName(TARGET_PACKAGE_NAME)
+ .build();
+
+
+ private static Instrumentation sInstrumentation;
+ private static Context sTestContext;
+ private static Context sTargetContext;
+
+ @BeforeClass
+ public static void beforeClass() {
+ sInstrumentation = InstrumentationRegistry.getInstrumentation();
+ sTestContext = sInstrumentation.getContext();
+ sTargetContext = sInstrumentation.getTargetContext();
+ }
+
+ @Test
+ public void testTestContextPackageName() {
+ assertThat(sTestContext.getPackageName()).isEqualTo(TEST_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTargetContextPackageName() {
+ assertThat(sTargetContext.getPackageName()).isEqualTo(TARGET_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTestAppContextPackageName() {
+ assertThat(sTestContext.getApplicationContext().getPackageName())
+ .isEqualTo(TEST_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTestAppAppContextPackageName() {
+ assertThat(sTestContext.getApplicationContext().getPackageName())
+ .isEqualTo(TEST_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTargetAppContextPackageName() {
+ assertThat(sTargetContext.getApplicationContext()
+ .getApplicationContext().getPackageName())
+ .isEqualTo(TARGET_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testTargetAppAppContextPackageName() {
+ assertThat(sTargetContext.getApplicationContext()
+ .getApplicationContext().getPackageName())
+ .isEqualTo(TARGET_PACKAGE_NAME);
+ }
+
+ @Test
+ public void testContextSameness() {
+ assertThat(sTargetContext).isNotSameInstanceAs(sTestContext);
+
+ assertThat(sTestContext).isNotSameInstanceAs(sTestContext.getApplicationContext());
+ assertThat(sTargetContext).isNotSameInstanceAs(sTargetContext.getApplicationContext());
+
+ assertThat(sTestContext.getApplicationContext()).isSameInstanceAs(
+ sTestContext.getApplicationContext().getApplicationContext());
+ assertThat(sTargetContext.getApplicationContext()).isSameInstanceAs(
+ sTargetContext.getApplicationContext().getApplicationContext());
+ }
+
+ @Test
+ public void testTargetAppResource() {
+ assertThat(sTargetContext.getString(
+ com.android.ravenwood.bivalentinsttest_self_inst.R.string.test_string_in_test))
+ .isEqualTo("String in test APK");
+ }
+
+ @Test
+ public void testTestAppResource() {
+ assertThat(sTestContext.getString(
+ com.android.ravenwood.bivalentinsttest_self_inst.R.string.test_string_in_test))
+ .isEqualTo("String in test APK");
+ }
+}
diff --git a/ravenwood/coretest/Android.bp b/ravenwood/tests/coretest/Android.bp
similarity index 87%
rename from ravenwood/coretest/Android.bp
rename to ravenwood/tests/coretest/Android.bp
index a78c5c1..d94475c 100644
--- a/ravenwood/coretest/Android.bp
+++ b/ravenwood/tests/coretest/Android.bp
@@ -14,10 +14,12 @@
"androidx.annotation_annotation",
"androidx.test.ext.junit",
"androidx.test.rules",
+ "junit-params",
+ "platform-parametric-runner-lib",
+ "truth",
],
srcs: [
"test/**/*.java",
],
- sdk_version: "test_current",
auto_gen_config: true,
}
diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java
new file mode 100644
index 0000000..bd01313
--- /dev/null
+++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerCallbackTest.java
@@ -0,0 +1,458 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.runnercallbacktests;
+
+import static org.junit.Assume.assumeTrue;
+
+import android.platform.test.annotations.DisabledOnRavenwood;
+import android.platform.test.annotations.NoRavenizer;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
+import platform.test.runner.parameterized.Parameters;
+
+
+/**
+ * Tests to make sure {@link RavenwoodAwareTestRunner} produces expected callbacks in various
+ * error situations in places such as @BeforeClass / @AfterClass / Constructors, which are
+ * out of test method bodies.
+ */
+@NoRavenizer // This class shouldn't be executed with RavenwoodAwareTestRunner.
+public class RavenwoodRunnerCallbackTest extends RavenwoodRunnerTestBase {
+
+ /**
+ * Throws an exception in @AfterClass. This should produce a critical error.
+ */
+ @RunWith(BlockJUnit4ClassRunner.class)
+ // CHECKSTYLE:OFF Generated code
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest
+ testStarted: test1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest)
+ testFinished: test1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest)
+ testStarted: test2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest)
+ testFinished: test2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$AfterClassFailureTest
+ criticalError: Failures detected in @AfterClass, which would be swallowed by tradefed: FAILURE
+ testSuiteFinished: classes
+ testRunFinished: 2,0,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class AfterClassFailureTest {
+ public AfterClassFailureTest() {
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ throw new RuntimeException("FAILURE");
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+
+ }
+
+ /**
+ * Assumption failure in @BeforeClass.
+ */
+ @RunWith(ParameterizedAndroidJunit4.class)
+ // Because the test uses ParameterizedAndroidJunit4 with two parameters,
+ // the whole class is executed twice.
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest
+ testSuiteStarted: [0]
+ testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testSuiteFinished: [0]
+ testSuiteStarted: [1]
+ testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassAssumptionFailureTest)
+ testSuiteFinished: [1]
+ testSuiteFinished: classes
+ testRunFinished: 4,0,4,0
+ """)
+ // CHECKSTYLE:ON
+ public static class BeforeClassAssumptionFailureTest {
+ public BeforeClassAssumptionFailureTest(String param) {
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+ Assume.assumeTrue(false);
+ }
+
+ @Parameters
+ public static List<String> getParams() {
+ var params = new ArrayList<String>();
+ params.add("foo");
+ params.add("bar");
+ return params;
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ /**
+ * General exception in @BeforeClass.
+ */
+ @RunWith(ParameterizedAndroidJunit4.class)
+ // Because the test uses ParameterizedAndroidJunit4 with two parameters,
+ // the whole class is executed twice.
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest
+ testSuiteStarted: [0]
+ testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testFailure: FAILURE
+ testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testFailure: FAILURE
+ testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testSuiteFinished: [0]
+ testSuiteStarted: [1]
+ testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testFailure: FAILURE
+ testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testFailure: FAILURE
+ testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BeforeClassExceptionTest)
+ testSuiteFinished: [1]
+ testSuiteFinished: classes
+ testRunFinished: 4,4,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class BeforeClassExceptionTest {
+ public BeforeClassExceptionTest(String param) {
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+ throw new RuntimeException("FAILURE");
+ }
+
+ @Parameters
+ public static List<String> getParams() {
+ var params = new ArrayList<String>();
+ params.add("foo");
+ params.add("bar");
+ return params;
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ /**
+ * Assumption failure from a @ClassRule.
+ */
+ @RunWith(ParameterizedAndroidJunit4.class)
+ // Because the test uses ParameterizedAndroidJunit4 with two parameters,
+ // the whole class is executed twice.
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest
+ testSuiteStarted: [0]
+ testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testSuiteFinished: [0]
+ testSuiteStarted: [1]
+ testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleAssumptionFailureTest)
+ testSuiteFinished: [1]
+ testSuiteFinished: classes
+ testRunFinished: 4,0,4,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ClassRuleAssumptionFailureTest {
+ @ClassRule
+ public static final TestRule sClassRule = new TestRule() {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ assumeTrue(false);
+ return null; // unreachable
+ }
+ };
+
+ public ClassRuleAssumptionFailureTest(String param) {
+ }
+
+ @Parameters
+ public static List<String> getParams() {
+ var params = new ArrayList<String>();
+ params.add("foo");
+ params.add("bar");
+ return params;
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ /**
+ * General exception from a @ClassRule.
+ */
+ @RunWith(ParameterizedAndroidJunit4.class)
+ // Because the test uses ParameterizedAndroidJunit4 with two parameters,
+ // the whole class is executed twice.
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest
+ testSuiteStarted: [0]
+ testStarted: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test1[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testStarted: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test2[0](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testSuiteFinished: [0]
+ testSuiteStarted: [1]
+ testStarted: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test1[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testStarted: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testAssumptionFailure: got: <false>, expected: is <true>
+ testFinished: test2[1](com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassRuleExceptionTest)
+ testSuiteFinished: [1]
+ testSuiteFinished: classes
+ testRunFinished: 4,0,4,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ClassRuleExceptionTest {
+ @ClassRule
+ public static final TestRule sClassRule = new TestRule() {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ assumeTrue(false);
+ return null; // unreachable
+ }
+ };
+
+ public ClassRuleExceptionTest(String param) {
+ }
+
+ @Parameters
+ public static List<String> getParams() {
+ var params = new ArrayList<String>();
+ params.add("foo");
+ params.add("bar");
+ return params;
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ /**
+ * General exception from a @ClassRule.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ExceptionFromInnerRunnerConstructorTest)
+ testFailure: Exception detected in constructor
+ testFinished: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ExceptionFromInnerRunnerConstructorTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ExceptionFromInnerRunnerConstructorTest {
+ public ExceptionFromInnerRunnerConstructorTest(String arg1, String arg2) {
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ /**
+ * The test class is unloadable, but has a @DisabledOnRavenwood.
+ */
+ @RunWith(AndroidJUnit4.class)
+ @DisabledOnRavenwood
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: ClassUnloadbleAndDisabledTest(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndDisabledTest)
+ testIgnored: ClassUnloadbleAndDisabledTest(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndDisabledTest)
+ testSuiteFinished: ClassUnloadbleAndDisabledTest(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndDisabledTest)
+ testSuiteFinished: classes
+ testRunFinished: 0,0,0,1
+ """)
+ // CHECKSTYLE:ON
+ public static class ClassUnloadbleAndDisabledTest {
+ static {
+ Assert.fail("Class unloadable!");
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ /**
+ * The test class is unloadable, but has a @DisabledOnRavenwood.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndEnabledTest
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndEnabledTest
+ testStarted: test1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndEnabledTest)
+ testFailure: Class unloadable!
+ testFinished: test1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndEnabledTest)
+ testStarted: test2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndEnabledTest)
+ testFailure: Class unloadable!
+ testFinished: test2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$ClassUnloadbleAndEnabledTest)
+ testSuiteFinished: classes
+ testRunFinished: 2,2,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ClassUnloadbleAndEnabledTest {
+ static {
+ Assert.fail("Class unloadable!");
+ }
+
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+
+ public static class BrokenTestRunner extends BlockJUnit4ClassRunner {
+ public BrokenTestRunner(Class<?> testClass) throws InitializationError {
+ super(testClass);
+
+ if (true) {
+ throw new RuntimeException("This is a broken test runner!");
+ }
+ }
+ }
+
+ /**
+ * The test runner throws an exception from the ctor.
+ */
+ @RunWith(BrokenTestRunner.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BrokenRunnerTest)
+ testFailure: Exception detected in constructor
+ testFinished: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerCallbackTest$BrokenRunnerTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class BrokenRunnerTest {
+ @Test
+ public void test1() {
+ }
+
+ @Test
+ public void test2() {
+ }
+ }
+}
diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java
new file mode 100644
index 0000000..73ea64f
--- /dev/null
+++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerConfigValidationTest.java
@@ -0,0 +1,481 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.runnercallbacktests;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.platform.test.annotations.NoRavenizer;
+import android.platform.test.ravenwood.RavenwoodConfig;
+import android.platform.test.ravenwood.RavenwoodRule;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test for @Config field extraction and validation.
+ */
+@NoRavenizer // This class shouldn't be executed with RavenwoodAwareTestRunner.
+public class RavenwoodRunnerConfigValidationTest extends RavenwoodRunnerTestBase {
+ public abstract static class ConfigInBaseClass {
+ static String PACKAGE_NAME = "com.ConfigInBaseClass";
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder()
+ .setPackageName(PACKAGE_NAME).build();
+ }
+
+ /**
+ * Make sure a config in the base class is detected.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest
+ testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest)
+ testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigInBaseClassTest
+ testSuiteFinished: classes
+ testRunFinished: 1,0,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ConfigInBaseClassTest extends ConfigInBaseClass {
+ @Test
+ public void test() {
+ assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName())
+ .isEqualTo(PACKAGE_NAME);
+ }
+ }
+
+ /**
+ * Make sure a config in the base class is detected.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest
+ testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest)
+ testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigOverridingTest
+ testSuiteFinished: classes
+ testRunFinished: 1,0,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ConfigOverridingTest extends ConfigInBaseClass {
+ static String PACKAGE_NAME_OVERRIDE = "com.ConfigOverridingTest";
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder()
+ .setPackageName(PACKAGE_NAME_OVERRIDE).build();
+
+ @Test
+ public void test() {
+ assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName())
+ .isEqualTo(PACKAGE_NAME_OVERRIDE);
+ }
+ }
+
+ /**
+ * Test to make sure that if a test has a config error, the failure would be reported from
+ * each test method.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: testMethod1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest)
+ testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest.sConfig expected to be public static
+ testFinished: testMethod1(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest)
+ testStarted: testMethod2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest)
+ testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest.sConfig expected to be public static
+ testFinished: testMethod2(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest)
+ testStarted: testMethod3(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest)
+ testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest.sConfig expected to be public static
+ testFinished: testMethod3(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ErrorMustBeReportedFromEachTest)
+ testSuiteFinished: classes
+ testRunFinished: 3,3,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ErrorMustBeReportedFromEachTest {
+ @RavenwoodConfig.Config
+ private static RavenwoodConfig sConfig = // Invalid because it's private.
+ new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void testMethod1() {
+ }
+
+ @Test
+ public void testMethod2() {
+ }
+
+ @Test
+ public void testMethod3() {
+ }
+ }
+
+ /**
+ * Invalid because there are two @Config's.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateConfigTest)
+ testFailure: Class com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest.DuplicateConfigTest has multiple fields with @RavenwoodConfig.Config
+ testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateConfigTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class DuplicateConfigTest {
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig1 =
+ new RavenwoodConfig.Builder().build();
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig2 =
+ new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+ }
+
+ /**
+ * @Config's must be static.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonStaticConfigTest)
+ testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonStaticConfigTest.sConfig expected to be public static
+ testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonStaticConfigTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class NonStaticConfigTest {
+
+ @RavenwoodConfig.Config
+ public RavenwoodConfig sConfig =
+ new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+ }
+
+ /**
+ * @Config's must be public.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonPublicConfigTest)
+ testFailure: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonPublicConfigTest.sConfig expected to be public static
+ testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$NonPublicConfigTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class NonPublicConfigTest {
+
+ @RavenwoodConfig.Config
+ RavenwoodConfig sConfig =
+ new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+ }
+
+ /**
+ * @Config's must be of type RavenwoodConfig.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeConfigTest)
+ testFailure: Field com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest.WrongTypeConfigTest.sConfig has @RavenwoodConfig.Config but type is not RavenwoodConfig
+ testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeConfigTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class WrongTypeConfigTest {
+
+ @RavenwoodConfig.Config
+ public static Object sConfig =
+ new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+
+ }
+
+ /**
+ * @Rule must be of type RavenwoodRule.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeRuleTest
+ testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeRuleTest)
+ testFailure: If you have a RavenwoodRule in your test, make sure the field type is RavenwoodRule so Ravenwood can detect it.
+ testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeRuleTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WrongTypeRuleTest
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class WrongTypeRuleTest {
+
+ @Rule
+ public TestRule mRule = new RavenwoodRule.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+
+ }
+
+ /**
+ * Config can't be used with a (instance) Rule.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithInstanceRuleTest)
+ testFailure: RavenwoodConfig and RavenwoodRule cannot be used in the same class. Suggest migrating to RavenwoodConfig.
+ testFinished: testConfig(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithInstanceRuleTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class WithInstanceRuleTest {
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig =
+ new RavenwoodConfig.Builder().build();
+
+ @Rule
+ public RavenwoodRule mRule = new RavenwoodRule.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+ }
+
+ /**
+ * Config can't be used with a (static) Rule.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithStaticRuleTest)
+ testFailure: Exception detected in constructor
+ testFinished: Constructor(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$WithStaticRuleTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class WithStaticRuleTest {
+
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig =
+ new RavenwoodConfig.Builder().build();
+
+ @Rule
+ public static RavenwoodRule sRule = new RavenwoodRule.Builder().build();
+
+ @Test
+ public void testConfig() {
+ }
+ }
+
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest
+ testStarted: testMultipleRulesNotAllowed(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest)
+ testFailure: Multiple nesting RavenwoodRule's are detected in the same class, which is not supported.
+ testFinished: testMultipleRulesNotAllowed(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$DuplicateRulesTest
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class DuplicateRulesTest {
+
+ @Rule
+ public final RavenwoodRule mRavenwood1 = new RavenwoodRule();
+
+ @Rule
+ public final RavenwoodRule mRavenwood2 = new RavenwoodRule();
+
+ @Test
+ public void testMultipleRulesNotAllowed() {
+ }
+ }
+
+ public static class RuleInBaseClass {
+ static String PACKAGE_NAME = "com.RuleInBaseClass";
+ @Rule
+ public final RavenwoodRule mRavenwood1 = new RavenwoodRule.Builder()
+ .setPackageName(PACKAGE_NAME).build();
+ }
+
+ /**
+ * Make sure that RavenwoodRule in a base class takes effect.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest
+ testStarted: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest)
+ testFinished: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleInBaseClassSuccessTest
+ testSuiteFinished: classes
+ testRunFinished: 1,0,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class RuleInBaseClassSuccessTest extends RuleInBaseClass {
+
+ @Test
+ public void testRuleInBaseClass() {
+ assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName())
+ .isEqualTo(PACKAGE_NAME);
+ }
+ }
+
+ /**
+ * Make sure that having a config and a rule in a base class should fail.
+ * RavenwoodRule.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleInBaseClassTest)
+ testFailure: RavenwoodConfig and RavenwoodRule cannot be used in the same class. Suggest migrating to RavenwoodConfig.
+ testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleInBaseClassTest)
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ConfigWithRuleInBaseClassTest extends RuleInBaseClass {
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void test() {
+ }
+ }
+
+ /**
+ * Same as {@link RuleInBaseClass}, but the type of the rule field is not {@link RavenwoodRule}.
+ */
+ public abstract static class RuleWithDifferentTypeInBaseClass {
+ static String PACKAGE_NAME = "com.RuleWithDifferentTypeInBaseClass";
+ @Rule
+ public final TestRule mRavenwood1 = new RavenwoodRule.Builder()
+ .setPackageName(PACKAGE_NAME).build();
+ }
+
+ /**
+ * Make sure that RavenwoodRule in a base class takes effect, even if the field type is not
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest
+ testStarted: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest)
+ testFailure: If you have a RavenwoodRule in your test, make sure the field type is RavenwoodRule so Ravenwood can detect it.
+ testFinished: testRuleInBaseClass(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$RuleWithDifferentTypeInBaseClassSuccessTest
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class RuleWithDifferentTypeInBaseClassSuccessTest extends RuleWithDifferentTypeInBaseClass {
+
+ @Test
+ public void testRuleInBaseClass() {
+ assertThat(InstrumentationRegistry.getInstrumentation().getContext().getPackageName())
+ .isEqualTo(PACKAGE_NAME);
+ }
+ }
+
+ /**
+ * Make sure that having a config and a rule in a base class should fail, even if the field type is not
+ * RavenwoodRule.
+ */
+ @RunWith(AndroidJUnit4.class)
+ // CHECKSTYLE:OFF
+ @Expected("""
+ testRunStarted: classes
+ testSuiteStarted: classes
+ testSuiteStarted: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest
+ testStarted: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest)
+ testFailure: If you have a RavenwoodRule in your test, make sure the field type is RavenwoodRule so Ravenwood can detect it.
+ testFinished: test(com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest)
+ testSuiteFinished: com.android.ravenwoodtest.runnercallbacktests.RavenwoodRunnerConfigValidationTest$ConfigWithRuleWithDifferentTypeInBaseClassTest
+ testSuiteFinished: classes
+ testRunFinished: 1,1,0,0
+ """)
+ // CHECKSTYLE:ON
+ public static class ConfigWithRuleWithDifferentTypeInBaseClassTest extends RuleWithDifferentTypeInBaseClass {
+ @RavenwoodConfig.Config
+ public static RavenwoodConfig sConfig = new RavenwoodConfig.Builder().build();
+
+ @Test
+ public void test() {
+ }
+ }
+}
diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java
new file mode 100644
index 0000000..9a6934b
--- /dev/null
+++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/runnercallbacktests/RavenwoodRunnerTestBase.java
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2024 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 com.android.ravenwoodtest.runnercallbacktests;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.platform.test.annotations.NoRavenizer;
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner;
+import android.util.Log;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import org.junit.Test;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.RunWith;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.function.BiConsumer;
+
+
+/**
+ * Base class for tests to make sure {@link RavenwoodAwareTestRunner} produces expected callbacks
+ * in various situations. (most of them are error situations.)
+ *
+ * Subclasses must contain test classes as static inner classes with an {@link Expected} annotation.
+ * This class finds them using reflections and run them one by one directly using {@link JUnitCore},
+ * and check the callbacks.
+ *
+ * Subclasses do no need to have any test methods.
+ *
+ * The {@link Expected} annotation must contain the expected result as a string.
+ *
+ * This test abuses the fact that atest + tradefed + junit won't run nested classes automatically.
+ * (So atest won't show any results directly from the nested classes.)
+ *
+ * The actual test method is {@link #doTest}, which is executed for each target test class, using
+ * junit-params.
+ */
+@RunWith(JUnitParamsRunner.class)
+@NoRavenizer // This class shouldn't be executed with RavenwoodAwareTestRunner.
+public abstract class RavenwoodRunnerTestBase {
+ private static final String TAG = "RavenwoodRunnerTestBase";
+
+ /**
+ * Annotation to specify the expected result for a class.
+ */
+ @Target({ElementType.TYPE})
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Expected {
+ String value();
+ }
+
+ /**
+ * Take a multiline string, strip all of them, remove empty lines, and return it.
+ */
+ private static String stripMultiLines(String resultString) {
+ var list = new ArrayList<String>();
+ for (var line : resultString.split("\n")) {
+ var s = line.strip();
+ if (s.length() > 0) {
+ list.add(s);
+ }
+ }
+ return String.join("\n", list);
+ }
+
+ /**
+ * Extract the expected result from @Expected.
+ */
+ private String getExpectedResult(Class<?> testClazz) {
+ var expect = testClazz.getAnnotation(Expected.class);
+ return stripMultiLines(expect.value());
+ }
+
+ /**
+ * List all the nested classrs with an {@link Expected} annotation in a given class.
+ */
+ public Class<?>[] getTestClasses() {
+ var thisClass = this.getClass();
+ var ret = Arrays.stream(thisClass.getNestMembers())
+ .filter((c) -> c.getAnnotation(Expected.class) != null)
+ .toArray(Class[]::new);
+
+ assertThat(ret.length).isGreaterThan(0);
+
+ return ret;
+ }
+
+ /**
+ * This is the actual test method. We use junit-params to run this method for each target
+ * test class, which are returned by {@link #getTestClasses}.
+ *
+ * It runs each test class, and compare the result collected with
+ * {@link ResultCollectingListener} to expected results (as strings).
+ */
+ @Test
+ @Parameters(method = "getTestClasses")
+ public void doTest(Class<?> testClazz) {
+ doTest(testClazz, getExpectedResult(testClazz));
+ }
+
+ /**
+ * Run a given test class, and compare the result collected with
+ * {@link ResultCollectingListener} to expected results (as a string).
+ */
+ private void doTest(Class<?> testClazz, String expectedResult) {
+ Log.i(TAG, "Running test for " + testClazz);
+ var junitCore = new JUnitCore();
+
+ // Create a listener.
+ var listener = new ResultCollectingListener();
+ junitCore.addListener(listener);
+
+ // Set a listener to critical errors. This will also prevent
+ // {@link RavenwoodAwareTestRunner} from calling System.exit() when there's
+ // a critical error.
+ RavenwoodAwareTestRunner.private$ravenwood().setCriticalErrorHandler(
+ listener.sCriticalErrorListener);
+
+ try {
+ // Run the test class.
+ junitCore.run(testClazz);
+ } finally {
+ // Clear the critical error listener.
+ RavenwoodAwareTestRunner.private$ravenwood().setCriticalErrorHandler(null);
+ }
+
+ // Check the result.
+ assertWithMessage("Failure in test class: " + testClazz.getCanonicalName() + "]")
+ .that(listener.getResult())
+ .isEqualTo(expectedResult);
+ }
+
+ /**
+ * A JUnit RunListener that collects all the callbacks as a single string.
+ */
+ private static class ResultCollectingListener extends RunListener {
+ private final ArrayList<String> mResult = new ArrayList<>();
+
+ public final BiConsumer<String, Throwable> sCriticalErrorListener = (message, th) -> {
+ mResult.add("criticalError: " + message + ": " + th.getMessage());
+ };
+
+ @Override
+ public void testRunStarted(Description description) throws Exception {
+ mResult.add("testRunStarted: " + description);
+ }
+
+ @Override
+ public void testRunFinished(Result result) throws Exception {
+ mResult.add("testRunFinished: "
+ + result.getRunCount() + ","
+ + result.getFailureCount() + ","
+ + result.getAssumptionFailureCount() + ","
+ + result.getIgnoreCount());
+ }
+
+ @Override
+ public void testSuiteStarted(Description description) throws Exception {
+ mResult.add("testSuiteStarted: " + description);
+ }
+
+ @Override
+ public void testSuiteFinished(Description description) throws Exception {
+ mResult.add("testSuiteFinished: " + description);
+ }
+
+ @Override
+ public void testStarted(Description description) throws Exception {
+ mResult.add("testStarted: " + description);
+ }
+
+ @Override
+ public void testFinished(Description description) throws Exception {
+ mResult.add("testFinished: " + description);
+ }
+
+ @Override
+ public void testFailure(Failure failure) throws Exception {
+ mResult.add("testFailure: " + failure.getException().getMessage());
+ }
+
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ mResult.add("testAssumptionFailure: " + failure.getException().getMessage());
+ }
+
+ @Override
+ public void testIgnored(Description description) throws Exception {
+ mResult.add("testIgnored: " + description);
+ }
+
+ public String getResult() {
+ return String.join("\n", mResult);
+ }
+ }
+}
diff --git a/ravenwood/texts/ravenwood-annotation-allowed-classes.txt b/ravenwood/texts/ravenwood-annotation-allowed-classes.txt
index f3172ae..9c86389 100644
--- a/ravenwood/texts/ravenwood-annotation-allowed-classes.txt
+++ b/ravenwood/texts/ravenwood-annotation-allowed-classes.txt
@@ -9,17 +9,13 @@
com.android.internal.logging.testing.UiEventLoggerFake
com.android.internal.os.AndroidPrintStream
com.android.internal.os.BatteryStatsHistory
-com.android.internal.os.BatteryStatsHistory$TraceDelegate
-com.android.internal.os.BatteryStatsHistory$VarintParceler
com.android.internal.os.BatteryStatsHistoryIterator
com.android.internal.os.Clock
com.android.internal.os.LongArrayMultiStateCounter
-com.android.internal.os.LongArrayMultiStateCounter$LongArrayContainer
com.android.internal.os.LongMultiStateCounter
com.android.internal.os.MonotonicClock
com.android.internal.os.PowerProfile
com.android.internal.os.PowerStats
-com.android.internal.os.PowerStats$Descriptor
com.android.internal.os.RuntimeInit
com.android.internal.power.EnergyConsumerStats
com.android.internal.power.ModemPowerProfile
@@ -39,12 +35,14 @@
android.util.DataUnit
android.util.DayOfMonthCursor
android.util.DebugUtils
+android.util.DisplayMetrics
android.util.Dumpable
android.util.DumpableContainer
android.util.EmptyArray
android.util.EventLog
android.util.FloatProperty
android.util.FloatMath
+android.util.Half
android.util.IndentingPrintWriter
android.util.IntArray
android.util.IntProperty
@@ -98,10 +96,12 @@
android.util.SparseIntArray
android.util.SparseLongArray
android.util.SparseSetArray
+android.util.StateSet
android.util.StringBuilderPrinter
android.util.TeeWriter
android.util.TimeUtils
android.util.TimingsTraceLog
+android.util.TypedValue
android.util.UtilConfig
android.util.Xml
@@ -119,15 +119,9 @@
android.os.BaseBundle
android.os.BatteryConsumer
android.os.BatteryStats
-android.os.BatteryStats$HistoryItem
-android.os.BatteryStats$HistoryStepDetails
-android.os.BatteryStats$HistoryTag
-android.os.BatteryStats$LongCounter
-android.os.BatteryStats$ProcessStateChange
android.os.BatteryUsageStats
android.os.BatteryUsageStatsQuery
android.os.Binder
-android.os.Binder$IdentitySupplier
android.os.BluetoothBatteryStats
android.os.Broadcaster
android.os.Build
@@ -138,19 +132,17 @@
android.os.DeadObjectException
android.os.DeadSystemException
android.os.FileUtils
-android.os.FileUtils$MemoryPipe
android.os.Handler
android.os.HandlerExecutor
android.os.HandlerThread
android.os.IBinder
+android.os.LocaleList
android.os.Looper
android.os.Message
android.os.MessageQueue
android.os.PackageTagsList
android.os.Parcel
android.os.ParcelFileDescriptor
-android.os.ParcelFileDescriptor$AutoCloseInputStream
-android.os.ParcelFileDescriptor$AutoCloseOutputStream
android.os.ParcelFormatException
android.os.ParcelUuid
android.os.Parcelable
@@ -164,7 +156,6 @@
android.os.RemoteException
android.os.ResultReceiver
android.os.ServiceManager
-android.os.ServiceManager$ServiceNotFoundException
android.os.ServiceSpecificException
android.os.StrictMode
android.os.SystemClock
@@ -175,23 +166,20 @@
android.os.Trace
android.os.TransactionTooLargeException
android.os.UserBatteryConsumer
-android.os.UserBatteryConsumer$Builder
android.os.UidBatteryConsumer
-android.os.UidBatteryConsumer$Builder
android.os.UserHandle
android.os.UserManager
android.os.VibrationAttributes
-android.os.VibrationAttributes$Builder
android.os.WakeLockStats
android.os.WorkSource
android.content.ClipData
-android.content.ClipData$Item
android.content.ClipDescription
android.content.ClipboardManager
android.content.ComponentName
android.content.ContentUris
android.content.ContentValues
+android.content.Context
android.content.ContextWrapper
android.content.Intent
android.content.IntentFilter
@@ -202,11 +190,7 @@
android.content.pm.ComponentInfo
android.content.pm.PackageInfo
android.content.pm.PackageItemInfo
-android.content.pm.PackageManager$Flags
-android.content.pm.PackageManager$PackageInfoFlags
-android.content.pm.PackageManager$ApplicationInfoFlags
-android.content.pm.PackageManager$ComponentInfoFlags
-android.content.pm.PackageManager$ResolveInfoFlags
+android.content.pm.PackageManager
android.content.pm.PathPermission
android.content.pm.ProviderInfo
android.content.pm.ResolveInfo
@@ -214,6 +198,32 @@
android.content.pm.Signature
android.content.pm.UserInfo
+android.content.res.ApkAssets
+android.content.res.AssetFileDescriptor
+android.content.res.AssetManager
+android.content.res.ColorStateList
+android.content.res.ConfigurationBoundResourceCache
+android.content.res.Configuration
+android.content.res.CompatibilityInfo
+android.content.res.ComplexColor
+android.content.res.ConstantState
+android.content.res.DrawableCache
+android.content.res.Element
+android.content.res.FontResourcesParser
+android.content.res.FontScaleConverter
+android.content.res.FontScaleConverterImpl
+android.content.res.FontScaleConverterFactory
+android.content.res.Resources
+android.content.res.ResourceId
+android.content.res.ResourcesImpl
+android.content.res.ResourcesKey
+android.content.res.StringBlock
+android.content.res.TagCounter
+android.content.res.ThemedResourceCache
+android.content.res.TypedArray
+android.content.res.Validator
+android.content.res.XmlBlock
+
android.database.AbstractCursor
android.database.CharArrayBuffer
android.database.ContentObservable
@@ -226,7 +236,6 @@
android.database.DataSetObservable
android.database.DataSetObserver
android.database.MatrixCursor
-android.database.MatrixCursor$RowBuilder
android.database.MergeCursor
android.database.Observable
android.database.SQLException
@@ -234,7 +243,6 @@
android.database.sqlite.SQLiteException
android.text.TextUtils
-android.text.TextUtils$SimpleStringSplitter
android.accounts.Account
@@ -244,7 +252,11 @@
android.graphics.Insets
android.graphics.Interpolator
android.graphics.Matrix
+android.graphics.Matrix44
+android.graphics.Outline
+android.graphics.ParcelableColorSpace
android.graphics.Path
+android.graphics.PixelFormat
android.graphics.Point
android.graphics.PointF
android.graphics.Rect
@@ -254,15 +266,18 @@
android.app.ActivityManager
android.app.ActivityOptions
+android.app.ApplicationPackageManager
android.app.BroadcastOptions
android.app.ComponentOptions
android.app.Instrumentation
+android.app.LocaleConfig
+android.app.ResourcesManager
+android.app.WindowConfiguration
android.metrics.LogMaker
android.view.Display
-android.view.Display$HdrCapabilities
-android.view.Display$Mode
+android.view.DisplayAdjustments
android.view.DisplayInfo
android.view.inputmethod.InputBinding
@@ -274,10 +289,18 @@
android.telephony.ModemActivityInfo
android.telephony.ServiceState
+android.os.connectivity.CellularBatteryStats
android.os.connectivity.WifiActivityEnergyInfo
+android.os.connectivity.WifiBatteryStats
com.android.server.LocalServices
+com.android.internal.graphics.cam.Cam
+com.android.internal.graphics.cam.CamUtils
+com.android.internal.graphics.cam.Frame
+com.android.internal.graphics.cam.HctSolver
+com.android.internal.graphics.ColorUtils
+
com.android.internal.util.BitUtils
com.android.internal.util.BitwiseInputStream
com.android.internal.util.BitwiseOutputStream
@@ -302,6 +325,7 @@
com.android.internal.util.QuickSelect
com.android.internal.util.RingBuffer
com.android.internal.util.SizedInputStream
+com.android.internal.util.RateLimitingCache
com.android.internal.util.StringPool
com.android.internal.util.TokenBucket
com.android.internal.util.XmlPullParserWrapper
diff --git a/ravenwood/texts/ravenwood-framework-policies.txt b/ravenwood/texts/ravenwood-framework-policies.txt
index 4012bdc..d962c82 100644
--- a/ravenwood/texts/ravenwood-framework-policies.txt
+++ b/ravenwood/texts/ravenwood-framework-policies.txt
@@ -9,11 +9,21 @@
# Keep all sysprops generated code implementations
class :sysprops keepclass
+# Keep all resource R classes
+class :r keepclass
+
# To avoid VerifyError on nano proto files (b/324063814), we rename nano proto classes.
-# Note: The "rename" directive must use shashes (/) as a package name separator.
+# Note: The "rename" directive must use slashes (/) as a package name separator.
rename com/.*/nano/ devicenano/
rename android/.*/nano/ devicenano/
+# Support APIs not available in standard JRE
+class java.io.FileDescriptor keep
+ method getInt$ ()I @com.android.ravenwood.RavenwoodJdkPatch.getInt$
+ method setInt$ (I)V @com.android.ravenwood.RavenwoodJdkPatch.setInt$
+class java.util.LinkedHashMap keep
+ method eldest ()Ljava/util/Map$Entry; @com.android.ravenwood.RavenwoodJdkPatch.eldest
+
# Exported to Mainline modules; cannot use annotations
class com.android.internal.util.FastXmlSerializer keepclass
class com.android.internal.util.FileRotator keepclass
@@ -62,3 +72,7 @@
method <init> ()V keep
class android.text.ClipboardManager keep
method <init> ()V keep
+
+# Just enough to allow ResourcesManager to run
+class android.hardware.display.DisplayManagerGlobal keep
+ method getInstance ()Landroid/hardware/display/DisplayManagerGlobal; ignore
diff --git a/ravenwood/texts/ravenwood-standard-options.txt b/ravenwood/texts/ravenwood-standard-options.txt
index f64f26d..3ec3e3c 100644
--- a/ravenwood/texts/ravenwood-standard-options.txt
+++ b/ravenwood/texts/ravenwood-standard-options.txt
@@ -6,8 +6,6 @@
--default-throw
# Uncomment below lines to enable each feature.
-# --enable-non-stub-method-check
---no-non-stub-method-check
#--default-method-call-hook
# com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -34,8 +32,11 @@
--substitute-annotation
android.ravenwood.annotation.RavenwoodReplace
---native-substitute-annotation
- android.ravenwood.annotation.RavenwoodNativeSubstitutionClass
+--redirect-annotation
+ android.ravenwood.annotation.RavenwoodRedirect
+
+--redirection-class-annotation
+ android.ravenwood.annotation.RavenwoodRedirectionClass
--class-load-hook-annotation
android.ravenwood.annotation.RavenwoodClassLoadHook
diff --git a/ravenwood/tools/ravenizer/Android.bp b/ravenwood/tools/ravenizer/Android.bp
new file mode 100644
index 0000000..2892d07
--- /dev/null
+++ b/ravenwood/tools/ravenizer/Android.bp
@@ -0,0 +1,25 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_base_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_base_license"],
+}
+
+java_binary_host {
+ name: "ravenizer",
+ main_class: "com.android.platform.test.ravenwood.ravenizer.RavenizerMain",
+ srcs: ["src/**/*.kt"],
+ static_libs: [
+ "hoststubgen-lib",
+ "ow2-asm",
+ "ow2-asm-analysis",
+ "ow2-asm-commons",
+ "ow2-asm-tree",
+ "ow2-asm-util",
+ "junit",
+ "ravenwood-junit-impl-for-ravenizer",
+ ],
+ visibility: ["//visibility:public"],
+}
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Exceptions.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Exceptions.kt
new file mode 100644
index 0000000..0dcd271
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Exceptions.kt
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+@file:Suppress("ktlint:standard:filename")
+
+package com.android.platform.test.ravenwood.ravenizer
+
+import com.android.hoststubgen.UserErrorException
+
+/**
+ * Use it for internal exception that really shouldn't happen.
+ */
+class RavenizerInternalException(message: String) : Exception(message)
+
+/**
+ * Thrown when an invalid test is detected in the target jar. (e.g. JUni3 tests)
+ */
+class RavenizerInvalidTestException(message: String) : Exception(message), UserErrorException
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Ravenizer.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Ravenizer.kt
new file mode 100644
index 0000000..f7f9a85
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Ravenizer.kt
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2024 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 com.android.platform.test.ravenwood.ravenizer
+
+import com.android.hoststubgen.GeneralUserErrorException
+import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.zipEntryNameToClassName
+import com.android.hoststubgen.executableName
+import com.android.hoststubgen.log
+import com.android.platform.test.ravenwood.ravenizer.adapter.RunnerRewritingAdapter
+import org.objectweb.asm.ClassReader
+import org.objectweb.asm.ClassVisitor
+import org.objectweb.asm.ClassWriter
+import org.objectweb.asm.util.CheckClassAdapter
+import java.io.BufferedInputStream
+import java.io.BufferedOutputStream
+import java.io.FileOutputStream
+import java.io.InputStream
+import java.io.OutputStream
+import java.util.zip.ZipEntry
+import java.util.zip.ZipFile
+import java.util.zip.ZipOutputStream
+
+/**
+ * Various stats on Ravenizer.
+ */
+data class RavenizerStats(
+ /** Total end-to-end time. */
+ var totalTime: Double = .0,
+
+ /** Time took to build [ClasNodes] */
+ var loadStructureTime: Double = .0,
+
+ /** Time took to validate the classes */
+ var validationTime: Double = .0,
+
+ /** Total real time spent for converting the jar file */
+ var totalProcessTime: Double = .0,
+
+ /** Total real time spent for converting class files (except for I/O time). */
+ var totalConversionTime: Double = .0,
+
+ /** Total real time spent for copying class files without modification. */
+ var totalCopyTime: Double = .0,
+
+ /** # of entries in the input jar file */
+ var totalEntiries: Int = 0,
+
+ /** # of *.class files in the input jar file */
+ var totalClasses: Int = 0,
+
+ /** # of *.class files that have been processed. */
+ var processedClasses: Int = 0,
+) {
+ override fun toString(): String {
+ return """
+ RavenizerStats{
+ totalTime=$totalTime,
+ loadStructureTime=$loadStructureTime,
+ validationTime=$validationTime,
+ totalProcessTime=$totalProcessTime,
+ totalConversionTime=$totalConversionTime,
+ totalCopyTime=$totalCopyTime,
+ totalEntiries=$totalEntiries,
+ totalClasses=$totalClasses,
+ processedClasses=$processedClasses,
+ }
+ """.trimIndent()
+ }
+}
+
+/**
+ * Main class.
+ */
+class Ravenizer(val options: RavenizerOptions) {
+ fun run() {
+ val stats = RavenizerStats()
+
+ val fatalValidation = options.fatalValidation.get
+
+ stats.totalTime = log.nTime {
+ process(
+ options.inJar.get,
+ options.outJar.get,
+ options.enableValidation.get,
+ fatalValidation,
+ stats,
+ )
+ }
+ log.i(stats.toString())
+ }
+
+ private fun process(
+ inJar: String,
+ outJar: String,
+ enableValidation: Boolean,
+ fatalValidation: Boolean,
+ stats: RavenizerStats,
+ ) {
+ var allClasses = ClassNodes.loadClassStructures(inJar) {
+ time -> stats.loadStructureTime = time
+ }
+ if (enableValidation) {
+ stats.validationTime = log.iTime("Validating classes") {
+ if (!validateClasses(allClasses)) {
+ var message = "Invalid test class(es) detected." +
+ " See error log for details."
+ if (fatalValidation) {
+ throw RavenizerInvalidTestException(message)
+ } else {
+ log.w("Warning: $message")
+ }
+ }
+ }
+ }
+
+ stats.totalProcessTime = log.vTime("$executableName processing $inJar") {
+ ZipFile(inJar).use { inZip ->
+ val inEntries = inZip.entries()
+
+ stats.totalEntiries = inZip.size()
+
+ ZipOutputStream(BufferedOutputStream(FileOutputStream(outJar))).use { outZip ->
+ while (inEntries.hasMoreElements()) {
+ val entry = inEntries.nextElement()
+
+ if (entry.name.endsWith(".dex")) {
+ // Seems like it's an ART jar file. We can't process it.
+ // It's a fatal error.
+ throw GeneralUserErrorException(
+ "$inJar is not a desktop jar file. It contains a *.dex file."
+ )
+ }
+
+ val className = zipEntryNameToClassName(entry.name)
+
+ if (className != null) {
+ stats.totalClasses += 1
+ }
+
+ if (className != null && shouldProcessClass(allClasses, className)) {
+ stats.processedClasses += 1
+ processSingleClass(inZip, entry, outZip, allClasses, stats)
+ } else {
+ // Too slow, let's use merge_zips to bring back the original classes.
+ copyZipEntry(inZip, entry, outZip, stats)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Copy a single ZIP entry to the output.
+ */
+ private fun copyZipEntry(
+ inZip: ZipFile,
+ entry: ZipEntry,
+ out: ZipOutputStream,
+ stats: RavenizerStats,
+ ) {
+ stats.totalCopyTime += log.nTime {
+ inZip.getInputStream(entry).use { ins ->
+ // Copy unknown entries as is to the impl out. (but not to the stub out.)
+ val outEntry = ZipEntry(entry.name)
+ outEntry.method = 0
+ outEntry.size = entry.size
+ outEntry.crc = entry.crc
+ out.putNextEntry(outEntry)
+
+ ins.transferTo(out)
+
+ out.closeEntry()
+ }
+ }
+ }
+
+ private fun processSingleClass(
+ inZip: ZipFile,
+ entry: ZipEntry,
+ outZip: ZipOutputStream,
+ allClasses: ClassNodes,
+ stats: RavenizerStats,
+ ) {
+ val newEntry = ZipEntry(entry.name)
+ outZip.putNextEntry(newEntry)
+
+ BufferedInputStream(inZip.getInputStream(entry)).use { bis ->
+ processSingleClass(entry, bis, outZip, allClasses, stats)
+ }
+ outZip.closeEntry()
+ }
+
+ /**
+ * Whether a class needs to be processed. This must be kept in sync with [processSingleClass].
+ */
+ private fun shouldProcessClass(classes: ClassNodes, classInternalName: String): Boolean {
+ return !classInternalName.shouldByBypassed()
+ && RunnerRewritingAdapter.shouldProcess(classes, classInternalName)
+ }
+
+ private fun processSingleClass(
+ entry: ZipEntry,
+ input: InputStream,
+ output: OutputStream,
+ allClasses: ClassNodes,
+ stats: RavenizerStats,
+ ) {
+ val cr = ClassReader(input)
+
+ lateinit var data: ByteArray
+ stats.totalConversionTime += log.vTime("Modify ${entry.name}") {
+
+ val classInternalName = zipEntryNameToClassName(entry.name)
+ ?: throw RavenizerInternalException("Unexpected zip entry name: ${entry.name}")
+ val flags = ClassWriter.COMPUTE_MAXS
+ val cw = ClassWriter(flags)
+ var outVisitor: ClassVisitor = cw
+
+ val enableChecker = false
+ if (enableChecker) {
+ outVisitor = CheckClassAdapter(outVisitor)
+ }
+
+ // This must be kept in sync with shouldProcessClass.
+ outVisitor = RunnerRewritingAdapter.maybeApply(
+ classInternalName, allClasses, outVisitor)
+
+ cr.accept(outVisitor, ClassReader.EXPAND_FRAMES)
+
+ data = cw.toByteArray()
+ }
+ output.write(data)
+ }
+}
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/RavenizerMain.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/RavenizerMain.kt
new file mode 100644
index 0000000..ff41818
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/RavenizerMain.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+@file:JvmName("RavenizerMain")
+
+package com.android.platform.test.ravenwood.ravenizer
+
+import com.android.hoststubgen.LogLevel
+import com.android.hoststubgen.executableName
+import com.android.hoststubgen.log
+import com.android.hoststubgen.runMainWithBoilerplate
+
+/**
+ * Entry point.
+ */
+fun main(args: Array<String>) {
+ executableName = "Ravenizer"
+ log.setConsoleLogLevel(LogLevel.Info)
+
+ runMainWithBoilerplate {
+ val options = RavenizerOptions.parseArgs(args)
+
+ log.i("$executableName started")
+ log.v("Options: $options")
+
+ // Run.
+ Ravenizer(options).run()
+ }
+}
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/RavenizerOptions.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/RavenizerOptions.kt
new file mode 100644
index 0000000..10fe0a3
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/RavenizerOptions.kt
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2024 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 com.android.platform.test.ravenwood.ravenizer
+
+import com.android.hoststubgen.ArgIterator
+import com.android.hoststubgen.ArgumentsException
+import com.android.hoststubgen.SetOnce
+import com.android.hoststubgen.ensureFileExists
+import com.android.hoststubgen.log
+import java.nio.file.Paths
+import kotlin.io.path.exists
+
+/**
+ * If this file exits, we also read options from it. This is "unsafe" because it could break
+ * incremental builds, if it sets any flag that affects the output file.
+ * (however, for now, there's no such options.)
+ *
+ * For example, to enable verbose logging, do `echo '-v' > ~/.raveniezr-unsafe`
+ *
+ * (but even the content of this file changes, soong won't rerun the command, so you need to
+ * remove the output first and then do a build again.)
+ */
+private val RAVENIZER_DOTFILE = System.getenv("HOME") + "/.raveniezr-unsafe"
+
+class RavenizerOptions(
+ /** Input jar file*/
+ var inJar: SetOnce<String> = SetOnce(""),
+
+ /** Output jar file */
+ var outJar: SetOnce<String> = SetOnce(""),
+
+ /** Whether to enable test validation. */
+ var enableValidation: SetOnce<Boolean> = SetOnce(true),
+
+ /** Whether the validation failure is fatal or not. */
+ var fatalValidation: SetOnce<Boolean> = SetOnce(false),
+) {
+ companion object {
+
+ fun parseArgs(origArgs: Array<String>): RavenizerOptions {
+ val args = origArgs.toMutableList()
+ if (Paths.get(RAVENIZER_DOTFILE).exists()) {
+ log.i("Reading options from $RAVENIZER_DOTFILE")
+ args.add(0, "@$RAVENIZER_DOTFILE")
+ }
+
+ val ret = RavenizerOptions()
+ val ai = ArgIterator.withAtFiles(args.toTypedArray())
+
+ while (true) {
+ val arg = ai.nextArgOptional()
+ if (arg == null) {
+ break
+ }
+
+ fun nextArg(): String = ai.nextArgRequired(arg)
+
+ if (log.maybeHandleCommandLineArg(arg) { nextArg() }) {
+ continue
+ }
+ try {
+ when (arg) {
+ // TODO: Write help
+ "-h", "--help" -> TODO("Help is not implemented yet")
+
+ "--in-jar" -> ret.inJar.set(nextArg()).ensureFileExists()
+ "--out-jar" -> ret.outJar.set(nextArg())
+
+ "--enable-validation" -> ret.enableValidation.set(true)
+ "--disable-validation" -> ret.enableValidation.set(false)
+
+ "--fatal-validation" -> ret.fatalValidation.set(true)
+ "--no-fatal-validation" -> ret.fatalValidation.set(false)
+
+ else -> throw ArgumentsException("Unknown option: $arg")
+ }
+ } catch (e: SetOnce.SetMoreThanOnceException) {
+ throw ArgumentsException("Duplicate or conflicting argument found: $arg")
+ }
+ }
+
+ if (!ret.inJar.isSet) {
+ throw ArgumentsException("Required option missing: --in-jar")
+ }
+ if (!ret.outJar.isSet) {
+ throw ArgumentsException("Required option missing: --out-jar")
+ }
+ return ret
+ }
+ }
+
+ override fun toString(): String {
+ return """
+ RavenizerOptions{
+ inJar=$inJar,
+ outJar=$outJar,
+ enableValidation=$enableValidation,
+ fatalValidation=$fatalValidation,
+ }
+ """.trimIndent()
+ }
+}
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Utils.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Utils.kt
new file mode 100644
index 0000000..1aa70c08
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Utils.kt
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2024 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 com.android.platform.test.ravenwood.ravenizer
+
+import android.platform.test.annotations.NoRavenizer
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner
+import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.findAnyAnnotation
+import com.android.hoststubgen.asm.startsWithAny
+import com.android.hoststubgen.asm.toHumanReadableClassName
+import org.junit.rules.TestRule
+import org.junit.runner.RunWith
+import org.objectweb.asm.Type
+
+data class TypeHolder(
+ val clazz: Class<*>,
+) {
+ val type = Type.getType(clazz)
+ val desc = type.descriptor
+ val descAsSet = setOf<String>(desc)
+ val internlName = type.internalName
+ val humanReadableName = type.internalName.toHumanReadableClassName()
+}
+
+val testAnotType = TypeHolder(org.junit.Test::class.java)
+val ruleAnotType = TypeHolder(org.junit.Rule::class.java)
+val classRuleAnotType = TypeHolder(org.junit.ClassRule::class.java)
+val runWithAnotType = TypeHolder(RunWith::class.java)
+val innerRunnerAnotType = TypeHolder(RavenwoodAwareTestRunner.InnerRunner::class.java)
+val noRavenizerAnotType = TypeHolder(NoRavenizer::class.java)
+
+val testRuleType = TypeHolder(TestRule::class.java)
+val ravenwoodTestRunnerType = TypeHolder(RavenwoodAwareTestRunner::class.java)
+
+/**
+ * Returns true, if a test looks like it's a test class which needs to be processed.
+ */
+fun isTestLookingClass(classes: ClassNodes, className: String): Boolean {
+ // Similar to com.android.tradefed.lite.HostUtils.testLoadClass(), except it's more lenient,
+ // and accept non-public and/or abstract classes.
+ // HostUtils also checks "Suppress" or "SuiteClasses" but this one doesn't.
+ // TODO: SuiteClasses may need to be supported.
+
+ val cn = classes.findClass(className) ?: return false
+
+ if (cn.findAnyAnnotation(runWithAnotType.descAsSet) != null) {
+ return true
+ }
+ cn.methods?.forEach { method ->
+ if (method.findAnyAnnotation(testAnotType.descAsSet) != null) {
+ return true
+ }
+ }
+
+ // Check the super class.
+ if (cn.superName == null) {
+ return false
+ }
+ return isTestLookingClass(classes, cn.superName)
+}
+
+fun String.isRavenwoodClass(): Boolean {
+ return this.startsWithAny(
+ "com/android/hoststubgen/",
+ "android/platform/test/ravenwood",
+ "com/android/ravenwood/",
+ "com/android/platform/test/ravenwood/",
+ )
+}
+
+/**
+ * Classes that should never be modified.
+ */
+fun String.shouldByBypassed(): Boolean {
+ if (this.isRavenwoodClass()) {
+ return true
+ }
+ return this.startsWithAny(
+ "java/", // just in case...
+ "javax/",
+ "junit/",
+ "org/junit/",
+ "org/mockito/",
+ "kotlin/",
+ "androidx/",
+ "android/support/",
+ // TODO -- anything else?
+ )
+}
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Validator.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Validator.kt
new file mode 100644
index 0000000..27092d2
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/Validator.kt
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2024 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 com.android.platform.test.ravenwood.ravenizer
+
+import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.startsWithAny
+import com.android.hoststubgen.asm.toHumanReadableClassName
+import com.android.hoststubgen.log
+import org.objectweb.asm.tree.ClassNode
+
+fun validateClasses(classes: ClassNodes): Boolean {
+ var allOk = true
+ classes.forEach { allOk = checkClass(it, classes) && allOk }
+
+ return allOk
+}
+
+/**
+ * Validate a class.
+ *
+ * - A test class shouldn't extend
+ *
+ */
+fun checkClass(cn: ClassNode, classes: ClassNodes): Boolean {
+ if (cn.name.shouldByBypassed()) {
+ // Class doesn't need to be checked.
+ return true
+ }
+ var allOk = true
+
+ // See if there's any class that extends a legacy base class.
+ // But ignore the base classes in android.test.
+ if (!cn.name.startsWithAny("android/test/")) {
+ allOk = checkSuperClass(cn, cn, classes) && allOk
+ }
+ return allOk
+}
+
+fun checkSuperClass(targetClass: ClassNode, currentClass: ClassNode, classes: ClassNodes): Boolean {
+ if (currentClass.superName == null || currentClass.superName == "java/lang/Object") {
+ return true // No parent class
+ }
+ if (currentClass.superName.isLegacyTestBaseClass()) {
+ log.e("Error: Class ${targetClass.name.toHumanReadableClassName()} extends"
+ + " a legacy test class ${currentClass.superName.toHumanReadableClassName()}.")
+ return false
+ }
+ classes.findClass(currentClass.superName)?.let {
+ return checkSuperClass(targetClass, it, classes)
+ }
+ // Super class not found.
+ // log.w("Class ${currentClass.superName} not found.")
+ return true
+}
+
+/**
+ * Check if a class internal name is a known legacy test base class.
+ */
+fun String.isLegacyTestBaseClass(): Boolean {
+ return this.startsWithAny(
+ "junit/framework/TestCase",
+
+ // In case the test doesn't statically include JUnit, we need
+ "android/test/AndroidTestCase",
+ "android/test/InstrumentationTestCase",
+ "android/test/InstrumentationTestSuite",
+ )
+}
diff --git a/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt
new file mode 100644
index 0000000..cf6d6f6
--- /dev/null
+++ b/ravenwood/tools/ravenizer/src/com/android/platform/test/ravenwood/ravenizer/adapter/RunnerRewritingAdapter.kt
@@ -0,0 +1,466 @@
+/*
+ * Copyright (C) 2024 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 com.android.platform.test.ravenwood.ravenizer.adapter
+
+import android.platform.test.ravenwood.RavenwoodAwareTestRunner
+import com.android.hoststubgen.ClassParseException
+import com.android.hoststubgen.asm.CLASS_INITIALIZER_DESC
+import com.android.hoststubgen.asm.CLASS_INITIALIZER_NAME
+import com.android.hoststubgen.asm.CTOR_NAME
+import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.findAnnotationValueAsType
+import com.android.hoststubgen.asm.findAnyAnnotation
+import com.android.hoststubgen.asm.toHumanReadableClassName
+import com.android.hoststubgen.log
+import com.android.hoststubgen.visitors.OPCODE_VERSION
+import com.android.platform.test.ravenwood.ravenizer.RavenizerInternalException
+import com.android.platform.test.ravenwood.ravenizer.classRuleAnotType
+import com.android.platform.test.ravenwood.ravenizer.isTestLookingClass
+import com.android.platform.test.ravenwood.ravenizer.innerRunnerAnotType
+import com.android.platform.test.ravenwood.ravenizer.noRavenizerAnotType
+import com.android.platform.test.ravenwood.ravenizer.ravenwoodTestRunnerType
+import com.android.platform.test.ravenwood.ravenizer.ruleAnotType
+import com.android.platform.test.ravenwood.ravenizer.runWithAnotType
+import com.android.platform.test.ravenwood.ravenizer.testRuleType
+import org.objectweb.asm.AnnotationVisitor
+import org.objectweb.asm.ClassVisitor
+import org.objectweb.asm.FieldVisitor
+import org.objectweb.asm.MethodVisitor
+import org.objectweb.asm.Opcodes
+import org.objectweb.asm.Opcodes.ACC_FINAL
+import org.objectweb.asm.Opcodes.ACC_PUBLIC
+import org.objectweb.asm.Opcodes.ACC_STATIC
+import org.objectweb.asm.commons.AdviceAdapter
+import org.objectweb.asm.tree.ClassNode
+
+/**
+ * Class visitor to update the RunWith and inject some necessary rules.
+ *
+ * - Change the @RunWith(RavenwoodAwareTestRunner.class).
+ * - If the original class has a @RunWith(...), then change it to an @OrigRunWith(...).
+ * - Add RavenwoodAwareTestRunner's member rules as junit rules.
+ * - Update the order of the existing JUnit rules to make sure they don't use the MIN or MAX.
+ */
+class RunnerRewritingAdapter private constructor(
+ protected val classes: ClassNodes,
+ nextVisitor: ClassVisitor,
+) : ClassVisitor(OPCODE_VERSION, nextVisitor) {
+ /** Arbitrary cut-off point when deciding whether to change the order or an existing rule.*/
+ val RULE_ORDER_TWEAK_CUTOFF = 1973020500
+
+ /** Current class's internal name */
+ lateinit var classInternalName: String
+
+ /** [ClassNode] for the current class */
+ lateinit var classNode: ClassNode
+
+ /** True if this visitor is generating code. */
+ var isGeneratingCode = false
+
+ /** Run a [block] with [isGeneratingCode] set to true. */
+ private inline fun <T> generateCode(block: () -> T): T {
+ isGeneratingCode = true
+ try {
+ return block()
+ } finally {
+ isGeneratingCode = false
+ }
+ }
+
+ override fun visit(
+ version: Int,
+ access: Int,
+ name: String?,
+ signature: String?,
+ superName: String?,
+ interfaces: Array<out String>?,
+ ) {
+ classInternalName = name!!
+ classNode = classes.getClass(name)
+ if (!isTestLookingClass(classes, name)) {
+ throw RavenizerInternalException("This adapter shouldn't be used for non-test class")
+ }
+ super.visit(version, access, name, signature, superName, interfaces)
+
+ generateCode {
+ injectRunWithAnnotation()
+ if (!classes.hasClassInitializer(classInternalName)) {
+ injectStaticInitializer()
+ }
+ injectRules()
+ }
+ }
+
+ /**
+ * Remove the original @RunWith annotation.
+ */
+ override fun visitAnnotation(descriptor: String?, visible: Boolean): AnnotationVisitor? {
+ if (!isGeneratingCode && runWithAnotType.desc == descriptor) {
+ return null
+ }
+ return super.visitAnnotation(descriptor, visible)
+ }
+
+ override fun visitField(
+ access: Int,
+ name: String,
+ descriptor: String,
+ signature: String?,
+ value: Any?
+ ): FieldVisitor {
+ val fallback = super.visitField(access, name, descriptor, signature, value)
+ if (isGeneratingCode) {
+ return fallback
+ }
+ return FieldRuleOrderRewriter(name, fallback)
+ }
+
+ /** Inject an empty <clinit>. The body will be injected by [visitMethod]. */
+ private fun injectStaticInitializer() {
+ visitMethod(
+ Opcodes.ACC_PRIVATE or Opcodes.ACC_STATIC,
+ CLASS_INITIALIZER_NAME,
+ CLASS_INITIALIZER_DESC,
+ null,
+ null
+ )!!.let { mv ->
+ mv.visitCode()
+ mv.visitInsn(Opcodes.RETURN)
+ mv.visitMaxs(0, 0)
+ mv.visitEnd()
+ }
+ }
+
+ /**
+ * Inject `@RunWith(RavenwoodAwareTestRunner.class)`. If the class already has
+ * a `@RunWith`, then change it to add a `@OrigRunWith`.
+ */
+ private fun injectRunWithAnnotation() {
+ // Extract the original RunWith annotation and its value.
+ val runWith = classNode.findAnyAnnotation(runWithAnotType.descAsSet)
+ val runWithClass = runWith?.let { an ->
+ findAnnotationValueAsType(an, "value")
+ }
+
+ if (runWith != null) {
+ if (runWithClass == ravenwoodTestRunnerType.type) {
+ // It already uses RavenwoodTestRunner. We'll just keep it, but we need to
+ // inject it again because the original one is removed by visitAnnotation().
+ log.d("Class ${classInternalName.toHumanReadableClassName()}" +
+ " already uses RavenwoodTestRunner.")
+ visitAnnotation(runWithAnotType.desc, true)!!.let { av ->
+ av.visit("value", ravenwoodTestRunnerType)
+ av.visitEnd()
+ }
+ return
+ }
+ if (runWithClass == null) {
+ throw ClassParseException("@RunWith annotation doesn't have a property \"value\""
+ + " in class ${classInternalName.toHumanReadableClassName()}")
+ }
+
+ // Inject an @OrigRunWith.
+ visitAnnotation(innerRunnerAnotType.desc, true)!!.let { av ->
+ av.visit("value", runWithClass)
+ av.visitEnd()
+ }
+ }
+
+ // Inject a @RunWith(RavenwoodAwareTestRunner.class).
+ visitAnnotation(runWithAnotType.desc, true)!!.let { av ->
+ av.visit("value", ravenwoodTestRunnerType.type)
+ av.visitEnd()
+ }
+ log.v("Update the @RunWith: ${classInternalName.toHumanReadableClassName()}")
+ }
+
+ /*
+ Generate the fields and the ctor, which should looks like this:
+
+ public static final org.junit.rules.TestRule sRavenwoodImplicitClassMinRule;
+ descriptor: Lorg/junit/rules/TestRule;
+ flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
+ RuntimeVisibleAnnotations:
+ 0: #49(#50=I#51)
+ org.junit.ClassRule(
+ order=-2147483648
+ )
+
+ public static final org.junit.rules.TestRule sRavenwoodImplicitClassMaxRule;
+ descriptor: Lorg/junit/rules/TestRule;
+ flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
+ RuntimeVisibleAnnotations:
+ 0: #49(#50=I#52)
+ org.junit.ClassRule(
+ order=2147483647
+ )
+
+ public final org.junit.rules.TestRule sRavenwoodImplicitInstanceMinRule;
+ descriptor: Lorg/junit/rules/TestRule;
+ flags: (0x0011) ACC_PUBLIC, ACC_FINAL
+ RuntimeVisibleAnnotations:
+ 0: #53(#50=I#51)
+ org.junit.Rule(
+ order=-2147483648
+ )
+
+ public final org.junit.rules.TestRule sRavenwoodImplicitInstanceMaxRule;
+ descriptor: Lorg/junit/rules/TestRule;
+ flags: (0x0011) ACC_PUBLIC, ACC_FINAL
+ RuntimeVisibleAnnotations:
+ 0: #53(#50=I#52)
+ org.junit.Rule(
+ order=2147483647
+ )
+ */
+
+ val sRavenwood_ClassRuleMin = "sRavenwood_ClassRuleMin"
+ val sRavenwood_ClassRuleMax = "sRavenwood_ClassRuleMax"
+ val mRavenwood_InstRuleMin = "mRavenwood_InstRuleMin"
+ val mRavenwood_InstRuleMax = "mRavenwood_InstRuleMax"
+
+ private fun injectRules() {
+ injectRule(sRavenwood_ClassRuleMin, true, Integer.MIN_VALUE)
+ injectRule(sRavenwood_ClassRuleMax, true, Integer.MAX_VALUE)
+ injectRule(mRavenwood_InstRuleMin, false, Integer.MIN_VALUE)
+ injectRule(mRavenwood_InstRuleMax, false, Integer.MAX_VALUE)
+ }
+
+ private fun injectRule(fieldName: String, isStatic: Boolean, order: Int) {
+ visitField(
+ ACC_PUBLIC or ACC_FINAL or (if (isStatic) ACC_STATIC else 0),
+ fieldName,
+ testRuleType.desc,
+ null,
+ null,
+ ).let { fv ->
+ val anot = if (isStatic) { classRuleAnotType } else { ruleAnotType }
+ fv.visitAnnotation(anot.desc, true).let {
+ it.visit("order", order)
+ it.visitEnd()
+ }
+ fv.visitEnd()
+ }
+ }
+
+ override fun visitMethod(
+ access: Int,
+ name: String,
+ descriptor: String,
+ signature: String?,
+ exceptions: Array<String>?,
+ ): MethodVisitor {
+ val next = super.visitMethod(access, name, descriptor, signature, exceptions)
+ if (name == CLASS_INITIALIZER_NAME && descriptor == CLASS_INITIALIZER_DESC) {
+ return ClassInitializerVisitor(
+ access, name, descriptor, signature, exceptions, next)
+ }
+ if (name == CTOR_NAME) {
+ return ConstructorVisitor(
+ access, name, descriptor, signature, exceptions, next)
+ }
+ return next
+ }
+
+ /*
+
+ static {};
+ descriptor: ()V
+ flags: (0x0008) ACC_STATIC
+ Code:
+ stack=1, locals=0, args_size=0
+ 0: getstatic #36 // Field android/platform/test/ravenwood/RavenwoodAwareTestRunner.RavenwoodImplicitClassMinRule:Lorg/junit/rules/TestRule;
+ 3: putstatic #39 // Field sRavenwoodImplicitClassMinRule:Lorg/junit/rules/TestRule;
+ 6: getstatic #42 // Field android/platform/test/ravenwood/RavenwoodAwareTestRunner.RavenwoodImplicitClassMaxRule:Lorg/junit/rules/TestRule;
+ 9: putstatic #45 // Field sRavenwoodImplicitClassMaxRule:Lorg/junit/rules/TestRule;
+ 12: return
+ LineNumberTable:
+ line 33: 0
+ line 36: 6
+ */
+ private inner class ClassInitializerVisitor(
+ access: Int,
+ val name: String,
+ val descriptor: String,
+ signature: String?,
+ exceptions: Array<String>?,
+ next: MethodVisitor?,
+ ) : MethodVisitor(OPCODE_VERSION, next) {
+ override fun visitCode() {
+ visitFieldInsn(Opcodes.GETSTATIC,
+ ravenwoodTestRunnerType.internlName,
+ RavenwoodAwareTestRunner.IMPLICIT_CLASS_OUTER_RULE_NAME,
+ testRuleType.desc
+ )
+ visitFieldInsn(Opcodes.PUTSTATIC,
+ classInternalName,
+ sRavenwood_ClassRuleMin,
+ testRuleType.desc
+ )
+
+ visitFieldInsn(Opcodes.GETSTATIC,
+ ravenwoodTestRunnerType.internlName,
+ RavenwoodAwareTestRunner.IMPLICIT_CLASS_INNER_RULE_NAME,
+ testRuleType.desc
+ )
+ visitFieldInsn(Opcodes.PUTSTATIC,
+ classInternalName,
+ sRavenwood_ClassRuleMax,
+ testRuleType.desc
+ )
+
+ super.visitCode()
+ }
+ }
+
+ /*
+ public com.android.ravenwoodtest.bivalenttest.runnertest.RavenwoodRunnerTest();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ 0: aload_0
+ 1: invokespecial #1 // Method java/lang/Object."<init>":()V
+ 4: aload_0
+ 5: getstatic #7 // Field android/platform/test/ravenwood/RavenwoodAwareTestRunner.RavenwoodImplicitInstanceMinRule:Lorg/junit/rules/TestRule;
+ 8: putfield #13 // Field sRavenwoodImplicitInstanceMinRule:Lorg/junit/rules/TestRule;
+ 11: aload_0
+ 12: getstatic #18 // Field android/platform/test/ravenwood/RavenwoodAwareTestRunner.RavenwoodImplicitInstanceMaxRule:Lorg/junit/rules/TestRule;
+ 15: putfield #21 // Field sRavenwoodImplicitInstanceMaxRule:Lorg/junit/rules/TestRule;
+ 18: return
+ LineNumberTable:
+ line 31: 0
+ line 38: 4
+ line 41: 11
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 19 0 this Lcom/android/ravenwoodtest/bivalenttest/runnertest/RavenwoodRunnerTest;
+ */
+ private inner class ConstructorVisitor(
+ access: Int,
+ name: String,
+ descriptor: String,
+ signature: String?,
+ exceptions: Array<String>?,
+ next: MethodVisitor?,
+ ) : AdviceAdapter(OPCODE_VERSION, next, ACC_ENUM, name, descriptor) {
+ override fun onMethodEnter() {
+ visitVarInsn(ALOAD, 0)
+ visitFieldInsn(Opcodes.GETSTATIC,
+ ravenwoodTestRunnerType.internlName,
+ RavenwoodAwareTestRunner.IMPLICIT_INST_OUTER_RULE_NAME,
+ testRuleType.desc
+ )
+ visitFieldInsn(Opcodes.PUTFIELD,
+ classInternalName,
+ mRavenwood_InstRuleMin,
+ testRuleType.desc
+ )
+
+ visitVarInsn(ALOAD, 0)
+ visitFieldInsn(Opcodes.GETSTATIC,
+ ravenwoodTestRunnerType.internlName,
+ RavenwoodAwareTestRunner.IMPLICIT_INST_INNER_RULE_NAME,
+ testRuleType.desc
+ )
+ visitFieldInsn(Opcodes.PUTFIELD,
+ classInternalName,
+ mRavenwood_InstRuleMax,
+ testRuleType.desc
+ )
+ }
+ }
+
+ /**
+ * Rewrite "order" of the existing junit rules to make sure no rules use a MAX or MIN order.
+ *
+ * Currently, we do it a hacky way -- use an arbitrary cut-off point, and if the order
+ * is larger than that, decrement by 1, and if it's smaller than the negative cut-off point,
+ * increment it by 1.
+ *
+ * (or the arbitrary number is already used.... then we're unlucky, let's change the cut-off
+ * point.)
+ */
+ private inner class FieldRuleOrderRewriter(
+ val fieldName: String,
+ next: FieldVisitor,
+ ) : FieldVisitor(OPCODE_VERSION, next) {
+ override fun visitAnnotation(descriptor: String?, visible: Boolean): AnnotationVisitor {
+ val fallback = super.visitAnnotation(descriptor, visible)
+ if (descriptor != ruleAnotType.desc && descriptor != classRuleAnotType.desc) {
+ return fallback
+ }
+ return RuleOrderRewriter(fallback)
+ }
+
+ private inner class RuleOrderRewriter(
+ next: AnnotationVisitor,
+ ) : AnnotationVisitor(OPCODE_VERSION, next) {
+ override fun visit(name: String?, origValue: Any?) {
+ if (name != "order") {
+ return super.visit(name, origValue)
+ }
+ var order = origValue as Int
+ if (order == RULE_ORDER_TWEAK_CUTOFF || order == -RULE_ORDER_TWEAK_CUTOFF) {
+ // Oops. If this happens, we'll need to change RULE_ORDER_TWEAK_CUTOFF.
+ // Or, we could scan all the rules in the target jar and find an unused number.
+ // Because rules propagate to subclasses, we'll at least check all the
+ // super classes of the current class.
+ throw RavenizerInternalException(
+ "OOPS: Field $classInternalName.$fieldName uses $order."
+ + " We can't update it.")
+ }
+ if (order > RULE_ORDER_TWEAK_CUTOFF) {
+ order -= 1
+ }
+ if (order < -RULE_ORDER_TWEAK_CUTOFF) {
+ order += 1
+ }
+ super.visit(name, order)
+ }
+ }
+ }
+
+ companion object {
+ fun shouldProcess(classes: ClassNodes, className: String): Boolean {
+ if (!isTestLookingClass(classes, className)) {
+ return false
+ }
+ // Don't process a class if it has a @NoRavenizer annotation.
+ classes.findClass(className)?.let { cn ->
+ if (cn.findAnyAnnotation(noRavenizerAnotType.descAsSet) != null) {
+ log.i("Class ${className.toHumanReadableClassName()} has" +
+ " @${noRavenizerAnotType.humanReadableName}. Skipping."
+ )
+ return false
+ }
+ }
+ return true
+ }
+
+ fun maybeApply(
+ className: String,
+ classes: ClassNodes,
+ nextVisitor: ClassVisitor,
+ ): ClassVisitor {
+ if (!shouldProcess(classes, className)) {
+ return nextVisitor
+ } else {
+ return RunnerRewritingAdapter(classes, nextVisitor)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tools/hoststubgen/hoststubgen/Android.bp b/tools/hoststubgen/hoststubgen/Android.bp
index 682adbc..4920f7b4 100644
--- a/tools/hoststubgen/hoststubgen/Android.bp
+++ b/tools/hoststubgen/hoststubgen/Android.bp
@@ -5,6 +5,10 @@
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
+
+ // OWNER: g/ravenwood
+ // Bug component: 25698
+ default_team: "trendy_team_framework_backstage_power",
}
// Visibility only for ravenwood prototype uses.
@@ -118,7 +122,6 @@
java_test_host {
name: "hoststubgentest",
- // main_class: "com.android.hoststubgen.Main",
srcs: ["test/**/*.kt"],
static_libs: [
"hoststubgen",
@@ -143,8 +146,7 @@
// "--policy-override-file $(location framework-policy-override.txt) " +
"@$(location :hoststubgen-standard-options) " +
- "--out-stub-jar $(location host_stub.jar) " +
- "--out-impl-jar $(location host_impl.jar) " +
+ "--out-jar $(location host.jar) " +
// "--keep-all-classes " + // Used it for an experiment. See KeepAllClassesFilter.
"--gen-keep-all-file $(location hoststubgen_keep_all.txt) " +
@@ -159,10 +161,8 @@
srcs: [
":hoststubgen-standard-options",
],
- // Create two jar files.
out: [
- "host_stub.jar",
- "host_impl.jar",
+ "host.jar",
// Following files are created just as FYI.
"hoststubgen_keep_all.txt",
diff --git a/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestWholeClassStub.java b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestIgnore.java
similarity index 77%
rename from tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestWholeClassStub.java
rename to tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestIgnore.java
index 1824f6f..501fd65 100644
--- a/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestWholeClassStub.java
+++ b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestIgnore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023 The Android Open Source Project
+ * Copyright (C) 2024 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.
@@ -15,7 +15,8 @@
*/
package android.hosttest.annotation;
-import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -25,11 +26,9 @@
* THIS ANNOTATION IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
* QUESTIONS ABOUT IT.
*
- * Same as {@link HostSideTestStub} but it'll change the visibility of all its members too.
- *
* @hide
*/
-@Target({TYPE})
+@Target({METHOD, CONSTRUCTOR})
@Retention(RetentionPolicy.CLASS)
-public @interface HostSideTestWholeClassStub {
+public @interface HostSideTestIgnore {
}
diff --git a/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestRedirect.java
similarity index 76%
copy from ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java
copy to tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestRedirect.java
index 4b9cf85..bc9471b 100644
--- a/ravenwood/annotations-src/android/ravenwood/annotation/RavenwoodNativeSubstitutionClass.java
+++ b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestRedirect.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023 The Android Open Source Project
+ * Copyright (C) 2024 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.
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.ravenwood.annotation;
+package android.hosttest.annotation;
-import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -24,13 +24,9 @@
/**
* THIS ANNOTATION IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
* QUESTIONS ABOUT IT.
- *
- * TODO: Javadoc
- *
* @hide
*/
-@Target({TYPE})
+@Target({METHOD})
@Retention(RetentionPolicy.CLASS)
-public @interface RavenwoodNativeSubstitutionClass {
- String value();
+public @interface HostSideTestRedirect {
}
diff --git a/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestNativeSubstitutionClass.java b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestRedirectionClass.java
similarity index 95%
rename from tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestNativeSubstitutionClass.java
rename to tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestRedirectionClass.java
index 9c81383..28ad236 100644
--- a/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestNativeSubstitutionClass.java
+++ b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestRedirectionClass.java
@@ -30,6 +30,6 @@
*/
@Target({TYPE})
@Retention(RetentionPolicy.CLASS)
-public @interface HostSideTestNativeSubstitutionClass {
+public @interface HostSideTestRedirectionClass {
String value();
}
diff --git a/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestStub.java b/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestStub.java
deleted file mode 100644
index cabdfe0..0000000
--- a/tools/hoststubgen/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestStub.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.hosttest.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * THIS ANNOTATION IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
- * QUESTIONS ABOUT IT.
- *
- * Mark a class, field or a method as "Stub", meaning tests can see the APIs.
- * When applied to a class, it will _not_ affect the visibility of its members. They need to be
- * individually marked.
- *
- * <p>In order to expose a class and all its members, use {@link HostSideTestWholeClassStub}
- * instead.
- *
- * @hide
- */
-@Target({TYPE, FIELD, METHOD, CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface HostSideTestStub {
-}
diff --git a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenKeptInStub.java b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenKeptInStub.java
deleted file mode 100644
index 12b9875..0000000
--- a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenKeptInStub.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 com.android.hoststubgen.hosthelper;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation injected to all classes/methods/fields that are kept in the "stub" jar.
- *
- * All items in the stub jar are automatically kept in the impl jar as well, so
- * the items with this annotation will all have {@link HostStubGenKeptInImpl} too.
- */
-@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HostStubGenKeptInStub {
- String CLASS_INTERNAL_NAME = HostTestUtils.getInternalName(HostStubGenKeptInStub.class);
- String CLASS_DESCRIPTOR = "L" + CLASS_INTERNAL_NAME + ";";
-}
diff --git a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsIgnore.java b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsIgnore.java
index cb50404..b017103 100644
--- a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsIgnore.java
+++ b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsIgnore.java
@@ -23,8 +23,6 @@
/**
* Annotation injected to all methods processed as "ignore".
- *
- * (This annotation is only added in the impl jar, but not the stub jar)
*/
@Target({METHOD})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenKeptInImpl.java b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsKeep.java
similarity index 92%
rename from tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenKeptInImpl.java
rename to tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsKeep.java
index 2cc500f..18ef1ba 100644
--- a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenKeptInImpl.java
+++ b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsKeep.java
@@ -25,11 +25,11 @@
import java.lang.annotation.Target;
/**
- * Annotation injected to all classes/methods/fields that are kept in the "impl" jar.
+ * Annotation injected to all classes/methods/fields that are kept in the processes jar.
*/
@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface HostStubGenKeptInImpl {
- String CLASS_INTERNAL_NAME = HostTestUtils.getInternalName(HostStubGenKeptInImpl.class);
+public @interface HostStubGenProcessedAsKeep {
+ String CLASS_INTERNAL_NAME = HostTestUtils.getInternalName(HostStubGenProcessedAsKeep.class);
String CLASS_DESCRIPTOR = "L" + CLASS_INTERNAL_NAME + ";";
}
diff --git a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsSubstitute.java b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsSubstitute.java
index cfa4896..99e38c0 100644
--- a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsSubstitute.java
+++ b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsSubstitute.java
@@ -26,8 +26,6 @@
/**
* Annotation injected to all methods that are processed as "substitute".
- *
- * (This annotation is only added in the impl jar, but not the stub jar)
*/
@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsThrow.java b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsThrow.java
index 0d2da11..4933cf8 100644
--- a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsThrow.java
+++ b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostStubGenProcessedAsThrow.java
@@ -23,8 +23,6 @@
/**
* Annotation injected to all methods that are processed as "throw".
- *
- * (This annotation is only added in the impl jar, but not the stub jar)
*/
@Target({METHOD})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java
index 60eb47ee..78fd8f7 100644
--- a/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java
+++ b/tools/hoststubgen/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java
@@ -16,12 +16,8 @@
package com.android.hoststubgen.hosthelper;
import java.io.PrintStream;
-import java.lang.StackWalker.Option;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.HashMap;
-
-import javax.annotation.concurrent.GuardedBy;
/**
* Utilities used in the host side test environment.
@@ -101,68 +97,6 @@
+ methodName + methodDescriptor);
}
- private static final StackWalker sStackWalker =
- StackWalker.getInstance(Option.RETAIN_CLASS_REFERENCE);
-
- /**
- * Return a {@link StackWalker} that supports {@link StackWalker#getCallerClass()}.
- */
- public static StackWalker getStackWalker() {
- return sStackWalker;
- }
-
- /**
- * Cache used by {@link #isClassAllowedToCallNonStubMethods}.
- */
- @GuardedBy("sAllowedClasses")
- private static final HashMap<Class, Boolean> sAllowedClasses = new HashMap();
-
- /**
- * Return true if a given class is allowed to access non-stub methods -- that is, if the class
- * is in the hoststubgen generated JARs. (not in the test jar.)
- */
- private static boolean isClassAllowedToCallNonStubMethods(Class<?> clazz) {
- synchronized (sAllowedClasses) {
- var cached = sAllowedClasses.get(clazz);
- if (cached != null) {
- return cached;
- }
- }
- // All processed classes have this annotation.
- var allowed = clazz.getAnnotation(HostStubGenKeptInImpl.class) != null;
-
- // Java classes should be able to access any methods. (via callbacks, etc.)
- if (!allowed) {
- if (clazz.getPackageName().startsWith("java.")
- || clazz.getPackageName().startsWith("javax.")) {
- allowed = true;
- }
- }
- synchronized (sAllowedClasses) {
- sAllowedClasses.put(clazz, allowed);
- }
- return allowed;
- }
-
- /**
- * Called when non-stub methods are called. We do a host-unsupported method direct call check
- * in here.
- */
- public static void onNonStubMethodCalled(
- String methodClass,
- String methodName,
- String methodDescriptor,
- Class<?> callerClass) {
- if (SKIP_NON_STUB_METHOD_CHECK) {
- return;
- }
- if (isClassAllowedToCallNonStubMethods(callerClass)) {
- return; // Generated class is allowed to call framework class.
- }
- logPrintStream.println("! " + methodClass + "." + methodName + methodDescriptor
- + " called by " + callerClass.getCanonicalName());
- }
-
/**
* Called when any top level class (not nested classes) in the impl jar is loaded.
*
diff --git a/tools/hoststubgen/hoststubgen/hoststubgen-standard-options.txt b/tools/hoststubgen/hoststubgen/hoststubgen-standard-options.txt
index c371b5d..001943c 100644
--- a/tools/hoststubgen/hoststubgen/hoststubgen-standard-options.txt
+++ b/tools/hoststubgen/hoststubgen/hoststubgen-standard-options.txt
@@ -3,8 +3,6 @@
--debug
# Uncomment below lines to enable each feature.
---enable-non-stub-method-check
-# --no-non-stub-method-check
#--default-method-call-hook
# com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -13,15 +11,10 @@
# Standard annotations.
# Note, each line is a single argument, so we need newlines after each `--xxx-annotation`.
---stub-annotation
- android.hosttest.annotation.HostSideTestStub
--keep-annotation
android.hosttest.annotation.HostSideTestKeep
---stub-class-annotation
- android.hosttest.annotation.HostSideTestWholeClassStub
-
--keep-class-annotation
android.hosttest.annotation.HostSideTestWholeClassKeep
@@ -31,11 +24,17 @@
--remove-annotation
android.hosttest.annotation.HostSideTestRemove
+--ignore-annotation
+ android.hosttest.annotation.HostSideTestIgnore
+
--substitute-annotation
android.hosttest.annotation.HostSideTestSubstitute
---native-substitute-annotation
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass
+--redirect-annotation
+ android.hosttest.annotation.HostSideTestRedirect
+
+--redirection-class-annotation
+ android.hosttest.annotation.HostSideTestRedirectionClass
--class-load-hook-annotation
android.hosttest.annotation.HostSideTestClassLoadHook
diff --git a/tools/hoststubgen/hoststubgen/invoketest/hoststubgen-invoke-test.sh b/tools/hoststubgen/hoststubgen/invoketest/hoststubgen-invoke-test.sh
index d97dd7c..084448d 100755
--- a/tools/hoststubgen/hoststubgen/invoketest/hoststubgen-invoke-test.sh
+++ b/tools/hoststubgen/hoststubgen/invoketest/hoststubgen-invoke-test.sh
@@ -43,9 +43,8 @@
cleanup_temp
-JAR=hoststubgen-test-tiny-framework.jar
-STUB=$TEMP/stub.jar
-IMPL=$TEMP/impl.jar
+INJAR=hoststubgen-test-tiny-framework.jar
+OUTJAR=$TEMP/host.jar
ANNOTATION_FILTER=$TEMP/annotation-filter.txt
@@ -81,27 +80,18 @@
cat $ANNOTATION_FILTER
fi
- local stub_arg=""
- local impl_arg=""
+ local out_arg=""
- if [[ "$STUB" != "" ]] ; then
- stub_arg="--out-stub-jar $STUB"
- fi
- if [[ "$IMPL" != "" ]] ; then
- impl_arg="--out-impl-jar $IMPL"
+ if [[ "$OUTJAR" != "" ]] ; then
+ out_arg="--out-jar $OUTJAR"
fi
hoststubgen \
--debug \
- --in-jar $JAR \
- $stub_arg \
- $impl_arg \
- --stub-annotation \
- android.hosttest.annotation.HostSideTestStub \
+ --in-jar $INJAR \
+ $out_arg \
--keep-annotation \
android.hosttest.annotation.HostSideTestKeep \
- --stub-class-annotation \
- android.hosttest.annotation.HostSideTestWholeClassStub \
--keep-class-annotation \
android.hosttest.annotation.HostSideTestWholeClassKeep \
--throw-annotation \
@@ -110,8 +100,10 @@
android.hosttest.annotation.HostSideTestRemove \
--substitute-annotation \
android.hosttest.annotation.HostSideTestSubstitute \
- --native-substitute-annotation \
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass \
+ --redirect-annotation \
+ android.hosttest.annotation.HostSideTestRedirect \
+ --redirection-class-annotation \
+ android.hosttest.annotation.HostSideTestRedirectionClass \
--class-load-hook-annotation \
android.hosttest.annotation.HostSideTestClassLoadHook \
--keep-static-initializer-annotation \
@@ -213,9 +205,9 @@
"
run_hoststubgen_for_failure "One specific class disallowed" \
- "TinyFrameworkClassAnnotations is not allowed to have Ravenwood annotations" \
+ "TinyFrameworkAnnotations is not allowed to have Ravenwood annotations" \
"
-!com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
+!com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations
* # All other classes allowed
"
@@ -225,11 +217,7 @@
* # All other classes allowed
"
-STUB="" run_hoststubgen_for_success "No stub generation" ""
-
-IMPL="" run_hoststubgen_for_success "No impl generation" ""
-
-STUB="" IMPL="" run_hoststubgen_for_success "No stub, no impl generation" ""
+OUTJAR="" run_hoststubgen_for_success "No output generation" ""
EXTRA_ARGS="--in-jar abc" run_hoststubgen_for_failure "Duplicate arg" \
"Duplicate or conflicting argument found: --in-jar" \
@@ -237,4 +225,4 @@
echo "All tests passed"
-exit 0
\ No newline at end of file
+exit 0
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Exceptions.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Exceptions.kt
index 910bf59..f59e143 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Exceptions.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Exceptions.kt
@@ -15,6 +15,8 @@
*/
package com.android.hoststubgen
+import java.io.File
+
/**
* We will not print the stack trace for exceptions implementing it.
*/
@@ -49,4 +51,22 @@
/**
* We use this for general "user" errors.
*/
-class HostStubGenUserErrorException(message: String) : Exception(message), UserErrorException
+class GeneralUserErrorException(message: String) : Exception(message), UserErrorException
+
+/** Base exception class for invalid command line arguments. */
+open class ArgumentsException(message: String?) : Exception(message), UserErrorException
+
+/** Thrown when the same annotation is used with different annotation arguments. */
+class DuplicateAnnotationException(annotationName: String?) :
+ ArgumentsException("Duplicate annotation specified: '$annotationName'")
+
+/** Thrown when an input file does not exist. */
+class InputFileNotFoundException(filename: String) :
+ ArgumentsException("File '$filename' not found")
+
+fun String.ensureFileExists(): String {
+ if (!File(this).exists()) {
+ throw InputFileNotFoundException(this)
+ }
+ return this
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
index 5dde265..165bb57 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
@@ -22,21 +22,18 @@
import com.android.hoststubgen.filters.ConstantFilter
import com.android.hoststubgen.filters.DefaultHookInjectingFilter
import com.android.hoststubgen.filters.FilterPolicy
+import com.android.hoststubgen.filters.FilterRemapper
import com.android.hoststubgen.filters.ImplicitOutputFilter
+import com.android.hoststubgen.filters.KeepNativeFilter
import com.android.hoststubgen.filters.OutputFilter
-import com.android.hoststubgen.filters.StubIntersectingFilter
+import com.android.hoststubgen.filters.SanitizationFilter
import com.android.hoststubgen.filters.createFilterFromTextPolicyFile
import com.android.hoststubgen.filters.printAsTextPolicy
import com.android.hoststubgen.utils.ClassFilter
import com.android.hoststubgen.visitors.BaseAdapter
import com.android.hoststubgen.visitors.PackageRedirectRemapper
-import org.objectweb.asm.ClassReader
-import org.objectweb.asm.ClassVisitor
-import org.objectweb.asm.ClassWriter
-import org.objectweb.asm.commons.ClassRemapper
-import org.objectweb.asm.commons.Remapper
-import org.objectweb.asm.util.CheckClassAdapter
import java.io.BufferedInputStream
+import java.io.BufferedOutputStream
import java.io.FileOutputStream
import java.io.InputStream
import java.io.OutputStream
@@ -44,6 +41,12 @@
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
import java.util.zip.ZipOutputStream
+import org.objectweb.asm.ClassReader
+import org.objectweb.asm.ClassVisitor
+import org.objectweb.asm.ClassWriter
+import org.objectweb.asm.commons.ClassRemapper
+import org.objectweb.asm.commons.Remapper
+import org.objectweb.asm.util.CheckClassAdapter
/**
* Actual main class.
@@ -58,49 +61,54 @@
// Dump the classes, if specified.
options.inputJarDumpFile.ifSet {
- PrintWriter(it).use { pw -> allClasses.dump(pw) }
- log.i("Dump file created at $it")
+ log.iTime("Dump file created at $it") {
+ PrintWriter(it).use { pw -> allClasses.dump(pw) }
+ }
}
options.inputJarAsKeepAllFile.ifSet {
- PrintWriter(it).use {
- pw -> allClasses.forEach {
- classNode -> printAsTextPolicy(pw, classNode)
+ log.iTime("Dump file created at $it") {
+ PrintWriter(it).use { pw ->
+ allClasses.forEach { classNode ->
+ printAsTextPolicy(pw, classNode)
+ }
}
}
- log.i("Dump file created at $it")
}
// Build the filters.
- val (filter, policyFileRemapper) = buildFilter(errors, allClasses, options)
+ val filter = buildFilter(errors, allClasses, options)
+
+ val filterRemapper = FilterRemapper(filter)
// Transform the jar.
convert(
- options.inJar.get,
- options.outStubJar.get,
- options.outImplJar.get,
- filter,
- options.enableClassChecker.get,
- allClasses,
- errors,
- stats,
- policyFileRemapper,
- options.numShards.get,
- options.shard.get,
+ options.inJar.get,
+ options.outJar.get,
+ filter,
+ options.enableClassChecker.get,
+ allClasses,
+ errors,
+ stats,
+ filterRemapper,
+ options.numShards.get,
+ options.shard.get,
)
// Dump statistics, if specified.
options.statsFile.ifSet {
- PrintWriter(it).use { pw -> stats.dumpOverview(pw) }
- log.i("Dump file created at $it")
+ log.iTime("Dump file created at $it") {
+ PrintWriter(it).use { pw -> stats.dumpOverview(pw) }
+ }
}
options.apiListFile.ifSet {
- PrintWriter(it).use { pw ->
- // TODO, when dumping a jar that's not framework-minus-apex.jar, we need to feed
- // framework-minus-apex.jar so that we can dump inherited methods from it.
- ApiDumper(pw, allClasses, null, filter).dump()
+ log.iTime("API list file created at $it") {
+ PrintWriter(it).use { pw ->
+ // TODO, when dumping a jar that's not framework-minus-apex.jar, we need to feed
+ // framework-minus-apex.jar so that we can dump inherited methods from it.
+ ApiDumper(pw, allClasses, null, filter).dump()
+ }
}
- log.i("API list file created at $it")
}
}
@@ -109,10 +117,10 @@
* jars, and "how". (e.g. with substitution?)
*/
private fun buildFilter(
- errors: HostStubGenErrors,
- allClasses: ClassNodes,
- options: HostStubGenOptions,
- ): Pair<OutputFilter, Remapper?> {
+ errors: HostStubGenErrors,
+ allClasses: ClassNodes,
+ options: HostStubGenOptions,
+ ): OutputFilter {
// We build a "chain" of multiple filters here.
//
// The filters are build in from "inside", meaning the first filter created here is
@@ -126,6 +134,9 @@
// The first filter is for the default policy from the command line options.
var filter: OutputFilter = ConstantFilter(options.defaultPolicy.get, "default-by-options")
+ // Next, we build a filter that preserves all native methods by default
+ filter = KeepNativeFilter(allClasses, filter)
+
// Next, we need a filter that resolves "class-wide" policies.
// This is used when a member (methods, fields, nested classes) don't get any polices
// from upper filters. e.g. when a method has no annotations, then this filter will apply
@@ -151,142 +162,116 @@
filter = AnnotationBasedFilter(
errors,
allClasses,
- options.stubAnnotations,
options.keepAnnotations,
- options.stubClassAnnotations,
options.keepClassAnnotations,
options.throwAnnotations,
options.removeAnnotations,
+ options.ignoreAnnotations,
options.substituteAnnotations,
- options.nativeSubstituteAnnotations,
+ options.redirectAnnotations,
+ options.redirectionClassAnnotations,
options.classLoadHookAnnotations,
options.keepStaticInitializerAnnotations,
annotationAllowedClassesFilter,
- filter,
+ filter
)
- var policyFileRemapper: Remapper? = null
-
// Next, "text based" filter, which allows to override polices without touching
// the target code.
options.policyOverrideFile.ifSet {
- val (f, p) = createFilterFromTextPolicyFile(it, allClasses, filter)
- filter = f
- policyFileRemapper = p
- }
-
- // If `--intersect-stub-jar` is provided, load from these jar files too.
- // We use this to restrict stub APIs to public/system/test APIs,
- // by intersecting with a stub jar file created by metalava.
- if (options.intersectStubJars.size > 0) {
- val intersectingJars = loadIntersectingJars(options.intersectStubJars)
-
- filter = StubIntersectingFilter(errors, intersectingJars, filter)
+ filter = createFilterFromTextPolicyFile(it, allClasses, filter)
}
// Apply the implicit filter.
filter = ImplicitOutputFilter(errors, allClasses, filter)
- return Pair(filter, policyFileRemapper)
- }
+ // Add a final sanitization step.
+ filter = SanitizationFilter(errors, allClasses, filter)
- /**
- * Load jar files specified with "--intersect-stub-jar".
- */
- private fun loadIntersectingJars(filenames: Set<String>): Map<String, ClassNodes> {
- val intersectingJars = mutableMapOf<String, ClassNodes>()
-
- filenames.forEach { filename ->
- intersectingJars[filename] = ClassNodes.loadClassStructures(filename)
- }
- return intersectingJars
+ return filter
}
/**
* Convert a JAR file into "stub" and "impl" JAR files.
*/
private fun convert(
- inJar: String,
- outStubJar: String?,
- outImplJar: String?,
- filter: OutputFilter,
- enableChecker: Boolean,
- classes: ClassNodes,
- errors: HostStubGenErrors,
- stats: HostStubGenStats,
- remapper: Remapper?,
- numShards: Int,
- shard: Int,
- ) {
- log.i("Converting %s into [stub: %s, impl: %s] ...", inJar, outStubJar, outImplJar)
+ inJar: String,
+ outJar: String?,
+ filter: OutputFilter,
+ enableChecker: Boolean,
+ classes: ClassNodes,
+ errors: HostStubGenErrors,
+ stats: HostStubGenStats,
+ remapper: Remapper?,
+ numShards: Int,
+ shard: Int
+ ) {
+ log.i("Converting %s into %s ...", inJar, outJar)
log.i("ASM CheckClassAdapter is %s", if (enableChecker) "enabled" else "disabled")
- val start = System.currentTimeMillis()
+ log.iTime("Transforming jar") {
+ val packageRedirector = PackageRedirectRemapper(options.packageRedirects)
- val packageRedirector = PackageRedirectRemapper(options.packageRedirects)
+ var itemIndex = 0
+ var numItemsProcessed = 0
+ var numItems = -1 // == Unknown
- var itemIndex = 0
- var numItemsProcessed = 0
- var numItems = -1 // == Unknown
+ log.withIndent {
+ // Open the input jar file and process each entry.
+ ZipFile(inJar).use { inZip ->
- log.withIndent {
- // Open the input jar file and process each entry.
- ZipFile(inJar).use { inZip ->
+ numItems = inZip.size()
+ val shardStart = numItems * shard / numShards
+ val shardNextStart = numItems * (shard + 1) / numShards
- numItems = inZip.size()
- val shardStart = numItems * shard / numShards
- val shardNextStart = numItems * (shard + 1) / numShards
-
- maybeWithZipOutputStream(outStubJar) { stubOutStream ->
- maybeWithZipOutputStream(outImplJar) { implOutStream ->
+ maybeWithZipOutputStream(outJar) { outStream ->
val inEntries = inZip.entries()
while (inEntries.hasMoreElements()) {
val entry = inEntries.nextElement()
- val inShard = (shardStart <= itemIndex) && (itemIndex < shardNextStart)
+ val inShard = (shardStart <= itemIndex)
+ && (itemIndex < shardNextStart)
itemIndex++
if (!inShard) {
continue
}
- convertSingleEntry(inZip, entry, stubOutStream, implOutStream,
- filter, packageRedirector, remapper,
- enableChecker, classes, errors, stats)
+ convertSingleEntry(
+ inZip, entry, outStream, filter,
+ packageRedirector, remapper, enableChecker,
+ classes, errors, stats
+ )
numItemsProcessed++
}
log.i("Converted all entries.")
}
+ outJar?.let { log.i("Created: $it") }
}
- outStubJar?.let { log.i("Created stub: $it") }
- outImplJar?.let { log.i("Created impl: $it") }
}
+ log.i("%d / %d item(s) processed.", numItemsProcessed, numItems)
}
- val end = System.currentTimeMillis()
- log.i("Done transforming the jar in %.1f second(s). %d / %d item(s) processed.",
- (end - start) / 1000.0, numItemsProcessed, numItems)
}
private fun <T> maybeWithZipOutputStream(filename: String?, block: (ZipOutputStream?) -> T): T {
if (filename == null) {
return block(null)
}
- return ZipOutputStream(FileOutputStream(filename)).use(block)
+ return ZipOutputStream(BufferedOutputStream(FileOutputStream(filename))).use(block)
}
/**
* Convert a single ZIP entry, which may or may not be a class file.
*/
private fun convertSingleEntry(
- inZip: ZipFile,
- entry: ZipEntry,
- stubOutStream: ZipOutputStream?,
- implOutStream: ZipOutputStream?,
- filter: OutputFilter,
- packageRedirector: PackageRedirectRemapper,
- remapper: Remapper?,
- enableChecker: Boolean,
- classes: ClassNodes,
- errors: HostStubGenErrors,
- stats: HostStubGenStats,
- ) {
+ inZip: ZipFile,
+ entry: ZipEntry,
+ outStream: ZipOutputStream?,
+ filter: OutputFilter,
+ packageRedirector: PackageRedirectRemapper,
+ remapper: Remapper?,
+ enableChecker: Boolean,
+ classes: ClassNodes,
+ errors: HostStubGenErrors,
+ stats: HostStubGenStats
+ ) {
log.d("Entry: %s", entry.name)
log.withIndent {
val name = entry.name
@@ -298,8 +283,10 @@
// If it's a class, convert it.
if (name.endsWith(".class")) {
- processSingleClass(inZip, entry, stubOutStream, implOutStream, filter,
- packageRedirector, remapper, enableChecker, classes, errors, stats)
+ processSingleClass(
+ inZip, entry, outStream, filter, packageRedirector,
+ remapper, enableChecker, classes, errors, stats
+ )
return
}
@@ -307,17 +294,14 @@
// - *.uau seems to contain hidden API information.
// - *_compat_config.xml is also about compat-framework.
- if (name.endsWith(".uau") ||
- name.endsWith("_compat_config.xml")) {
+ if (name.endsWith(".uau") || name.endsWith("_compat_config.xml")) {
log.d("Not needed: %s", entry.name)
return
}
// Unknown type, we just copy it to both output zip files.
- // TODO: We probably shouldn't do it for stub jar?
log.v("Copying: %s", entry.name)
- stubOutStream?.let { copyZipEntry(inZip, entry, it) }
- implOutStream?.let { copyZipEntry(inZip, entry, it) }
+ outStream?.let { copyZipEntry(inZip, entry, it) }
}
}
@@ -325,17 +309,18 @@
* Copy a single ZIP entry to the output.
*/
private fun copyZipEntry(
- inZip: ZipFile,
- entry: ZipEntry,
- out: ZipOutputStream,
- ) {
- BufferedInputStream(inZip.getInputStream(entry)).use { bis ->
+ inZip: ZipFile,
+ entry: ZipEntry,
+ out: ZipOutputStream,
+ ) {
+ // TODO: It seems like copying entries this way is _very_ slow,
+ // even with out.setLevel(0). Look for other ways to do it.
+
+ inZip.getInputStream(entry).use { ins ->
// Copy unknown entries as is to the impl out. (but not to the stub out.)
val outEntry = ZipEntry(entry.name)
out.putNextEntry(outEntry)
- while (bis.available() > 0) {
- out.write(bis.read())
- }
+ ins.transferTo(out)
out.closeEntry()
}
}
@@ -344,18 +329,17 @@
* Convert a single class to "stub" and "impl".
*/
private fun processSingleClass(
- inZip: ZipFile,
- entry: ZipEntry,
- stubOutStream: ZipOutputStream?,
- implOutStream: ZipOutputStream?,
- filter: OutputFilter,
- packageRedirector: PackageRedirectRemapper,
- remapper: Remapper?,
- enableChecker: Boolean,
- classes: ClassNodes,
- errors: HostStubGenErrors,
- stats: HostStubGenStats,
- ) {
+ inZip: ZipFile,
+ entry: ZipEntry,
+ outStream: ZipOutputStream?,
+ filter: OutputFilter,
+ packageRedirector: PackageRedirectRemapper,
+ remapper: Remapper?,
+ enableChecker: Boolean,
+ classes: ClassNodes,
+ errors: HostStubGenErrors,
+ stats: HostStubGenStats
+ ) {
val classInternalName = entry.name.replaceFirst("\\.class$".toRegex(), "")
val classPolicy = filter.getPolicyForClass(classInternalName)
if (classPolicy.policy == FilterPolicy.Remove) {
@@ -367,33 +351,22 @@
remapper?.mapType(classInternalName)?.let { remappedName ->
if (remappedName != classInternalName) {
log.d("Renaming class file: %s -> %s", classInternalName, remappedName)
- newName = remappedName + ".class"
+ newName = "$remappedName.class"
}
}
- // Generate stub first.
- if (stubOutStream != null && classPolicy.policy.needsInStub) {
- log.v("Creating stub class: %s Policy: %s", classInternalName, classPolicy)
+
+ if (outStream != null) {
+ log.v("Creating class: %s Policy: %s", classInternalName, classPolicy)
log.withIndent {
BufferedInputStream(inZip.getInputStream(entry)).use { bis ->
val newEntry = ZipEntry(newName)
- stubOutStream.putNextEntry(newEntry)
- convertClass(classInternalName, /*forImpl=*/false, bis,
- stubOutStream, filter, packageRedirector, remapper,
- enableChecker, classes, errors, null)
- stubOutStream.closeEntry()
- }
- }
- }
- if (implOutStream != null && classPolicy.policy.needsInImpl) {
- log.v("Creating impl class: %s Policy: %s", classInternalName, classPolicy)
- log.withIndent {
- BufferedInputStream(inZip.getInputStream(entry)).use { bis ->
- val newEntry = ZipEntry(newName)
- implOutStream.putNextEntry(newEntry)
- convertClass(classInternalName, /*forImpl=*/true, bis,
- implOutStream, filter, packageRedirector, remapper,
- enableChecker, classes, errors, stats)
- implOutStream.closeEntry()
+ outStream.putNextEntry(newEntry)
+ convertClass(
+ classInternalName, bis,
+ outStream, filter, packageRedirector, remapper,
+ enableChecker, classes, errors, stats
+ )
+ outStream.closeEntry()
}
}
}
@@ -403,18 +376,17 @@
* Convert a single class to either "stub" or "impl".
*/
private fun convertClass(
- classInternalName: String,
- forImpl: Boolean,
- input: InputStream,
- out: OutputStream,
- filter: OutputFilter,
- packageRedirector: PackageRedirectRemapper,
- remapper: Remapper?,
- enableChecker: Boolean,
- classes: ClassNodes,
- errors: HostStubGenErrors,
- stats: HostStubGenStats?,
- ) {
+ classInternalName: String,
+ input: InputStream,
+ out: OutputStream,
+ filter: OutputFilter,
+ packageRedirector: PackageRedirectRemapper,
+ remapper: Remapper?,
+ enableChecker: Boolean,
+ classes: ClassNodes,
+ errors: HostStubGenErrors,
+ stats: HostStubGenStats?
+ ) {
val cr = ClassReader(input)
// COMPUTE_FRAMES wouldn't be happy if code uses
@@ -433,14 +405,15 @@
}
val visitorOptions = BaseAdapter.Options(
- enablePreTrace = options.enablePreTrace.get,
- enablePostTrace = options.enablePostTrace.get,
- enableNonStubMethodCallDetection = options.enableNonStubMethodCallDetection.get,
- errors = errors,
- stats = stats,
+ errors = errors,
+ stats = stats,
+ enablePreTrace = options.enablePreTrace.get,
+ enablePostTrace = options.enablePostTrace.get,
)
- outVisitor = BaseAdapter.getVisitor(classInternalName, classes, outVisitor, filter,
- packageRedirector, remapper, forImpl, visitorOptions)
+ outVisitor = BaseAdapter.getVisitor(
+ classInternalName, classes, outVisitor, filter,
+ packageRedirector, visitorOptions
+ )
cr.accept(outVisitor, ClassReader.EXPAND_FRAMES)
val data = cw.toByteArray()
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenErrors.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenErrors.kt
index 6b01d48..a218c55 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenErrors.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenErrors.kt
@@ -19,6 +19,6 @@
open fun onErrorFound(message: String) {
// TODO: For now, we just throw as soon as any error is found, but eventually we should keep
// all errors and print them at the end.
- throw HostStubGenUserErrorException(message)
+ throw GeneralUserErrorException(message)
}
}
\ No newline at end of file
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenLogger.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenLogger.kt
index 18065ba..4bcee40 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenLogger.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenLogger.kt
@@ -89,6 +89,8 @@
addPrinter(StreamPrinter(level, PrintWriter(BufferedOutputStream(
FileOutputStream(logFilename)))))
+ log.i("Log file set: $logFilename for $level")
+
return this
}
@@ -121,7 +123,10 @@
return level.ordinal <= maxLogLevel.ordinal
}
- private fun println(level: LogLevel, message: String) {
+ fun println(level: LogLevel, message: String) {
+ if (message.isEmpty()) {
+ return // Don't print an empty message.
+ }
printers.forEach {
if (it.logLevel.ordinal >= level.ordinal) {
it.println(level, indent, message)
@@ -129,7 +134,7 @@
}
}
- private fun println(level: LogLevel, format: String, vararg args: Any?) {
+ fun println(level: LogLevel, format: String, vararg args: Any?) {
if (isEnabled(level)) {
println(level, String.format(format, *args))
}
@@ -185,6 +190,45 @@
println(LogLevel.Debug, format, *args)
}
+ inline fun <T> logTime(level: LogLevel, message: String, block: () -> T): Double {
+ var ret: Double = -1.0
+ val start = System.currentTimeMillis()
+ try {
+ block()
+ } finally {
+ val end = System.currentTimeMillis()
+ ret = (end - start) / 1000.0
+ if (isEnabled(level)) {
+ println(level,
+ String.format("%s: took %.1f second(s).", message, (end - start) / 1000.0))
+ }
+ }
+ return ret
+ }
+
+ /** Do an "i" log with how long it took. */
+ inline fun <T> iTime(message: String, block: () -> T): Double {
+ return logTime(LogLevel.Info, message, block)
+ }
+
+ /** Do a "v" log with how long it took. */
+ inline fun <T> vTime(message: String, block: () -> T): Double {
+ return logTime(LogLevel.Verbose, message, block)
+ }
+
+ /** Do a "d" log with how long it took. */
+ inline fun <T> dTime(message: String, block: () -> T): Double {
+ return logTime(LogLevel.Debug, message, block)
+ }
+
+ /**
+ * Similar to the other "xTime" methods, but the message is not supposed to be printed.
+ * It's only used to measure the duration with the same interface as other log methods.
+ */
+ inline fun <T> nTime(block: () -> T): Double {
+ return logTime(LogLevel.Debug, "", block)
+ }
+
inline fun forVerbose(block: () -> Unit) {
if (isEnabled(LogLevel.Verbose)) {
block()
@@ -228,6 +272,21 @@
}
}
}
+
+ /**
+ * Handle log-related command line arguments.
+ */
+ fun maybeHandleCommandLineArg(currentArg: String, nextArgProvider: () -> String): Boolean {
+ when (currentArg) {
+ "-v", "--verbose" -> setConsoleLogLevel(LogLevel.Verbose)
+ "-d", "--debug" -> setConsoleLogLevel(LogLevel.Debug)
+ "-q", "--quiet" -> setConsoleLogLevel(LogLevel.None)
+ "--verbose-log" -> addFilePrinter(LogLevel.Verbose, nextArgProvider())
+ "--debug-log" -> addFilePrinter(LogLevel.Debug, nextArgProvider())
+ else -> return false
+ }
+ return true
+ }
}
private interface LogPrinter {
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenMain.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenMain.kt
index 45e7e30..8506466 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenMain.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenMain.kt
@@ -24,20 +24,32 @@
*/
fun main(args: Array<String>) {
executableName = "HostStubGen"
+ runMainWithBoilerplate {
+ // Parse the command line arguments.
+ var clanupOnError = false
+ try {
+ val options = HostStubGenOptions.parseArgs(args)
+ clanupOnError = options.cleanUpOnError.get
+ log.v("$executableName started")
+ log.v("Options: $options")
+
+ // Run.
+ HostStubGen(options).run()
+ } catch (e: Throwable) {
+ if (clanupOnError) {
+ TODO("Remove output jars here")
+ }
+ throw e
+ }
+ }
+}
+
+inline fun runMainWithBoilerplate(realMain: () -> Unit) {
var success = false
- var clanupOnError = false
try {
- // Parse the command line arguments.
- val options = HostStubGenOptions.parseArgs(args)
- clanupOnError = options.cleanUpOnError.get
-
- log.v("$executableName started")
- log.v("Options: $options")
-
- // Run.
- HostStubGen(options).run()
+ realMain()
success = true
} catch (e: Throwable) {
@@ -45,9 +57,6 @@
if (e !is UserErrorException) {
e.printStackTrace(PrintWriter(log.getWriter(LogLevel.Error)))
}
- if (clanupOnError) {
- TODO("Remove output jars here")
- }
} finally {
log.i("$executableName finished")
log.flush()
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
index 2f833a8..b083d89 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
@@ -17,20 +17,17 @@
import com.android.hoststubgen.filters.FilterPolicy
import java.io.BufferedReader
-import java.io.File
import java.io.FileReader
/**
* A single value that can only set once.
*/
-class SetOnce<T>(
- private var value: T,
-) {
+open class SetOnce<T>(private var value: T) {
class SetMoreThanOnceException : Exception()
private var set = false
- fun set(v: T) {
+ fun set(v: T): T {
if (set) {
throw SetMoreThanOnceException()
}
@@ -39,6 +36,7 @@
}
set = true
value = v
+ return v
}
val get: T
@@ -59,6 +57,16 @@
}
}
+class IntSetOnce(value: Int) : SetOnce<Int>(value) {
+ fun set(v: String): Int {
+ try {
+ return this.set(v.toInt())
+ } catch (e: NumberFormatException) {
+ throw ArgumentsException("Invalid integer $v")
+ }
+ }
+}
+
/**
* Options that can be set from command line arguments.
*/
@@ -66,25 +74,22 @@
/** Input jar file*/
var inJar: SetOnce<String> = SetOnce(""),
- /** Output stub jar file */
- var outStubJar: SetOnce<String?> = SetOnce(null),
-
- /** Output implementation jar file */
- var outImplJar: SetOnce<String?> = SetOnce(null),
+ /** Output jar file */
+ var outJar: SetOnce<String?> = SetOnce(null),
var inputJarDumpFile: SetOnce<String?> = SetOnce(null),
var inputJarAsKeepAllFile: SetOnce<String?> = SetOnce(null),
- var stubAnnotations: MutableSet<String> = mutableSetOf(),
var keepAnnotations: MutableSet<String> = mutableSetOf(),
var throwAnnotations: MutableSet<String> = mutableSetOf(),
var removeAnnotations: MutableSet<String> = mutableSetOf(),
- var stubClassAnnotations: MutableSet<String> = mutableSetOf(),
+ var ignoreAnnotations: MutableSet<String> = mutableSetOf(),
var keepClassAnnotations: MutableSet<String> = mutableSetOf(),
+ var redirectAnnotations: MutableSet<String> = mutableSetOf(),
var substituteAnnotations: MutableSet<String> = mutableSetOf(),
- var nativeSubstituteAnnotations: MutableSet<String> = mutableSetOf(),
+ var redirectionClassAnnotations: MutableSet<String> = mutableSetOf(),
var classLoadHookAnnotations: MutableSet<String> = mutableSetOf(),
var keepStaticInitializerAnnotations: MutableSet<String> = mutableSetOf(),
@@ -95,8 +100,6 @@
var defaultClassLoadHook: SetOnce<String?> = SetOnce(null),
var defaultMethodCallHook: SetOnce<String?> = SetOnce(null),
- var intersectStubJars: MutableSet<String> = mutableSetOf(),
-
var policyOverrideFile: SetOnce<String?> = SetOnce(null),
var defaultPolicy: SetOnce<FilterPolicy> = SetOnce(FilterPolicy.Remove),
@@ -107,24 +110,15 @@
var enablePreTrace: SetOnce<Boolean> = SetOnce(false),
var enablePostTrace: SetOnce<Boolean> = SetOnce(false),
- var enableNonStubMethodCallDetection: SetOnce<Boolean> = SetOnce(false),
-
var statsFile: SetOnce<String?> = SetOnce(null),
var apiListFile: SetOnce<String?> = SetOnce(null),
- var numShards: SetOnce<Int> = SetOnce(1),
- var shard: SetOnce<Int> = SetOnce(0),
+ var numShards: IntSetOnce = IntSetOnce(1),
+ var shard: IntSetOnce = IntSetOnce(0),
) {
companion object {
- private fun String.ensureFileExists(): String {
- if (!File(this).exists()) {
- throw InputFileNotFoundException(this)
- }
- return this
- }
-
private fun parsePackageRedirect(fromColonTo: String): Pair<String, String> {
val colon = fromColonTo.indexOf(':')
if ((colon < 1) || (colon + 1 >= fromColonTo.length)) {
@@ -137,7 +131,7 @@
fun parseArgs(args: Array<String>): HostStubGenOptions {
val ret = HostStubGenOptions()
- val ai = ArgIterator(expandAtFiles(args))
+ val ai = ArgIterator.withAtFiles(args)
var allAnnotations = mutableSetOf<String>()
@@ -148,46 +142,29 @@
return name
}
- fun setLogFile(level: LogLevel, filename: String) {
- log.addFilePrinter(level, filename)
- log.i("$level log file: $filename")
- }
-
while (true) {
- val arg = ai.nextArgOptional()
- if (arg == null) {
- break
- }
+ val arg = ai.nextArgOptional() ?: break
// Define some shorthands...
fun nextArg(): String = ai.nextArgRequired(arg)
- fun SetOnce<String>.setNextStringArg(): String = nextArg().also { this.set(it) }
- fun SetOnce<String?>.setNextStringArg(): String = nextArg().also { this.set(it) }
fun MutableSet<String>.addUniqueAnnotationArg(): String =
nextArg().also { this += ensureUniqueAnnotation(it) }
- fun SetOnce<Int>.setNextIntArg(): String = nextArg().also {
- try {
- this.set(it.toInt())
- } catch (e: NumberFormatException) {
- throw ArgumentsException("Invalid integer for $arg: $it")
- }
- }
+ if (log.maybeHandleCommandLineArg(arg) { nextArg() }) {
+ continue
+ }
try {
when (arg) {
// TODO: Write help
"-h", "--help" -> TODO("Help is not implemented yet")
- "-v", "--verbose" -> log.setConsoleLogLevel(LogLevel.Verbose)
- "-d", "--debug" -> log.setConsoleLogLevel(LogLevel.Debug)
- "-q", "--quiet" -> log.setConsoleLogLevel(LogLevel.None)
-
- "--in-jar" -> ret.inJar.setNextStringArg().ensureFileExists()
- "--out-stub-jar" -> ret.outStubJar.setNextStringArg()
- "--out-impl-jar" -> ret.outImplJar.setNextStringArg()
+ "--in-jar" -> ret.inJar.set(nextArg()).ensureFileExists()
+ // We support both arguments because some AOSP dependencies
+ // still use the old argument
+ "--out-jar", "--out-impl-jar" -> ret.outJar.set(nextArg())
"--policy-override-file" ->
- ret.policyOverrideFile.setNextStringArg().ensureFileExists()
+ ret.policyOverrideFile.set(nextArg())!!.ensureFileExists()
"--clean-up-on-error" -> ret.cleanUpOnError.set(true)
"--no-clean-up-on-error" -> ret.cleanUpOnError.set(false)
@@ -195,17 +172,10 @@
"--default-remove" -> ret.defaultPolicy.set(FilterPolicy.Remove)
"--default-throw" -> ret.defaultPolicy.set(FilterPolicy.Throw)
"--default-keep" -> ret.defaultPolicy.set(FilterPolicy.Keep)
- "--default-stub" -> ret.defaultPolicy.set(FilterPolicy.Stub)
-
- "--stub-annotation" ->
- ret.stubAnnotations.addUniqueAnnotationArg()
"--keep-annotation" ->
ret.keepAnnotations.addUniqueAnnotationArg()
- "--stub-class-annotation" ->
- ret.stubClassAnnotations.addUniqueAnnotationArg()
-
"--keep-class-annotation" ->
ret.keepClassAnnotations.addUniqueAnnotationArg()
@@ -215,11 +185,17 @@
"--remove-annotation" ->
ret.removeAnnotations.addUniqueAnnotationArg()
+ "--ignore-annotation" ->
+ ret.ignoreAnnotations.addUniqueAnnotationArg()
+
"--substitute-annotation" ->
ret.substituteAnnotations.addUniqueAnnotationArg()
- "--native-substitute-annotation" ->
- ret.nativeSubstituteAnnotations.addUniqueAnnotationArg()
+ "--redirect-annotation" ->
+ ret.redirectAnnotations.addUniqueAnnotationArg()
+
+ "--redirection-class-annotation" ->
+ ret.redirectionClassAnnotations.addUniqueAnnotationArg()
"--class-load-hook-annotation" ->
ret.classLoadHookAnnotations.addUniqueAnnotationArg()
@@ -231,19 +207,16 @@
ret.packageRedirects += parsePackageRedirect(nextArg())
"--annotation-allowed-classes-file" ->
- ret.annotationAllowedClassesFile.setNextStringArg()
+ ret.annotationAllowedClassesFile.set(nextArg())
"--default-class-load-hook" ->
- ret.defaultClassLoadHook.setNextStringArg()
+ ret.defaultClassLoadHook.set(nextArg())
"--default-method-call-hook" ->
- ret.defaultMethodCallHook.setNextStringArg()
-
- "--intersect-stub-jar" ->
- ret.intersectStubJars += nextArg().ensureFileExists()
+ ret.defaultMethodCallHook.set(nextArg())
"--gen-keep-all-file" ->
- ret.inputJarAsKeepAllFile.setNextStringArg()
+ ret.inputJarAsKeepAllFile.set(nextArg())
// Following options are for debugging.
"--enable-class-checker" -> ret.enableClassChecker.set(true)
@@ -255,22 +228,21 @@
"--enable-post-trace" -> ret.enablePostTrace.set(true)
"--no-post-trace" -> ret.enablePostTrace.set(false)
- "--enable-non-stub-method-check" ->
- ret.enableNonStubMethodCallDetection.set(true)
+ "--gen-input-dump-file" -> ret.inputJarDumpFile.set(nextArg())
- "--no-non-stub-method-check" ->
- ret.enableNonStubMethodCallDetection.set(false)
+ "--stats-file" -> ret.statsFile.set(nextArg())
+ "--supported-api-list-file" -> ret.apiListFile.set(nextArg())
- "--gen-input-dump-file" -> ret.inputJarDumpFile.setNextStringArg()
-
- "--verbose-log" -> setLogFile(LogLevel.Verbose, nextArg())
- "--debug-log" -> setLogFile(LogLevel.Debug, nextArg())
-
- "--stats-file" -> ret.statsFile.setNextStringArg()
- "--supported-api-list-file" -> ret.apiListFile.setNextStringArg()
-
- "--num-shards" -> ret.numShards.setNextIntArg()
- "--shard-index" -> ret.shard.setNextIntArg()
+ "--num-shards" -> ret.numShards.set(nextArg()).also {
+ if (it < 1) {
+ throw ArgumentsException("$arg must be positive integer")
+ }
+ }
+ "--shard-index" -> ret.shard.set(nextArg()).also {
+ if (it < 0) {
+ throw ArgumentsException("$arg must be positive integer or zero")
+ }
+ }
else -> throw ArgumentsException("Unknown option: $arg")
}
@@ -282,131 +254,49 @@
if (!ret.inJar.isSet) {
throw ArgumentsException("Required option missing: --in-jar")
}
- if (!ret.outStubJar.isSet && !ret.outImplJar.isSet) {
- log.w("Neither --out-stub-jar nor --out-impl-jar is set." +
- " $executableName will not generate jar files.")
+ if (!ret.outJar.isSet) {
+ log.w("--out-jar is not set. $executableName will not generate jar files.")
+ }
+ if (ret.numShards.isSet != ret.shard.isSet) {
+ throw ArgumentsException("--num-shards and --shard-index must be used together")
}
- if (ret.enableNonStubMethodCallDetection.get) {
- log.w("--enable-non-stub-method-check is not fully implemented yet." +
- " See the todo in doesMethodNeedNonStubCallCheck().")
+ if (ret.numShards.isSet) {
+ if (ret.shard.get >= ret.numShards.get) {
+ throw ArgumentsException("--shard-index must be smaller than --num-shards")
+ }
}
return ret
}
-
- /**
- * Scan the arguments, and if any of them starts with an `@`, then load from the file
- * and use its content as arguments.
- *
- * In this file, each line is treated as a single argument.
- *
- * The file can contain '#' as comments.
- */
- private fun expandAtFiles(args: Array<String>): List<String> {
- val ret = mutableListOf<String>()
-
- args.forEach { arg ->
- if (!arg.startsWith('@')) {
- ret += arg
- return@forEach
- }
- // Read from the file, and add each line to the result.
- val filename = arg.substring(1).ensureFileExists()
-
- log.v("Expanding options file $filename")
-
- BufferedReader(FileReader(filename)).use { reader ->
- while (true) {
- var line = reader.readLine()
- if (line == null) {
- break // EOF
- }
-
- line = normalizeTextLine(line)
- if (line.isNotEmpty()) {
- ret += line
- }
- }
- }
- }
- return ret
- }
- }
-
- open class ArgumentsException(message: String?) : Exception(message), UserErrorException
-
- /** Thrown when the same annotation is used with different annotation arguments. */
- class DuplicateAnnotationException(annotationName: String?) :
- ArgumentsException("Duplicate annotation specified: '$annotationName'")
-
- /** Thrown when an input file does not exist. */
- class InputFileNotFoundException(filename: String) :
- ArgumentsException("File '$filename' not found")
-
- private class ArgIterator(
- private val args: List<String>,
- private var currentIndex: Int = -1
- ) {
- val current: String
- get() = args.get(currentIndex)
-
- /**
- * Get the next argument, or [null] if there's no more arguments.
- */
- fun nextArgOptional(): String? {
- if ((currentIndex + 1) >= args.size) {
- return null
- }
- return args.get(++currentIndex)
- }
-
- /**
- * Get the next argument, or throw if
- */
- fun nextArgRequired(argName: String): String {
- nextArgOptional().let {
- if (it == null) {
- throw ArgumentsException("Missing parameter for option $argName")
- }
- if (it.isEmpty()) {
- throw ArgumentsException("Parameter can't be empty for option $argName")
- }
- return it
- }
- }
}
override fun toString(): String {
return """
HostStubGenOptions{
inJar='$inJar',
- outStubJar='$outStubJar',
- outImplJar='$outImplJar',
+ outJar='$outJar',
inputJarDumpFile=$inputJarDumpFile,
inputJarAsKeepAllFile=$inputJarAsKeepAllFile,
- stubAnnotations=$stubAnnotations,
keepAnnotations=$keepAnnotations,
throwAnnotations=$throwAnnotations,
removeAnnotations=$removeAnnotations,
- stubClassAnnotations=$stubClassAnnotations,
+ ignoreAnnotations=$ignoreAnnotations,
keepClassAnnotations=$keepClassAnnotations,
substituteAnnotations=$substituteAnnotations,
- nativeSubstituteAnnotations=$nativeSubstituteAnnotations,
+ nativeSubstituteAnnotations=$redirectionClassAnnotations,
classLoadHookAnnotations=$classLoadHookAnnotations,
keepStaticInitializerAnnotations=$keepStaticInitializerAnnotations,
packageRedirects=$packageRedirects,
- $annotationAllowedClassesFile=$annotationAllowedClassesFile,
+ annotationAllowedClassesFile=$annotationAllowedClassesFile,
defaultClassLoadHook=$defaultClassLoadHook,
defaultMethodCallHook=$defaultMethodCallHook,
- intersectStubJars=$intersectStubJars,
policyOverrideFile=$policyOverrideFile,
defaultPolicy=$defaultPolicy,
cleanUpOnError=$cleanUpOnError,
enableClassChecker=$enableClassChecker,
enablePreTrace=$enablePreTrace,
enablePostTrace=$enablePostTrace,
- enableNonStubMethodCallDetection=$enableNonStubMethodCallDetection,
statsFile=$statsFile,
apiListFile=$apiListFile,
numShards=$numShards,
@@ -415,3 +305,80 @@
""".trimIndent()
}
}
+
+class ArgIterator(
+ private val args: List<String>,
+ private var currentIndex: Int = -1
+) {
+ val current: String
+ get() = args.get(currentIndex)
+
+ /**
+ * Get the next argument, or [null] if there's no more arguments.
+ */
+ fun nextArgOptional(): String? {
+ if ((currentIndex + 1) >= args.size) {
+ return null
+ }
+ return args.get(++currentIndex)
+ }
+
+ /**
+ * Get the next argument, or throw if
+ */
+ fun nextArgRequired(argName: String): String {
+ nextArgOptional().let {
+ if (it == null) {
+ throw ArgumentsException("Missing parameter for option $argName")
+ }
+ if (it.isEmpty()) {
+ throw ArgumentsException("Parameter can't be empty for option $argName")
+ }
+ return it
+ }
+ }
+
+ companion object {
+ fun withAtFiles(args: Array<String>): ArgIterator {
+ return ArgIterator(expandAtFiles(args))
+ }
+ }
+}
+
+/**
+ * Scan the arguments, and if any of them starts with an `@`, then load from the file
+ * and use its content as arguments.
+ *
+ * In this file, each line is treated as a single argument.
+ *
+ * The file can contain '#' as comments.
+ */
+private fun expandAtFiles(args: Array<String>): List<String> {
+ val ret = mutableListOf<String>()
+
+ args.forEach { arg ->
+ if (!arg.startsWith('@')) {
+ ret += arg
+ return@forEach
+ }
+ // Read from the file, and add each line to the result.
+ val filename = arg.substring(1).ensureFileExists()
+
+ log.v("Expanding options file $filename")
+
+ BufferedReader(FileReader(filename)).use { reader ->
+ while (true) {
+ var line = reader.readLine()
+ if (line == null) {
+ break // EOF
+ }
+
+ line = normalizeTextLine(line)
+ if (line.isNotEmpty()) {
+ ret += line
+ }
+ }
+ }
+ }
+ return ret
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt
index 3f2b13a..a02082d 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt
@@ -29,36 +29,65 @@
/** Name of the class initializer method. */
-val CLASS_INITIALIZER_NAME = "<clinit>"
+const val CLASS_INITIALIZER_NAME = "<clinit>"
/** Descriptor of the class initializer method. */
-val CLASS_INITIALIZER_DESC = "()V"
+const val CLASS_INITIALIZER_DESC = "()V"
/** Name of constructors. */
-val CTOR_NAME = "<init>"
+const val CTOR_NAME = "<init>"
/**
- * Find any of [anyAnnotations] from the list of visible / invisible annotations.
+ * Find any of [set] from the list of visible / invisible annotations.
*/
fun findAnyAnnotation(
- anyAnnotations: Set<String>,
- visibleAnnotations: List<AnnotationNode>?,
- invisibleAnnotations: List<AnnotationNode>?,
- ): AnnotationNode? {
- for (an in visibleAnnotations ?: emptyList()) {
- if (anyAnnotations.contains(an.desc)) {
- return an
- }
- }
- for (an in invisibleAnnotations ?: emptyList()) {
- if (anyAnnotations.contains(an.desc)) {
- return an
- }
- }
- return null
+ set: Set<String>,
+ visibleAnnotations: List<AnnotationNode>?,
+ invisibleAnnotations: List<AnnotationNode>?,
+): AnnotationNode? {
+ return visibleAnnotations?.find { it.desc in set }
+ ?: invisibleAnnotations?.find { it.desc in set }
}
-fun findAnnotationValueAsString(an: AnnotationNode, propertyName: String): String? {
+fun ClassNode.findAnyAnnotation(set: Set<String>): AnnotationNode? {
+ return findAnyAnnotation(set, this.visibleAnnotations, this.invisibleAnnotations)
+}
+
+fun MethodNode.findAnyAnnotation(set: Set<String>): AnnotationNode? {
+ return findAnyAnnotation(set, this.visibleAnnotations, this.invisibleAnnotations)
+}
+
+fun FieldNode.findAnyAnnotation(set: Set<String>): AnnotationNode? {
+ return findAnyAnnotation(set, this.visibleAnnotations, this.invisibleAnnotations)
+}
+
+fun findAllAnnotations(
+ set: Set<String>,
+ visibleAnnotations: List<AnnotationNode>?,
+ invisibleAnnotations: List<AnnotationNode>?
+): List<AnnotationNode> {
+ return (visibleAnnotations ?: emptyList()).filter { it.desc in set } +
+ (invisibleAnnotations ?: emptyList()).filter { it.desc in set }
+}
+
+fun ClassNode.findAllAnnotations(set: Set<String>): List<AnnotationNode> {
+ return findAllAnnotations(set, this.visibleAnnotations, this.invisibleAnnotations)
+}
+
+fun MethodNode.findAllAnnotations(set: Set<String>): List<AnnotationNode> {
+ return findAllAnnotations(set, this.visibleAnnotations, this.invisibleAnnotations)
+}
+
+fun FieldNode.findAllAnnotations(set: Set<String>): List<AnnotationNode> {
+ return findAllAnnotations(set, this.visibleAnnotations, this.invisibleAnnotations)
+}
+
+fun <T> findAnnotationValueAsObject(
+ an: AnnotationNode,
+ propertyName: String,
+ expectedTypeHumanReadableName: String,
+ converter: (Any?) -> T?,
+): T? {
for (i in 0..(an.values?.size ?: 0) - 2 step 2) {
val name = an.values[i]
@@ -66,16 +95,30 @@
continue
}
val value = an.values[i + 1]
- if (value is String) {
- return value
+ if (value == null) {
+ return null
}
- throw ClassParseException(
- "The type of '$name' in annotation \"${an.desc}\" must be String" +
- ", but is ${value?.javaClass?.canonicalName}")
+
+ try {
+ return converter(value)
+ } catch (e: ClassCastException) {
+ throw ClassParseException(
+ "The type of '$propertyName' in annotation @${an.desc} must be " +
+ "$expectedTypeHumanReadableName, but is ${value?.javaClass?.canonicalName}")
+ }
}
return null
}
+fun findAnnotationValueAsString(an: AnnotationNode, propertyName: String): String? {
+ return findAnnotationValueAsObject(an, propertyName, "String", {it as String})
+}
+
+fun findAnnotationValueAsType(an: AnnotationNode, propertyName: String): Type? {
+ return findAnnotationValueAsObject(an, propertyName, "Class", {it as Type})
+}
+
+
val periodOrSlash = charArrayOf('.', '/')
fun getPackageNameFromFullClassName(fullClassName: String): String {
@@ -117,6 +160,32 @@
return "$defaultPackageName.$className"
}
+fun splitWithLastPeriod(name: String): Pair<String, String>? {
+ val pos = name.lastIndexOf('.')
+ if (pos < 0) {
+ return null
+ }
+ return Pair(name.substring(0, pos), name.substring(pos + 1))
+}
+
+fun String.startsWithAny(vararg prefixes: String): Boolean {
+ prefixes.forEach {
+ if (this.startsWith(it)) {
+ return true
+ }
+ }
+ return false
+}
+
+fun String.endsWithAny(vararg suffixes: String): Boolean {
+ suffixes.forEach {
+ if (this.endsWith(it)) {
+ return true
+ }
+ }
+ return false
+}
+
fun String.toJvmClassName(): String {
return this.replace('.', '/')
}
@@ -129,6 +198,14 @@
return this.replace('/', '.')
}
+fun zipEntryNameToClassName(entryFilename: String): String? {
+ val suffix = ".class"
+ if (!entryFilename.endsWith(suffix)) {
+ return null
+ }
+ return entryFilename.substring(0, entryFilename.length - suffix.length)
+}
+
private val numericalInnerClassName = """.*\$\d+$""".toRegex()
fun isAnonymousInnerClass(cn: ClassNode): Boolean {
@@ -137,18 +214,6 @@
}
/**
- * Take a class name. If it's a nested class, then return the name of its direct outer class name.
- * Otherwise, return null.
- */
-fun getDirectOuterClassName(className: String): String? {
- val pos = className.lastIndexOf('$')
- if (pos < 0) {
- return null
- }
- return className.substring(0, pos)
-}
-
-/**
* Write bytecode to push all the method arguments to the stack.
* The number of arguments and their type are taken from [methodDescriptor].
*/
@@ -198,11 +263,11 @@
/**
* Given a method descriptor, insert an [argType] as the first argument to it.
*/
-fun prependArgTypeToMethodDescriptor(methodDescriptor: String, argType: Type): String {
+fun prependArgTypeToMethodDescriptor(methodDescriptor: String, classInternalName: String): String {
val returnType = Type.getReturnType(methodDescriptor)
val argTypes = Type.getArgumentTypes(methodDescriptor).toMutableList()
- argTypes.add(0, argType)
+ argTypes.add(0, Type.getType("L" + classInternalName + ";"))
return Type.getMethodDescriptor(returnType, *argTypes.toTypedArray())
}
@@ -270,6 +335,18 @@
return (this.access and Opcodes.ACC_STATIC) != 0
}
+fun MethodNode.isPublic(): Boolean {
+ return (this.access and Opcodes.ACC_PUBLIC) != 0
+}
+
+fun MethodNode.isNative(): Boolean {
+ return (this.access and Opcodes.ACC_NATIVE) != 0
+}
+
+fun MethodNode.isSpecial(): Boolean {
+ return CTOR_NAME == this.name || CLASS_INITIALIZER_NAME == this.name
+}
+
fun FieldNode.isEnum(): Boolean {
return (this.access and Opcodes.ACC_ENUM) != 0
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/ClassNodes.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/ClassNodes.kt
index 92906a7..e2647eb 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/ClassNodes.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/asm/ClassNodes.kt
@@ -27,6 +27,11 @@
import java.io.BufferedInputStream
import java.io.PrintWriter
import java.util.Arrays
+import java.util.concurrent.Executors
+import java.util.concurrent.TimeUnit
+import java.util.concurrent.atomic.AtomicReference
+import java.util.function.Consumer
+import java.util.zip.ZipEntry
import java.util.zip.ZipFile
/**
@@ -183,49 +188,85 @@
/**
* Load all the classes, without code.
*/
- fun loadClassStructures(inJar: String): ClassNodes {
- log.i("Reading class structure from $inJar ...")
- val start = System.currentTimeMillis()
-
+ fun loadClassStructures(
+ inJar: String,
+ timeCollector: Consumer<Double>? = null,
+ ): ClassNodes {
val allClasses = ClassNodes()
- log.withIndent {
- ZipFile(inJar).use { inZip ->
- val inEntries = inZip.entries()
+ // Load classes in parallel.
+ val executor = Executors.newFixedThreadPool(4)
- while (inEntries.hasMoreElements()) {
- val entry = inEntries.nextElement()
+ // First exception defected.
+ val exception = AtomicReference<Throwable>()
- BufferedInputStream(inZip.getInputStream(entry)).use { bis ->
+ // Called on a BG thread. Read a single jar entry and add it to [allClasses].
+ fun parseClass(inZip: ZipFile, entry: ZipEntry) {
+ try {
+ inZip.getInputStream(entry).use { ins ->
+ val cr = ClassReader(BufferedInputStream(ins))
+ val cn = ClassNode()
+ cr.accept(
+ cn, ClassReader.SKIP_CODE
+ or ClassReader.SKIP_DEBUG
+ or ClassReader.SKIP_FRAMES
+ )
+ synchronized(allClasses) {
+ if (!allClasses.addClass(cn)) {
+ log.w("Duplicate class found: ${cn.name}")
+ }
+ }
+ }
+ } catch (e: Throwable) {
+ log.e("Failed to load class: $e")
+ exception.compareAndSet(null, e)
+ }
+ }
+
+ // Actually open the jar and read it on worker threads.
+ val time = log.iTime("Reading class structure from $inJar") {
+ log.withIndent {
+ ZipFile(inJar).use { inZip ->
+ val inEntries = inZip.entries()
+
+ while (inEntries.hasMoreElements()) {
+ val entry = inEntries.nextElement()
+
if (entry.name.endsWith(".class")) {
- val cr = ClassReader(bis)
- val cn = ClassNode()
- cr.accept(cn, ClassReader.SKIP_CODE or ClassReader.SKIP_DEBUG
- or ClassReader.SKIP_FRAMES)
- if (!allClasses.addClass(cn)) {
- log.w("Duplicate class found: ${cn.name}")
+ executor.submit {
+ parseClass(inZip, entry)
}
} else if (entry.name.endsWith(".dex")) {
// Seems like it's an ART jar file. We can't process it.
// It's a fatal error.
throw InvalidJarFileException(
- "$inJar is not a desktop jar file. It contains a *.dex file.")
+ "$inJar is not a desktop jar file."
+ + " It contains a *.dex file."
+ )
} else {
// Unknown file type. Skip.
- while (bis.available() > 0) {
- bis.skip((1024 * 1024).toLong())
- }
}
}
+ // Wait for all the work to complete. (must do it before closing the zip)
+ log.i("Waiting for all loaders to finish...")
+ executor.shutdown()
+ executor.awaitTermination(5, TimeUnit.MINUTES)
+ log.i("All loaders to finished.")
}
}
- }
- if (allClasses.size == 0) {
- log.w("$inJar contains no *.class files.")
- }
- val end = System.currentTimeMillis()
- log.i("Done reading class structure in %.1f second(s).", (end - start) / 1000.0)
+ // If any exception is detected, throw it.
+ exception.get()?.let {
+ throw it
+ }
+
+ if (allClasses.size == 0) {
+ log.w("$inJar contains no *.class files.")
+ } else {
+ log.i("Loaded ${allClasses.size} classes from $inJar.")
+ }
+ }
+ timeCollector?.accept(time)
return allClasses
}
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/dumper/ApiDumper.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/dumper/ApiDumper.kt
index aaefee4..5e4e70f 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/dumper/ApiDumper.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/dumper/ApiDumper.kt
@@ -44,7 +44,7 @@
val descriptor: String,
)
- val javaStandardApiPolicy = FilterPolicy.Stub.withReason("Java standard API")
+ private val javaStandardApiPolicy = FilterPolicy.Keep.withReason("Java standard API")
private val shownMethods = mutableSetOf<MethodKey>()
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt
index 248121c..36adf06 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt
@@ -17,14 +17,16 @@
import com.android.hoststubgen.ClassParseException
import com.android.hoststubgen.HostStubGenErrors
-import com.android.hoststubgen.HostStubGenInternalException
import com.android.hoststubgen.InvalidAnnotationException
-import com.android.hoststubgen.addNonNullElement
+import com.android.hoststubgen.addLists
import com.android.hoststubgen.asm.CLASS_INITIALIZER_DESC
import com.android.hoststubgen.asm.CLASS_INITIALIZER_NAME
import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.findAllAnnotations
import com.android.hoststubgen.asm.findAnnotationValueAsString
import com.android.hoststubgen.asm.findAnyAnnotation
+import com.android.hoststubgen.asm.getPackageNameFromFullClassName
+import com.android.hoststubgen.asm.resolveClassNameWithDefaultPackage
import com.android.hoststubgen.asm.toHumanReadableClassName
import com.android.hoststubgen.asm.toHumanReadableMethodName
import com.android.hoststubgen.asm.toJvmClassName
@@ -35,395 +37,313 @@
// TODO: Detect invalid cases, such as...
// - Class's visibility is lower than the members'.
-// - HostSideTestSubstituteWith is set, but it doesn't have @Stub or @Keep
/**
* [OutputFilter] using Java annotations.
*/
class AnnotationBasedFilter(
- private val errors: HostStubGenErrors,
- private val classes: ClassNodes,
- stubAnnotations_: Set<String>,
- keepAnnotations_: Set<String>,
- stubClassAnnotations_: Set<String>,
- keepClassAnnotations_: Set<String>,
- throwAnnotations_: Set<String>,
- removeAnnotations_: Set<String>,
- substituteAnnotations_: Set<String>,
- nativeSubstituteAnnotations_: Set<String>,
- classLoadHookAnnotations_: Set<String>,
- keepStaticInitializerAnnotations_: Set<String>,
- private val annotationAllowedClassesFilter: ClassFilter,
- fallback: OutputFilter,
+ private val errors: HostStubGenErrors,
+ private val classes: ClassNodes,
+ keepAnnotations_: Set<String>,
+ keepClassAnnotations_: Set<String>,
+ throwAnnotations_: Set<String>,
+ removeAnnotations_: Set<String>,
+ ignoreAnnotations_: Set<String>,
+ substituteAnnotations_: Set<String>,
+ redirectAnnotations_: Set<String>,
+ redirectionClassAnnotations_: Set<String>,
+ classLoadHookAnnotations_: Set<String>,
+ keepStaticInitializerAnnotations_: Set<String>,
+ private val annotationAllowedClassesFilter: ClassFilter,
+ fallback: OutputFilter,
) : DelegatingFilter(fallback) {
- private var stubAnnotations = convertToInternalNames(stubAnnotations_)
- private var keepAnnotations = convertToInternalNames(keepAnnotations_)
- private var stubClassAnnotations = convertToInternalNames(stubClassAnnotations_)
- private var keepClassAnnotations = convertToInternalNames(keepClassAnnotations_)
- private var throwAnnotations = convertToInternalNames(throwAnnotations_)
- private var removeAnnotations = convertToInternalNames(removeAnnotations_)
- private var substituteAnnotations = convertToInternalNames(substituteAnnotations_)
- private var nativeSubstituteAnnotations = convertToInternalNames(nativeSubstituteAnnotations_)
- private var classLoadHookAnnotations = convertToInternalNames(classLoadHookAnnotations_)
- private var keepStaticInitializerAnnotations =
- convertToInternalNames(keepStaticInitializerAnnotations_)
+ private val keepAnnotations = convertToInternalNames(keepAnnotations_)
+ private val keepClassAnnotations = convertToInternalNames(keepClassAnnotations_)
+ private val throwAnnotations = convertToInternalNames(throwAnnotations_)
+ private val removeAnnotations = convertToInternalNames(removeAnnotations_)
+ private val ignoreAnnotations = convertToInternalNames(ignoreAnnotations_)
+ private val redirectAnnotations = convertToInternalNames(redirectAnnotations_)
+ private val substituteAnnotations = convertToInternalNames(substituteAnnotations_)
+ private val redirectionClassAnnotations =
+ convertToInternalNames(redirectionClassAnnotations_)
+ private val classLoadHookAnnotations = convertToInternalNames(classLoadHookAnnotations_)
+ private val keepStaticInitializerAnnotations =
+ convertToInternalNames(keepStaticInitializerAnnotations_)
/** Annotations that control API visibility. */
- private var visibilityAnnotations: Set<String> = convertToInternalNames(
- stubAnnotations_ +
- keepAnnotations_ +
- stubClassAnnotations_ +
- keepClassAnnotations_ +
- throwAnnotations_ +
- removeAnnotations_)
+ private val visibilityAnnotations = keepAnnotations +
+ keepClassAnnotations +
+ throwAnnotations +
+ removeAnnotations +
+ ignoreAnnotations +
+ redirectAnnotations +
+ substituteAnnotations
+
+ /** All the annotations we use. */
+ private val allAnnotations = visibilityAnnotations +
+ redirectionClassAnnotations +
+ classLoadHookAnnotations +
+ keepStaticInitializerAnnotations
/**
* All the annotations we use. Note, this one is in a [convertToJvmNames] format unlike
* other ones, because of how it's used.
*/
- private var allAnnotations: Set<String> = convertToJvmNames(
- stubAnnotations_ +
- keepAnnotations_ +
- stubClassAnnotations_ +
+ private val allAnnotationClasses: Set<String> = convertToJvmNames(
+ keepAnnotations_ +
keepClassAnnotations_ +
throwAnnotations_ +
removeAnnotations_ +
+ redirectAnnotations_ +
substituteAnnotations_ +
- nativeSubstituteAnnotations_ +
- classLoadHookAnnotations_)
+ redirectionClassAnnotations_ +
+ classLoadHookAnnotations_ +
+ keepStaticInitializerAnnotations_
+ )
- private val substitutionHelper = SubstitutionHelper()
+ private val policyCache = mutableMapOf<String, ClassAnnotations>()
- private val reasonAnnotation = "annotation"
- private val reasonClassAnnotation = "class-annotation"
-
- /**
- * Throw if an item has more than one visibility annotations.
- *
- * name1 - 4 are only used in exception messages. We take them as separate strings
- * to avoid unnecessary string concatenations.
- */
- private fun detectInvalidAnnotations(
- visibles: List<AnnotationNode>?,
- invisibles: List<AnnotationNode>?,
- type: String,
- name1: String,
- name2: String,
- name3: String,
- ) {
- var count = 0
- for (an in visibles ?: emptyList()) {
- if (visibilityAnnotations.contains(an.desc)) {
- count++
- }
- }
- for (an in invisibles ?: emptyList()) {
- if (visibilityAnnotations.contains(an.desc)) {
- count++
- }
- }
- if (count > 1) {
- val description = if (name2 == "" && name3 == "") {
- "$type $name1"
- } else {
- "$type $name1.$name2$name3"
- }
- throw InvalidAnnotationException(
- "Found more than one visibility annotations on $description")
+ private val AnnotationNode.policy: FilterPolicyWithReason? get() {
+ return when (desc) {
+ in keepAnnotations -> FilterPolicy.Keep.withReason(REASON_ANNOTATION)
+ in keepClassAnnotations -> FilterPolicy.KeepClass.withReason(REASON_CLASS_ANNOTATION)
+ in substituteAnnotations -> FilterPolicy.Substitute.withReason(REASON_ANNOTATION)
+ in throwAnnotations -> FilterPolicy.Throw.withReason(REASON_ANNOTATION)
+ in removeAnnotations -> FilterPolicy.Remove.withReason(REASON_ANNOTATION)
+ in ignoreAnnotations -> FilterPolicy.Ignore.withReason(REASON_ANNOTATION)
+ in redirectAnnotations -> FilterPolicy.Redirect.withReason(REASON_ANNOTATION)
+ else -> null
}
}
- fun findAnyAnnotation(
- className: String,
- anyAnnotations: Set<String>,
- visibleAnnotations: List<AnnotationNode>?,
- invisibleAnnotations: List<AnnotationNode>?,
- ): AnnotationNode? {
- val ret = findAnyAnnotation(anyAnnotations, visibleAnnotations, invisibleAnnotations)
+ private fun getAnnotationPolicy(cn: ClassNode): ClassAnnotations {
+ return policyCache.getOrPut(cn.name) { ClassAnnotations(cn) }
+ }
- if (ret != null) {
- if (!annotationAllowedClassesFilter.matches(className)) {
- throw InvalidAnnotationException(
- "Class ${className.toHumanReadableClassName()} is not allowed to have " +
- "Ravenwood annotations. Contact g/ravenwood for more details.")
+ override fun getPolicyForClass(className: String): FilterPolicyWithReason {
+ // If it's any of the annotations, then always keep it.
+ if (allAnnotationClasses.contains(className)) {
+ return FilterPolicy.KeepClass.withReason("HostStubGen Annotation")
+ }
+
+ val cn = classes.getClass(className)
+ return getAnnotationPolicy(cn).classPolicy ?: super.getPolicyForClass(className)
+ }
+
+ override fun getPolicyForField(className: String, fieldName: String): FilterPolicyWithReason {
+ val cn = classes.getClass(className)
+ return getAnnotationPolicy(cn).fieldPolicies[fieldName]
+ ?: super.getPolicyForField(className, fieldName)
+ }
+
+ override fun getPolicyForMethod(
+ className: String,
+ methodName: String,
+ descriptor: String
+ ): FilterPolicyWithReason {
+ val cn = classes.getClass(className)
+ return getAnnotationPolicy(cn).methodPolicies[MethodKey(methodName, descriptor)]
+ ?: super.getPolicyForMethod(className, methodName, descriptor)
+ }
+
+ override fun getRenameTo(
+ className: String,
+ methodName: String,
+ descriptor: String
+ ): String? {
+ val cn = classes.getClass(className)
+ return getAnnotationPolicy(cn).renamedMethods[MethodKey(methodName, descriptor)]
+ ?: super.getRenameTo(className, methodName, descriptor)
+ }
+
+ override fun getRedirectionClass(className: String): String? {
+ val cn = classes.getClass(className)
+ return getAnnotationPolicy(cn).redirectionClass
+ }
+
+ override fun getClassLoadHooks(className: String): List<String> {
+ val cn = classes.getClass(className)
+ return addLists(super.getClassLoadHooks(className), getAnnotationPolicy(cn).classLoadHooks)
+ }
+
+ private data class MethodKey(val name: String, val desc: String)
+
+ /**
+ * Every time we see a class, we scan all its methods for substitution attributes,
+ * and compute (implicit) policies caused by them.
+ *
+ * For example, for the following methods:
+ *
+ * @Substitute(suffix = "_host")
+ * private void foo() {
+ * // This isn't supported on the host side.
+ * }
+ * private void foo_host() {
+ * // Host side implementation
+ * }
+ *
+ * We internally handle them as:
+ *
+ * foo() -> Substitute
+ * foo_host() -> Stub, and then rename it to foo().
+ */
+ private inner class ClassAnnotations(cn: ClassNode) {
+
+ val classPolicy: FilterPolicyWithReason?
+ val fieldPolicies = mutableMapOf<String, FilterPolicyWithReason>()
+ val methodPolicies = mutableMapOf<MethodKey, FilterPolicyWithReason>()
+ val renamedMethods = mutableMapOf<MethodKey, String>()
+ val redirectionClass: String?
+ val classLoadHooks: List<String>
+
+ init {
+ val allowAnnotation = annotationAllowedClassesFilter.matches(cn.name)
+ detectInvalidAnnotations(
+ cn.name, allowAnnotation,
+ cn.visibleAnnotations, cn.invisibleAnnotations,
+ "class", cn.name
+ )
+ classPolicy = cn.findAnyAnnotation(visibilityAnnotations)?.policy
+ redirectionClass = cn.findAnyAnnotation(redirectionClassAnnotations)?.let { an ->
+ getAnnotationField(an, "value")?.let { resolveRelativeClass(cn, it) }
+ }
+ classLoadHooks = cn.findAllAnnotations(classLoadHookAnnotations).mapNotNull { an ->
+ getAnnotationField(an, "value")?.toHumanReadableMethodName()
+ }
+ if (cn.findAnyAnnotation(keepStaticInitializerAnnotations) != null) {
+ methodPolicies[MethodKey(CLASS_INITIALIZER_NAME, CLASS_INITIALIZER_DESC)] =
+ FilterPolicy.Keep.withReason(REASON_ANNOTATION)
+ }
+
+ for (fn in cn.fields ?: emptyList()) {
+ detectInvalidAnnotations(
+ cn.name, allowAnnotation,
+ fn.visibleAnnotations, fn.invisibleAnnotations,
+ "field", cn.name, fn.name
+ )
+ fn.findAnyAnnotation(visibilityAnnotations)?.policy?.let {
+ fieldPolicies[fn.name] = it
+ }
+ }
+
+ for (mn in cn.methods ?: emptyList()) {
+ detectInvalidAnnotations(
+ cn.name, allowAnnotation,
+ mn.visibleAnnotations, mn.invisibleAnnotations,
+ "method", cn.name, mn.name, mn.desc
+ )
+
+ val an = mn.findAnyAnnotation(visibilityAnnotations) ?: continue
+ val policy = an.policy ?: continue
+ methodPolicies[MethodKey(mn.name, mn.desc)] = policy
+
+ if (policy.policy != FilterPolicy.Substitute) continue
+
+ // Handle substitution
+ val suffix = getAnnotationField(an, "suffix", false) ?: "\$ravenwood"
+ val replacement = mn.name + suffix
+
+ if (replacement == mn.name) {
+ errors.onErrorFound("@SubstituteWith require a different name")
+ } else {
+ // The replacement method has to be renamed
+ methodPolicies[MethodKey(replacement, mn.desc)] =
+ FilterPolicy.Keep.withReason(REASON_ANNOTATION)
+ renamedMethods[MethodKey(replacement, mn.desc)] = mn.name
+
+ log.v("Substitution found: %s%s -> %s", replacement, mn.desc, mn.name)
+ }
}
}
- return ret
- }
-
- /**
- * Find a visibility annotation.
- *
- * name1 - 4 are only used in exception messages.
- */
- private fun findAnnotation(
+ /**
+ * Throw if an item has more than one visibility annotations, or the class is not allowed
+ *
+ * name1 - 4 are only used in exception messages. We take them as separate strings
+ * to avoid unnecessary string concatenations.
+ */
+ private fun detectInvalidAnnotations(
className: String,
+ allowAnnotation: Boolean,
visibles: List<AnnotationNode>?,
invisibles: List<AnnotationNode>?,
type: String,
name1: String,
name2: String = "",
name3: String = "",
- ): FilterPolicyWithReason? {
- detectInvalidAnnotations(visibles, invisibles, type, name1, name2, name3)
-
- findAnyAnnotation(className, stubAnnotations, visibles, invisibles)?.let {
- return FilterPolicy.Stub.withReason(reasonAnnotation)
- }
- findAnyAnnotation(className, stubClassAnnotations, visibles, invisibles)?.let {
- return FilterPolicy.StubClass.withReason(reasonClassAnnotation)
- }
- findAnyAnnotation(className, keepAnnotations, visibles, invisibles)?.let {
- return FilterPolicy.Keep.withReason(reasonAnnotation)
- }
- findAnyAnnotation(className, keepClassAnnotations, visibles, invisibles)?.let {
- return FilterPolicy.KeepClass.withReason(reasonClassAnnotation)
- }
- findAnyAnnotation(className, throwAnnotations, visibles, invisibles)?.let {
- return FilterPolicy.Throw.withReason(reasonAnnotation)
- }
- findAnyAnnotation(className, removeAnnotations, visibles, invisibles)?.let {
- return FilterPolicy.Remove.withReason(reasonAnnotation)
- }
-
- return null
- }
-
- override fun getPolicyForClass(className: String): FilterPolicyWithReason {
- val cn = classes.getClass(className)
-
- findAnnotation(
- cn.name,
- cn.visibleAnnotations,
- cn.invisibleAnnotations,
- "class",
- className)?.let {
- return it
- }
-
- // If it's any of the annotations, then always keep it.
- if (allAnnotations.contains(className)) {
- return FilterPolicy.KeepClass.withReason("HostStubGen Annotation")
- }
-
- return super.getPolicyForClass(className)
- }
-
- override fun getPolicyForField(
- className: String,
- fieldName: String
- ): FilterPolicyWithReason {
- val cn = classes.getClass(className)
-
- cn.fields?.firstOrNull { it.name == fieldName }?.let {fn ->
- findAnnotation(
- cn.name,
- fn.visibleAnnotations,
- fn.invisibleAnnotations,
- "field",
- className,
- fieldName
- )?.let { policy ->
- // If the item has an annotation, then use it.
- return policy
+ ) {
+ var count = 0
+ var visibleCount = 0
+ for (an in visibles ?: emptyList()) {
+ if (visibilityAnnotations.contains(an.desc)) {
+ visibleCount++
+ }
+ if (allAnnotations.contains(an.desc)) {
+ count++
+ }
}
- }
- return super.getPolicyForField(className, fieldName)
- }
-
- override fun getPolicyForMethod(
- className: String,
- methodName: String,
- descriptor: String
- ): FilterPolicyWithReason {
- val cn = classes.getClass(className)
-
- if (methodName == CLASS_INITIALIZER_NAME && descriptor == CLASS_INITIALIZER_DESC) {
- findAnyAnnotation(cn.name, keepStaticInitializerAnnotations,
- cn.visibleAnnotations, cn.invisibleAnnotations)?.let {
- return FilterPolicy.Keep.withReason(reasonAnnotation)
+ for (an in invisibles ?: emptyList()) {
+ if (visibilityAnnotations.contains(an.desc)) {
+ visibleCount++
+ }
+ if (allAnnotations.contains(an.desc)) {
+ count++
+ }
}
- }
-
- cn.methods?.firstOrNull { it.name == methodName && it.desc == descriptor }?.let { mn ->
- // @SubstituteWith is going to complicate the policy here, so we ask helper
- // what to do.
- substitutionHelper.getPolicyFromSubstitution(cn, mn.name, mn.desc)?.let {
- return it
+ if (count > 0 && !allowAnnotation) {
+ throw InvalidAnnotationException(
+ "Class ${className.toHumanReadableClassName()} is not allowed to have " +
+ "Ravenwood annotations. Contact g/ravenwood for more details."
+ )
}
-
- // If there's no substitution, then we check the annotation.
- findAnnotation(
- cn.name,
- mn.visibleAnnotations,
- mn.invisibleAnnotations,
- "method",
- className,
- methodName,
- descriptor
- )?.let { policy ->
- return policy
+ if (visibleCount > 1) {
+ val description = if (name2 == "" && name3 == "") {
+ "$type $name1"
+ } else {
+ "$type $name1.$name2$name3"
+ }
+ throw InvalidAnnotationException(
+ "Found more than one visibility annotations on $description"
+ )
}
}
- return super.getPolicyForMethod(className, methodName, descriptor)
- }
-
- override fun getRenameTo(
- className: String,
- methodName: String,
- descriptor: String
- ): String? {
- val cn = classes.getClass(className)
-
- // If the method has a "substitute with" annotation, then return its "value" parameter.
- cn.methods?.firstOrNull { it.name == methodName && it.desc == descriptor }?.let { mn ->
- return substitutionHelper.getRenameTo(cn, mn.name, mn.desc)
- }
- return null
- }
-
- override fun getNativeSubstitutionClass(className: String): String? {
- classes.getClass(className).let { cn ->
- findAnyAnnotation(nativeSubstituteAnnotations,
- cn.visibleAnnotations, cn.invisibleAnnotations)?.let { an ->
- return getAnnotationField(an, "value")?.toJvmClassName()
- }
- }
- return null
- }
-
- override fun getClassLoadHooks(className: String): List<String> {
- val e = classes.getClass(className).let { cn ->
- findAnyAnnotation(classLoadHookAnnotations,
- cn.visibleAnnotations, cn.invisibleAnnotations)?.let { an ->
- getAnnotationField(an, "value")?.toHumanReadableMethodName()
- }
- }
- return addNonNullElement(super.getClassLoadHooks(className), e)
- }
-
- private data class MethodKey(val name: String, val desc: String)
-
- /**
- * In order to handle substitution, we need to build a reverse mapping of substitution
- * methods.
- *
- * This class automatically builds such a map internally that the above methods can
- * take advantage of.
- */
- private inner class SubstitutionHelper {
- private var currentClass: ClassNode? = null
-
- private var policiesFromSubstitution = mutableMapOf<MethodKey, FilterPolicyWithReason>()
- private var substituteToMethods = mutableMapOf<MethodKey, String>()
-
- fun getPolicyFromSubstitution(cn: ClassNode, methodName: String, descriptor: String):
- FilterPolicyWithReason? {
- setClass(cn)
- return policiesFromSubstitution[MethodKey(methodName, descriptor)]
- }
-
- fun getRenameTo(cn: ClassNode, methodName: String, descriptor: String): String? {
- setClass(cn)
- return substituteToMethods[MethodKey(methodName, descriptor)]
- }
/**
- * Every time we see a different class, we scan all its methods for substitution attributes,
- * and compute (implicit) policies caused by them.
- *
- * For example, for the following methods:
- *
- * @Stub
- * @Substitute(suffix = "_host")
- * private void foo() {
- * // This isn't supported on the host side.
- * }
- * private void foo_host() {
- * // Host side implementation
- * }
- *
- * We internally handle them as:
- *
- * foo() -> Remove
- * foo_host() -> Stub, and then rename it to foo().
+ * Return the (String) value of 'value' parameter from an annotation.
*/
- private fun setClass(cn: ClassNode) {
- if (currentClass == cn) {
- return
- }
- // If the class is changing, we'll rebuild the internal structure.
- currentClass = cn
-
- policiesFromSubstitution.clear()
- substituteToMethods.clear()
-
- for (mn in cn.methods ?: emptyList()) {
- findAnyAnnotation(substituteAnnotations,
- mn.visibleAnnotations,
- mn.invisibleAnnotations)?.let { an ->
-
- // Find the policy for this method.
- val policy = outermostFilter.getPolicyForMethod(cn.name, mn.name, mn.desc)
- .policy.resolveClassWidePolicy()
- // Make sure it's either Stub or Keep.
- if (!(policy.needsInStub || policy.needsInImpl)) {
- // TODO: Use the real annotation names in the message
- errors.onErrorFound("@SubstituteWith must have either @Stub or @Keep")
- return@let
- }
- if (!policy.isUsableWithMethods) {
- throw HostStubGenInternalException("Policy $policy shouldn't show up here")
- }
-
- val suffix = getAnnotationField(an, "suffix", false) ?: "\$ravenwood"
- val renameFrom = mn.name + suffix
- val renameTo = mn.name
-
- if (renameFrom == renameTo) {
- errors.onErrorFound("@SubstituteWith have a different name")
- return@let
- }
-
- // This mn has "SubstituteWith". This means,
- // 1. Re move the "rename-to" method, so add it to substitutedMethods.
- policiesFromSubstitution[MethodKey(renameTo, mn.desc)] =
- FilterPolicy.Remove.withReason("substitute-to")
-
- // If the policy is "stub", use "stub".
- // Otherwise, it must be "keep" or "throw", but there's no point in using
- // "throw", so let's use "keep".
- val newPolicy = if (policy.needsInStub) policy else FilterPolicy.Keep
- // 2. We also keep the from-to in the map.
- policiesFromSubstitution[MethodKey(renameFrom, mn.desc)] =
- newPolicy.withReason("substitute-from")
- substituteToMethods[MethodKey(renameFrom, mn.desc)] = renameTo
-
- log.v("Substitution found: %s%s -> %s", renameFrom, mn.desc, renameTo)
+ private fun getAnnotationField(
+ an: AnnotationNode,
+ name: String,
+ required: Boolean = true
+ ): String? {
+ try {
+ val suffix = findAnnotationValueAsString(an, name)
+ if (suffix == null && required) {
+ errors.onErrorFound("Annotation \"${an.desc}\" must have field $name")
}
+ return suffix
+ } catch (e: ClassParseException) {
+ errors.onErrorFound(e.message!!)
+ return null
}
}
- }
- /**
- * Return the (String) value of 'value' parameter from an annotation.
- */
- private fun getAnnotationField(an: AnnotationNode, name: String,
- required: Boolean = true): String? {
- try {
- val suffix = findAnnotationValueAsString(an, name)
- if (suffix == null && required) {
- errors.onErrorFound("Annotation \"${an.desc}\" must have field $name")
- }
- return suffix
- } catch (e: ClassParseException) {
- errors.onErrorFound(e.message!!)
- return null
+ /**
+ * Resolve the full class name if the class is relative
+ */
+ private fun resolveRelativeClass(
+ cn: ClassNode,
+ name: String
+ ): String {
+ val packageName = getPackageNameFromFullClassName(cn.name)
+ return resolveClassNameWithDefaultPackage(name, packageName).toJvmClassName()
}
}
companion object {
+ private const val REASON_ANNOTATION = "annotation"
+ private const val REASON_CLASS_ANNOTATION = "class-annotation"
+
/**
* Convert from human-readable type names (e.g. "com.android.TypeName") to the internal type
* names (e.g. "Lcom/android/TypeName).
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ClassWidePolicyPropagatingFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ClassWidePolicyPropagatingFilter.kt
index 47790b1..f8bb526 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ClassWidePolicyPropagatingFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ClassWidePolicyPropagatingFilter.kt
@@ -16,7 +16,6 @@
package com.android.hoststubgen.filters
import com.android.hoststubgen.asm.ClassNodes
-import com.android.hoststubgen.asm.getDirectOuterClassName
/**
* This is used as the second last fallback filter. This filter propagates the class-wide policy
@@ -24,74 +23,71 @@
*/
class ClassWidePolicyPropagatingFilter(
private val classes: ClassNodes,
- fallback: OutputFilter,
- ) : DelegatingFilter(fallback) {
+ fallback: OutputFilter
+) : DelegatingFilter(fallback) {
- private fun getClassWidePolicy(className: String, resolve: Boolean): FilterPolicyWithReason? {
+ /**
+ * We don't use ClassNode.outerClass, because it gives as the top-level
+ * outer class (A$B$C -> A), not the direct outer class (A$B$C -> A$B).
+ *
+ * Sometimes a class name includes `$`, but is not as a nested class name separator
+ * (e.g. a class name like `MyClass$$`). In this case, `MyClass$` is not actually a class.
+ *
+ * So before getting the class policy on a nonexistent class, which may cause an
+ * incorrect result, we make sure the class actually exists.
+ */
+ private fun getDirectOuterClass(className: String): String? {
var currentClass = className
-
-
- // If the class name is `a.b.c.A$B$C`, then we try to get the class wide policy
- // from a.b.c.A$B$C, then a.b.c.A$B, and then a.b.c.A.
while (true) {
- // Sometimes a class name has a `$` in it but not as a nest class name separator --
- // e.g. class name like "MyClass$$". In this case, `MyClass$` may not actually be
- // a class name.
- // So before getting the class policy on a nonexistent class, which may cause an
- // incorrect result, we make sure if className actually exists.
- if (classes.hasClass(className)) {
- outermostFilter.getPolicyForClass(className).let { policy ->
- if (policy.policy.isClassWidePolicy) {
- val p = if (resolve) {
- policy.policy.resolveClassWidePolicy()
- } else {
- policy.policy
- }
-
- return p.withReason(policy.reason)
- .wrapReason("class-wide in $currentClass")
- }
- // If the class's policy is remove, then remove it.
- if (policy.policy == FilterPolicy.Remove) {
- return FilterPolicy.Remove.withReason("class-wide in $currentClass")
- }
- }
- }
-
- // Next, look at the outer class...
- val outer = getDirectOuterClassName(currentClass)
- if (outer == null) {
+ val pos = currentClass.lastIndexOf('$')
+ if (pos < 0) {
return null
}
- currentClass = outer
+ currentClass = currentClass.substring(0, pos)
+ if (classes.hasClass(currentClass)) {
+ return currentClass
+ }
}
}
+ private fun getClassWidePolicy(className: String, resolve: Boolean): FilterPolicyWithReason? {
+ outermostFilter.getPolicyForClass(className).let { policy ->
+ if (policy.policy == FilterPolicy.KeepClass) {
+ val p = if (resolve) {
+ policy.policy.resolveClassWidePolicy()
+ } else {
+ policy.policy
+ }
+
+ return p.withReason(policy.reason)
+ .wrapReason("class-wide in $className")
+ }
+ // If the class's policy is remove, then remove it.
+ if (policy.policy == FilterPolicy.Remove) {
+ return FilterPolicy.Remove.withReason("class-wide in $className")
+ }
+ }
+ return null
+ }
+
override fun getPolicyForClass(className: String): FilterPolicyWithReason {
- // If it's a nested class, use the outer class's policy.
- getDirectOuterClassName(className)?.let { outerName ->
- getClassWidePolicy(outerName, resolve = false)?.let { policy ->
- return policy
- }
- }
-
- return super.getPolicyForClass(className)
+ // If the class name is `a.b.c.A$B$C`, then we try to get the class wide policy
+ // from a.b.c.A$B$C, then a.b.c.A$B, and then a.b.c.A, recursively
+ return getDirectOuterClass(className)?.let { getClassWidePolicy(it, resolve = false) }
+ ?: super.getPolicyForClass(className)
}
- override fun getPolicyForField(
- className: String,
- fieldName: String
- ): FilterPolicyWithReason {
+ override fun getPolicyForField(className: String, fieldName: String): FilterPolicyWithReason {
return getClassWidePolicy(className, resolve = true)
?: super.getPolicyForField(className, fieldName)
}
override fun getPolicyForMethod(
- className: String,
- methodName: String,
- descriptor: String
+ className: String,
+ methodName: String,
+ descriptor: String
): FilterPolicyWithReason {
return getClassWidePolicy(className, resolve = true)
- ?: super.getPolicyForMethod(className, methodName, descriptor)
+ ?: super.getPolicyForMethod(className, methodName, descriptor)
}
-}
\ No newline at end of file
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ConstantFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ConstantFilter.kt
index 678e6ea..be3c59c 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ConstantFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ConstantFilter.kt
@@ -26,23 +26,17 @@
* @param policy the policy. Cannot be a "substitute" policy.
*/
class ConstantFilter(
- policy: FilterPolicy,
- val reason: String
+ policy: FilterPolicy,
+ private val reason: String
) : OutputFilter() {
- val classPolicy: FilterPolicy
- val fieldPolicy: FilterPolicy
- val methodPolicy: FilterPolicy
+
+ private val classPolicy: FilterPolicy
+ private val fieldPolicy: FilterPolicy
+ private val methodPolicy: FilterPolicy
init {
- if (policy.isSubstitute) {
- throw HostStubGenInternalException(
- "ConstantFilter doesn't allow substitution policies.")
- }
- if (policy.isClassWidePolicy) {
- // We prevent it, because there's no point in using class-wide policies because
- // all members get othe same policy too anyway.
- throw HostStubGenInternalException(
- "ConstantFilter doesn't allow class-wide policies.")
+ if (!policy.isUsableWithDefault) {
+ throw HostStubGenInternalException("ConstantFilter doesn't support $policy.")
}
methodPolicy = policy
@@ -63,10 +57,10 @@
}
override fun getPolicyForMethod(
- className: String,
- methodName: String,
- descriptor: String,
- ): FilterPolicyWithReason {
+ className: String,
+ methodName: String,
+ descriptor: String,
+ ): FilterPolicyWithReason {
return methodPolicy.withReason(reason)
}
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/DelegatingFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/DelegatingFilter.kt
index cdd24e8..b8b0d8a 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/DelegatingFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/DelegatingFilter.kt
@@ -72,8 +72,8 @@
return fallback.getRenameTo(className, methodName, descriptor)
}
- override fun getNativeSubstitutionClass(className: String): String? {
- return fallback.getNativeSubstitutionClass(className)
+ override fun getRedirectionClass(className: String): String? {
+ return fallback.getRedirectionClass(className)
}
override fun getClassLoadHooks(className: String): List<String> {
@@ -87,4 +87,23 @@
): List<String> {
return fallback.getMethodCallHooks(className, methodName, descriptor)
}
+
+ override fun remapType(className: String): String? {
+ return fallback.remapType(className)
+ }
+
+ override fun hasAnyMethodCallReplace(): Boolean {
+ return fallback.hasAnyMethodCallReplace()
+ }
+
+ override fun getMethodCallReplaceTo(
+ callerClassName: String,
+ callerMethodName: String,
+ className: String,
+ methodName: String,
+ descriptor: String,
+ ): MethodReplaceTarget? {
+ return fallback.getMethodCallReplaceTo(
+ callerClassName, callerMethodName, className, methodName, descriptor)
+ }
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt
index 4d21106..2f2f81b 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt
@@ -17,37 +17,25 @@
enum class FilterPolicy {
/**
- * Keep the item in the stub jar file, so tests can use it.
- */
- Stub,
-
- /**
- * Keep the item in the impl jar file, but not in the stub file. Tests cannot use it directly,
- * but indirectly.
+ * Keep the item in the jar file.
*/
Keep,
/**
- * Only used for types. Keep the class in the stub, and also all its members.
- * But each member can have another annotations to override it.
- */
- StubClass,
-
- /**
- * Only used for types. Keep the class in the impl, not in the stub, and also all its members.
- * But each member can have another annotations to override it.
+ * Only usable with classes. Keep the class in the jar, and also all its members.
+ * Each member can have another policy to override it.
*/
KeepClass,
/**
- * Same as [Stub], but replace it with a "substitution" method. Only usable with methods.
+ * Only usable with methods. Replace a method with a "substitution" method.
*/
- SubstituteAndStub,
+ Substitute,
/**
- * Same as [Keep], but replace it with a "substitution" method. Only usable with methods.
+ * Only usable with methods. Redirect a method to a method in the substitution class.
*/
- SubstituteAndKeep,
+ Redirect,
/**
* Only usable with methods. The item will be kept in the impl jar file, but when called,
@@ -57,7 +45,7 @@
/**
* Only usable with methods. The item will be kept in the impl jar file, but when called,
- * it'll no-op. Currently only supported for methods returning `void`.
+ * it'll no-op.
*/
Ignore,
@@ -66,20 +54,19 @@
*/
Remove;
- val isSubstitute: Boolean
- get() = this == SubstituteAndStub || this == SubstituteAndKeep
-
- val needsInStub: Boolean
- get() = this == Stub || this == StubClass || this == SubstituteAndStub
-
- val needsInImpl: Boolean
- get() = this != Remove
+ val needsInOutput: Boolean
+ get() {
+ return when (this) {
+ Remove -> false
+ else -> true
+ }
+ }
/** Returns whether a policy can be used with classes */
val isUsableWithClasses: Boolean
get() {
return when (this) {
- Stub, StubClass, Keep, KeepClass, Remove -> true
+ Keep, KeepClass, Remove -> true
else -> false
}
}
@@ -88,7 +75,7 @@
val isUsableWithFields: Boolean
get() {
return when (this) {
- Stub, Keep, Remove -> true
+ Keep, Remove -> true
else -> false
}
}
@@ -97,16 +84,16 @@
val isUsableWithMethods: Boolean
get() {
return when (this) {
- StubClass, KeepClass -> false
+ KeepClass -> false
else -> true
}
}
- /** Returns whether a policy is a class-wide one. */
- val isClassWidePolicy: Boolean
+ /** Returns whether a policy can be used as default policy. */
+ val isUsableWithDefault: Boolean
get() {
return when (this) {
- StubClass, KeepClass -> true
+ Keep, Throw, Remove -> true
else -> false
}
}
@@ -115,26 +102,24 @@
val isSupported: Boolean
get() {
return when (this) {
- // TODO: handle native method with no substitution as being unsupported
- Stub, StubClass, Keep, KeepClass, SubstituteAndStub, SubstituteAndKeep -> true
+ Keep, KeepClass, Substitute, Redirect -> true
else -> false
}
}
- fun getSubstitutionBasePolicy(): FilterPolicy {
- return when (this) {
- SubstituteAndKeep -> Keep
- SubstituteAndStub -> Stub
- else -> this
+ val isMethodRewriteBody: Boolean
+ get() {
+ return when (this) {
+ Redirect, Throw, Ignore -> true
+ else -> false
+ }
}
- }
/**
- * Convert {Stub,Keep}Class to the corresponding Stub or Keep.
+ * Convert KeepClass to Keep, or return itself.
*/
fun resolveClassWidePolicy(): FilterPolicy {
return when (this) {
- StubClass -> Stub
KeepClass -> Keep
else -> this
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicyWithReason.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicyWithReason.kt
index eb03f66..b10165b 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicyWithReason.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicyWithReason.kt
@@ -30,36 +30,6 @@
return FilterPolicyWithReason(policy, "$reason [inner-reason: ${this.reason}]")
}
- /**
- * If the visibility is lower than "Keep" (meaning if it's "remove"),
- * then return a new [FilterPolicy] with "Keep".
- * Otherwise, return itself
- */
- fun promoteToKeep(promotionReason: String): FilterPolicyWithReason {
- if (policy.needsInImpl) {
- return this
- }
- val newPolicy = if (policy.isClassWidePolicy) FilterPolicy.KeepClass else FilterPolicy.Keep
-
- return FilterPolicyWithReason(newPolicy,
- "$promotionReason [original remove reason: ${this.reason}]")
- }
-
- /**
- * If the visibility is above "Keep" (meaning if it's "stub"),
- * then return a new [FilterPolicy] with "Keep".
- * Otherwise, return itself
- */
- fun demoteToKeep(promotionReason: String): FilterPolicyWithReason {
- if (!policy.needsInStub) {
- return this
- }
- val newPolicy = if (policy.isClassWidePolicy) FilterPolicy.KeepClass else FilterPolicy.Keep
-
- return FilterPolicyWithReason(newPolicy,
- "$promotionReason [original stub reason: ${this.reason}]")
- }
-
override fun toString(): String {
return "[$policy - reason: $reason]"
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt
new file mode 100644
index 0000000..c5a2f9f
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.filters
+
+import org.objectweb.asm.commons.Remapper
+
+/**
+ * A [Remapper] that uses [OutputFilter.remapType]
+ */
+class FilterRemapper(val filter: OutputFilter) : Remapper() {
+ private val cache = mutableMapOf<String, String>()
+
+ override fun mapType(typeInternalName: String?): String? {
+ if (typeInternalName == null) {
+ return null
+ }
+
+ cache[typeInternalName]?.let {
+ return it
+ }
+
+ var mapped = filter.remapType(typeInternalName) ?: typeInternalName
+ cache[typeInternalName] = mapped
+ return mapped
+ }
+
+ // TODO Do we need to implement mapPackage(), etc too?
+}
\ No newline at end of file
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 5a26fc6..474da6d 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ImplicitOutputFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/ImplicitOutputFilter.kt
@@ -25,7 +25,6 @@
import com.android.hoststubgen.asm.isAutoGeneratedEnumMember
import com.android.hoststubgen.asm.isEnum
import com.android.hoststubgen.asm.isSynthetic
-import com.android.hoststubgen.asm.isVisibilityPrivateOrPackagePrivate
import com.android.hoststubgen.log
import org.objectweb.asm.tree.ClassNode
@@ -53,7 +52,7 @@
}
// If the outer class needs to be in impl, it should be in impl too.
val outerPolicy = outermostFilter.getPolicyForClass(cn.outerClass)
- if (outerPolicy.policy.needsInImpl) {
+ if (outerPolicy.policy.needsInOutput) {
return FilterPolicy.KeepClass.withReason("anonymous-inner-class")
}
}
@@ -79,19 +78,6 @@
val fallback = super.getPolicyForMethod(className, methodName, descriptor)
val classPolicy = outermostFilter.getPolicyForClass(className)
- // If the class is in the stub, then we need to put the private constructor in the stub too,
- // to prevent the class from getting instantiated.
- if (classPolicy.policy.needsInStub &&
- !fallback.policy.needsInStub &&
- (methodName == "<init>") && // Constructor?
- (descriptor == "()V")) { // Has zero parameters?
- classes.findMethod(className, methodName, descriptor)?.let { mn ->
- if (isVisibilityPrivateOrPackagePrivate(mn.access)) {
- return FilterPolicy.Stub.withReason("private constructor in stub class")
- }
- }
- }
-
val cn = classes.getClass(className)
// If we throw from the static initializer, the class would be useless, so we convert it
@@ -107,7 +93,7 @@
}
log.d("Class ${cn.name} Class policy: $classPolicy")
- if (classPolicy.policy.needsInImpl) {
+ if (classPolicy.policy.needsInOutput) {
// Do it only when the class needs to be kept...
// Member policy should be "keep" or "stub".
@@ -152,7 +138,7 @@
val classPolicy = outermostFilter.getPolicyForClass(className)
log.d("Class ${cn.name} Class policy: $classPolicy")
- if (classPolicy.policy.needsInImpl) {
+ if (classPolicy.policy.needsInOutput) {
// Do it only when the class needs to be kept...
// Member policy should be "keep" or "stub".
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/InMemoryOutputFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/InMemoryOutputFilter.kt
index 2e144f5..59fa464 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/InMemoryOutputFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/InMemoryOutputFilter.kt
@@ -19,6 +19,7 @@
import com.android.hoststubgen.asm.ClassNodes
import com.android.hoststubgen.asm.toHumanReadableClassName
import com.android.hoststubgen.asm.toHumanReadableMethodName
+import com.android.hoststubgen.asm.toJvmClassName
import com.android.hoststubgen.log
// TODO: Validate all input names.
@@ -29,7 +30,7 @@
) : DelegatingFilter(fallback) {
private val mPolicies: MutableMap<String, FilterPolicyWithReason> = mutableMapOf()
private val mRenames: MutableMap<String, String> = mutableMapOf()
- private val mNativeSubstitutionClasses: MutableMap<String, String> = mutableMapOf()
+ private val mRedirectionClasses: MutableMap<String, String> = mutableMapOf()
private val mClassLoadHooks: MutableMap<String, String> = mutableMapOf()
private fun getClassKey(className: String): String {
@@ -115,17 +116,17 @@
mRenames[getMethodKey(className, methodName, descriptor)] = toName
}
- override fun getNativeSubstitutionClass(className: String): String? {
- return mNativeSubstitutionClasses[getClassKey(className)]
- ?: super.getNativeSubstitutionClass(className)
+ override fun getRedirectionClass(className: String): String? {
+ return mRedirectionClasses[getClassKey(className)]
+ ?: super.getRedirectionClass(className)
}
- fun setNativeSubstitutionClass(from: String, to: String) {
+ fun setRedirectionClass(from: String, to: String) {
checkClass(from)
- // Native substitute classes may be provided from other jars, so we can't do this check.
+ // Redirection classes may be provided from other jars, so we can't do this check.
// ensureClassExists(to)
- mNativeSubstitutionClasses[getClassKey(from)] = to.toHumanReadableClassName()
+ mRedirectionClasses[getClassKey(from)] = to.toJvmClassName()
}
override fun getClassLoadHooks(className: String): List<String> {
@@ -136,4 +137,4 @@
fun setClassLoadHook(className: String, methodName: String) {
mClassLoadHooks[getClassKey(className)] = methodName.toHumanReadableMethodName()
}
-}
\ No newline at end of file
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/KeepNativeFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/KeepNativeFilter.kt
new file mode 100644
index 0000000..00e7d77
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/KeepNativeFilter.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.filters
+
+import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.isNative
+
+/**
+ * For native methods that weren't handled by outer filters, we keep it so that
+ * native method registration will not crash at runtime. Ideally we shouldn't need
+ * this, but in practice unsupported native method registrations do occur.
+ */
+class KeepNativeFilter(
+ private val classes: ClassNodes,
+ fallback: OutputFilter
+) : DelegatingFilter(fallback) {
+ override fun getPolicyForMethod(
+ className: String,
+ methodName: String,
+ descriptor: String,
+ ): FilterPolicyWithReason {
+ return classes.findMethod(className, methodName, descriptor)?.let { mn ->
+ if (mn.isNative()) {
+ FilterPolicy.Keep.withReason("native-preserve")
+ } else {
+ null
+ }
+ } ?: super.getPolicyForMethod(className, methodName, descriptor)
+ }
+}
\ No newline at end of file
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/OutputFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/OutputFilter.kt
index 3df16ff..f99ce90 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/OutputFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/OutputFilter.kt
@@ -35,10 +35,6 @@
* using it.
*/
open var outermostFilter: OutputFilter = this
- get() = field
- set(value) {
- field = value
- }
abstract fun getPolicyForClass(className: String): FilterPolicyWithReason
@@ -60,13 +56,13 @@
}
/**
- * Return a "native substitution class" name for a given class.
+ * Return a "redirection class" name for a given class.
*
- * The result will be in a "human readable" form. (e.g. uses '.'s instead of '/'s)
+ * The result will be in a JVM internal form. (e.g. uses '/'s instead of '.'s)
*
- * (which corresponds to @HostSideTestNativeSubstitutionClass of the standard annotations.)
+ * (which corresponds to @HostSideTestRedirectClass of the standard annotations.)
*/
- open fun getNativeSubstitutionClass(className: String): String? {
+ open fun getRedirectionClass(className: String): String? {
return null
}
@@ -89,4 +85,35 @@
List<String> {
return emptyList()
}
-}
\ No newline at end of file
+
+ /**
+ * Take a class (internal) name. If the class needs to be renamed, return the new name.
+ * This is used by [FilterRemapper].
+ */
+ open fun remapType(className: String): String? {
+ return null
+ }
+
+ data class MethodReplaceTarget(val className: String, val methodName: String)
+
+ /**
+ * Return if this filter may return non-null from [getMethodCallReplaceTo].
+ * (Used for a small optimization)
+ */
+ open fun hasAnyMethodCallReplace(): Boolean {
+ return false
+ }
+
+ /**
+ * If a method call should be forwarded to another method, return the target's class / method.
+ */
+ open fun getMethodCallReplaceTo(
+ callerClassName: String,
+ callerMethodName: String,
+ className: String,
+ methodName: String,
+ descriptor: String,
+ ): MethodReplaceTarget? {
+ return null
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/SanitizationFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/SanitizationFilter.kt
new file mode 100644
index 0000000..18a1e16
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/SanitizationFilter.kt
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.filters
+
+import com.android.hoststubgen.HostStubGenErrors
+import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.toHumanReadableClassName
+import com.android.hoststubgen.log
+
+/**
+ * Check whether the policies in the inner layers make sense, and sanitize the results.
+ */
+class SanitizationFilter(
+ private val errors: HostStubGenErrors,
+ private val classes: ClassNodes,
+ fallback: OutputFilter
+) : DelegatingFilter(fallback) {
+ override fun getPolicyForMethod(
+ className: String,
+ methodName: String,
+ descriptor: String
+ ): FilterPolicyWithReason {
+ val policy = super.getPolicyForMethod(className, methodName, descriptor)
+ if (policy.policy == FilterPolicy.Redirect) {
+ // Check whether the hosting class has a redirection class
+ if (getRedirectionClass(className) == null) {
+ errors.onErrorFound("Method $methodName$descriptor requires a redirection " +
+ "class set on ${className.toHumanReadableClassName()}")
+ }
+ }
+ return policy
+ }
+
+ override fun getRedirectionClass(className: String): String? {
+ return super.getRedirectionClass(className)?.also { clazz ->
+ if (classes.findClass(clazz) == null) {
+ log.w("Redirection class $clazz not found. Class must be available at runtime.")
+ } else if (outermostFilter.getPolicyForClass(clazz).policy != FilterPolicy.KeepClass) {
+ // If the class exists, it must have a KeepClass policy.
+ errors.onErrorFound("Redirection class $clazz must have @KeepWholeClass.")
+ }
+ }
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/StubIntersectingFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/StubIntersectingFilter.kt
deleted file mode 100644
index f92a027..0000000
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/StubIntersectingFilter.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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 com.android.hoststubgen.filters
-
-import com.android.hoststubgen.HostStubGenErrors
-import com.android.hoststubgen.asm.ClassNodes
-
-private const val REASON = "demoted, not in intersect jars"
-
-/**
- * An [OutputFilter] that will restrict what to put in stub to only what shows up in "intersecting
- * jar" files.
- *
- * For example, if the Android public API stub jar is provided, then the HostStubGen's output
- * stub will be restricted to public APIs.
- */
-class StubIntersectingFilter(
- private val errors: HostStubGenErrors,
- /**
- * If a class / field / method is not in any of these jars, then we will not put it in
- * stub.
- */
- private val intersectingJars: Map<String, ClassNodes>,
- fallback: OutputFilter,
-) : DelegatingFilter(fallback) {
- private inline fun exists(predicate: (ClassNodes) -> Boolean): Boolean {
- intersectingJars.forEach { entry ->
- if (predicate(entry.value)) {
- return true
- }
- }
- return false
- }
-
- /**
- * If [origPolicy] is less than "Stub", then return it as-is.
- *
- * Otherwise, call [inStubChecker] to see if the API is in any of [intersectingJars].
- * If yes, then return [origPolicy] as-is. Otherwise, demote to "Keep".
- */
- private fun intersectWithStub(
- origPolicy: FilterPolicyWithReason,
- inStubChecker: () -> Boolean,
- ): FilterPolicyWithReason {
- if (origPolicy.policy.needsInStub) {
- // Only check the stub jars, when the class is supposed to be in stub otherwise.
- if (!inStubChecker()) {
- return origPolicy.demoteToKeep(REASON)
- }
- }
- return origPolicy
- }
-
- override fun getPolicyForClass(className: String): FilterPolicyWithReason {
- return intersectWithStub(super.getPolicyForClass(className)) {
- exists { classes -> classes.findClass(className) != null }
- }
- }
-
- override fun getPolicyForField(
- className: String,
- fieldName: String
- ): FilterPolicyWithReason {
- return intersectWithStub(super.getPolicyForField(className, fieldName)) {
- exists { classes -> classes.findField(className, fieldName) != null }
- }
- }
-
- override fun getPolicyForMethod(
- className: String,
- methodName: String,
- descriptor: String
- ): FilterPolicyWithReason {
- return intersectWithStub(super.getPolicyForMethod(className, methodName, descriptor)) {
- exists { classes -> classes.findMethod(className, methodName, descriptor) != null }
- }
- }
-}
\ No newline at end of file
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt
index 1828003..073b503 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt
@@ -17,12 +17,13 @@
import com.android.hoststubgen.ParseException
import com.android.hoststubgen.asm.ClassNodes
+import com.android.hoststubgen.asm.splitWithLastPeriod
import com.android.hoststubgen.asm.toHumanReadableClassName
+import com.android.hoststubgen.asm.toJvmClassName
import com.android.hoststubgen.log
import com.android.hoststubgen.normalizeTextLine
import com.android.hoststubgen.whitespaceRegex
import org.objectweb.asm.Opcodes
-import org.objectweb.asm.commons.Remapper
import org.objectweb.asm.tree.ClassNode
import java.io.BufferedReader
import java.io.FileReader
@@ -62,7 +63,7 @@
filename: String,
classes: ClassNodes,
fallback: OutputFilter,
- ): Pair<OutputFilter, Remapper?> {
+ ): OutputFilter {
log.i("Loading offloaded annotations from $filename ...")
log.withIndent {
val subclassFilter = SubclassFilter(classes, fallback)
@@ -75,7 +76,9 @@
var featureFlagsPolicy: FilterPolicyWithReason? = null
var syspropsPolicy: FilterPolicyWithReason? = null
var rFilePolicy: FilterPolicyWithReason? = null
- val typeRenameSpec = mutableListOf<TextFilePolicyRemapper.TypeRenameSpec>()
+ val typeRenameSpec = mutableListOf<TextFilePolicyRemapperFilter.TypeRenameSpec>()
+ val methodReplaceSpec =
+ mutableListOf<TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec>()
try {
BufferedReader(FileReader(filename)).use { reader ->
@@ -139,9 +142,9 @@
throw ParseException(
"Special class can't have a substitution")
}
- // It's a native-substitution.
+ // It's a redirection class.
val toClass = fields[2].substring(1)
- imf.setNativeSubstitutionClass(className, toClass)
+ imf.setRedirectionClass(className, toClass)
} else if (fields[2].startsWith("~")) {
if (classType != SpecialClass.NotSpecial) {
// We could support it, but not needed at least for now.
@@ -237,7 +240,7 @@
imf.setPolicyForMethod(className, name, signature,
policy.withReason(FILTER_REASON))
- if (policy.isSubstitute) {
+ if (policy == FilterPolicy.Substitute) {
val fromName = fields[3].substring(1)
if (fromName == name) {
@@ -245,13 +248,28 @@
"Substitution must have a different name")
}
- // Set the policy for the "from" method.
+ // Set the policy for the "from" method.
imf.setPolicyForMethod(className, fromName, signature,
- policy.getSubstitutionBasePolicy()
- .withReason(FILTER_REASON))
+ FilterPolicy.Keep.withReason(FILTER_REASON))
- // Keep "from" -> "to" mapping.
- imf.setRenameTo(className, fromName, signature, name)
+ val classAndMethod = splitWithLastPeriod(fromName)
+ if (classAndMethod != null) {
+ // If the substitution target contains a ".", then
+ // it's a method call redirect.
+ methodReplaceSpec.add(
+ TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec(
+ className.toJvmClassName(),
+ name,
+ signature,
+ classAndMethod.first.toJvmClassName(),
+ classAndMethod.second,
+ )
+ )
+ } else {
+ // It's an in-class replace.
+ // ("@RavenwoodReplace" equivalent)
+ imf.setRenameTo(className, fromName, signature, name)
+ }
}
}
"r", "rename" -> {
@@ -267,7 +285,7 @@
// applied. (Which is needed for services.jar)
val prefix = fields[2].trimStart('/')
- typeRenameSpec += TextFilePolicyRemapper.TypeRenameSpec(
+ typeRenameSpec += TextFilePolicyRemapperFilter.TypeRenameSpec(
pattern, prefix)
}
@@ -281,16 +299,19 @@
throw e.withSourceInfo(filename, lineNo)
}
- var remapper: TextFilePolicyRemapper? = null
+ var ret: OutputFilter = imf
if (typeRenameSpec.isNotEmpty()) {
- remapper = TextFilePolicyRemapper(typeRenameSpec)
+ ret = TextFilePolicyRemapperFilter(typeRenameSpec, ret)
+ }
+ if (methodReplaceSpec.isNotEmpty()) {
+ ret = TextFilePolicyMethodReplaceFilter(methodReplaceSpec, classes, ret)
}
// Wrap the in-memory-filter with AHF.
- return Pair(
- AndroidHeuristicsFilter(
- classes, aidlPolicy, featureFlagsPolicy, syspropsPolicy, rFilePolicy, imf),
- remapper)
+ ret = AndroidHeuristicsFilter(
+ classes, aidlPolicy, featureFlagsPolicy, syspropsPolicy, rFilePolicy, ret)
+
+ return ret
}
}
@@ -324,17 +345,15 @@
private fun parsePolicy(s: String): FilterPolicy {
return when (s.lowercase()) {
- "s", "stub" -> FilterPolicy.Stub
"k", "keep" -> FilterPolicy.Keep
"t", "throw" -> FilterPolicy.Throw
"r", "remove" -> FilterPolicy.Remove
- "sc", "stubclass" -> FilterPolicy.StubClass
"kc", "keepclass" -> FilterPolicy.KeepClass
+ "i", "ignore" -> FilterPolicy.Ignore
+ "rdr", "redirect" -> FilterPolicy.Redirect
else -> {
if (s.startsWith("@")) {
- FilterPolicy.SubstituteAndStub
- } else if (s.startsWith("%")) {
- FilterPolicy.SubstituteAndKeep
+ FilterPolicy.Substitute
} else {
throw ParseException("Invalid policy \"$s\"")
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyMethodReplaceFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyMethodReplaceFilter.kt
new file mode 100644
index 0000000..d45f414
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyMethodReplaceFilter.kt
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.filters
+
+import com.android.hoststubgen.asm.ClassNodes
+
+/**
+ * Filter used by TextFileFilterPolicyParser for "method call relacement".
+ */
+class TextFilePolicyMethodReplaceFilter(
+ val spec: List<MethodCallReplaceSpec>,
+ val classes: ClassNodes,
+ val fallback: OutputFilter,
+) : DelegatingFilter(fallback) {
+
+ data class MethodCallReplaceSpec(
+ val fromClass: String,
+ val fromMethod: String,
+ val fromDescriptor: String,
+ val toClass: String,
+ val toMethod: String,
+ )
+
+ override fun hasAnyMethodCallReplace(): Boolean {
+ return true
+ }
+
+ override fun getMethodCallReplaceTo(
+ callerClassName: String,
+ callerMethodName: String,
+ className: String,
+ methodName: String,
+ descriptor: String,
+ ): MethodReplaceTarget? {
+ // Maybe use 'Tri' if we end up having too many replacements.
+ spec.forEach {
+ if (className == it.fromClass &&
+ methodName == it.fromMethod &&
+ descriptor == it.fromDescriptor
+ ) {
+ return MethodReplaceTarget(it.toClass, it.toMethod)
+ }
+ }
+ return null
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapper.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapper.kt
deleted file mode 100644
index 2d94bb4..0000000
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapper.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2024 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 com.android.hoststubgen.filters
-
-import com.android.hoststubgen.log
-import org.objectweb.asm.commons.Remapper
-import java.util.regex.Pattern
-
-/**
- * A [Remapper] that provides a simple "jarjar" functionality.
- */
-class TextFilePolicyRemapper(
- val typeRenameSpecs: List<TypeRenameSpec>
-) : Remapper() {
- /**
- * When a package name matches [typeInternalNamePattern], we prepend [typeInternalNamePrefix]
- * to it.
- */
- data class TypeRenameSpec(
- val typeInternalNamePattern: Pattern,
- val typeInternalNamePrefix: String,
- )
-
- private val cache = mutableMapOf<String, String>()
-
- override fun mapType(typeInternalName: String): String {
-// if (typeInternalName == null) {
-// return null // do we need it??
-// }
- cache[typeInternalName]?.let {
- return it
- }
-
- var mapped: String = typeInternalName
- typeRenameSpecs.forEach {
- if (it.typeInternalNamePattern.matcher(typeInternalName).matches()) {
- mapped = it.typeInternalNamePrefix + typeInternalName
- log.d("Renaming type $typeInternalName to $mapped")
- }
- }
- cache[typeInternalName] = mapped
- return mapped
- }
-
- // TODO Do we need to implement mapPackage(), etc too?
-}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt
new file mode 100644
index 0000000..a78c655
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.filters
+
+import com.android.hoststubgen.log
+import java.util.regex.Pattern
+
+/**
+ * A filter that provides a simple "jarjar" functionality via [mapType]
+ */
+class TextFilePolicyRemapperFilter(
+ val typeRenameSpecs: List<TypeRenameSpec>,
+ fallback: OutputFilter,
+) : DelegatingFilter(fallback) {
+ /**
+ * When a package name matches [typeInternalNamePattern], we prepend [typeInternalNamePrefix]
+ * to it.
+ */
+ data class TypeRenameSpec(
+ val typeInternalNamePattern: Pattern,
+ val typeInternalNamePrefix: String,
+ )
+
+ private val cache = mutableMapOf<String, String>()
+
+ override fun remapType(className: String): String? {
+ var mapped: String = className
+ typeRenameSpecs.forEach {
+ if (it.typeInternalNamePattern.matcher(className).matches()) {
+ mapped = it.typeInternalNamePrefix + className
+ log.d("Renaming type $className to $mapped")
+ }
+ }
+ cache[className] = mapped
+ return mapped
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/ClassFilter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/ClassFilter.kt
index 01a7ab3..d6aa761 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/ClassFilter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/utils/ClassFilter.kt
@@ -24,19 +24,25 @@
/**
* General purpose filter for class names.
*/
-class ClassFilter private constructor (
- val defaultResult: Boolean,
+class ClassFilter private constructor(
+ private val defaultResult: Boolean,
) {
- private data class FilterElement(
- val allowed: Boolean,
- val internalName: String,
- val isPrefix: Boolean,
+ private enum class MatchType {
+ Full,
+ Prefix,
+ Suffix,
+ }
+
+ private class FilterElement(
+ val allowed: Boolean,
+ val internalName: String,
+ val matchType: MatchType,
) {
fun matches(classInternalName: String): Boolean {
- if (isPrefix) {
- return classInternalName.startsWith(internalName)
- } else {
- return classInternalName == internalName
+ return when (matchType) {
+ MatchType.Full -> classInternalName == internalName
+ MatchType.Prefix -> classInternalName.startsWith(internalName)
+ MatchType.Suffix -> classInternalName.endsWith(internalName)
}
}
}
@@ -54,15 +60,16 @@
return it
}
- var result = defaultResult
- run outer@{
- elements.forEach { e ->
- if (e.matches(classInternalName)) {
- result = e.allowed
- return@outer // break equivalent.
- }
+ val testClasses = sequence {
+ // Yield itself and its outer class(es) one by one
+ var idx = classInternalName.length
+ while (idx > 0) {
+ yield(classInternalName.substring(0, idx))
+ idx = classInternalName.lastIndexOf('$', idx - 1)
}
}
+
+ val result = elements.find { testClasses.any(it::matches) }?.allowed ?: defaultResult
cache[classInternalName] = result
return result
@@ -87,9 +94,9 @@
/** Build a filter from a string (for unit tests). */
fun buildFromString(
- filterString: String,
- defaultResult: Boolean,
- filenameForErrorMessage: String
+ filterString: String,
+ defaultResult: Boolean,
+ filenameForErrorMessage: String
): ClassFilter {
val ret = ClassFilter(defaultResult)
@@ -113,29 +120,46 @@
// Special case -- matches any class names.
if (line == "*") {
- ret.elements.add(FilterElement(allow, "", true))
+ ret.elements.add(FilterElement(allow, "", MatchType.Prefix))
return@forEach
}
- // Handle wildcard -- e.g. "package.name.*"
+ // Handle prefix match -- e.g. "package.name.*"
if (line.endsWith(".*")) {
- ret.elements.add(FilterElement(
- allow, line.substring(0, line.length - 2).toJvmClassName(), true))
+ ret.elements.add(
+ FilterElement(
+ allow,
+ line.substring(0, line.length - 2).toJvmClassName() + "/",
+ MatchType.Prefix
+ )
+ )
+ return@forEach
+ }
+
+ // Handle suffix match -- e.g. "*.Flags"
+ if (line.startsWith("*.")) {
+ ret.elements.add(
+ FilterElement(
+ allow,
+ "/" + line.substring(2, line.length).toJvmClassName(),
+ MatchType.Suffix
+ )
+ )
return@forEach
}
// Any other uses of "*" would be an error.
if (line.contains('*')) {
throw ParseException(
- "Wildcard (*) can only show up as the last element",
- filenameForErrorMessage,
- lineNo
+ "Wildcard (*) can only show up as the last element",
+ filenameForErrorMessage,
+ lineNo
)
}
- ret.elements.add(FilterElement(allow, line.toJvmClassName(), false))
+ ret.elements.add(FilterElement(allow, line.toJvmClassName(), MatchType.Suffix))
}
return ret
}
}
-}
\ No newline at end of file
+}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt
index bad0449..261ef59c 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BaseAdapter.kt
@@ -21,103 +21,64 @@
import com.android.hoststubgen.asm.ClassNodes
import com.android.hoststubgen.asm.UnifiedVisitor
import com.android.hoststubgen.asm.getPackageNameFromFullClassName
-import com.android.hoststubgen.asm.resolveClassNameWithDefaultPackage
-import com.android.hoststubgen.asm.toJvmClassName
import com.android.hoststubgen.filters.FilterPolicy
import com.android.hoststubgen.filters.FilterPolicyWithReason
import com.android.hoststubgen.filters.OutputFilter
-import com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-import com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+import com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
import com.android.hoststubgen.log
+import java.io.PrintWriter
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.FieldVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.commons.ClassRemapper
-import org.objectweb.asm.commons.Remapper
import org.objectweb.asm.util.TraceClassVisitor
-import java.io.PrintWriter
-val OPCODE_VERSION = Opcodes.ASM9
+const val OPCODE_VERSION = Opcodes.ASM9
-abstract class BaseAdapter (
- protected val classes: ClassNodes,
- nextVisitor: ClassVisitor,
- protected val filter: OutputFilter,
- protected val options: Options,
+abstract class BaseAdapter(
+ protected val classes: ClassNodes,
+ nextVisitor: ClassVisitor,
+ protected val filter: OutputFilter,
+ protected val options: Options,
) : ClassVisitor(OPCODE_VERSION, nextVisitor) {
/**
* Options to control the behavior.
*/
- data class Options (
- val errors: HostStubGenErrors,
- val stats: HostStubGenStats?,
- val enablePreTrace: Boolean,
- val enablePostTrace: Boolean,
- val enableNonStubMethodCallDetection: Boolean,
- )
+ data class Options(
+ val errors: HostStubGenErrors,
+ val stats: HostStubGenStats?,
+ val enablePreTrace: Boolean,
+ val enablePostTrace: Boolean
+ )
protected lateinit var currentPackageName: String
protected lateinit var currentClassName: String
- protected var nativeSubstitutionClass: String? = null
+ protected var redirectionClass: String? = null
protected lateinit var classPolicy: FilterPolicyWithReason
- /**
- * Return whether an item with a given policy should be included in the output.
- */
- protected abstract fun shouldEmit(policy: FilterPolicy): Boolean
-
- /**
- * Inject [HostStubGenKeptInStub] and [HostStubGenKeptInImpl] as needed to an item.
- */
- protected fun injectInStubAndKeepAnnotations(policy: FilterPolicy, v: UnifiedVisitor) {
- if (policy.needsInStub) {
- v.visitAnnotation(HostStubGenKeptInStub.CLASS_DESCRIPTOR, true)
- }
- if (policy.needsInImpl) {
- v.visitAnnotation(HostStubGenKeptInImpl.CLASS_DESCRIPTOR, true)
- }
- }
-
override fun visit(
- version: Int,
- access: Int,
- name: String,
- signature: String?,
- superName: String?,
- interfaces: Array<String>,
+ version: Int,
+ access: Int,
+ name: String,
+ signature: String?,
+ superName: String?,
+ interfaces: Array<String>,
) {
super.visit(version, access, name, signature, superName, interfaces)
currentClassName = name
currentPackageName = getPackageNameFromFullClassName(name)
classPolicy = filter.getPolicyForClass(currentClassName)
+ redirectionClass = filter.getRedirectionClass(currentClassName)
log.d("[%s] visit: %s (package: %s)", this.javaClass.simpleName, name, currentPackageName)
log.indent()
log.v("Emitting class: %s", name)
log.indent()
- filter.getNativeSubstitutionClass(currentClassName)?.let { className ->
- val fullClassName = resolveClassNameWithDefaultPackage(className, currentPackageName)
- .toJvmClassName()
- log.d(" NativeSubstitutionClass: $fullClassName")
- if (classes.findClass(fullClassName) == null) {
- log.w("Native substitution class $fullClassName not found. Class must be " +
- "available at runtime.")
- } else {
- // If the class exists, it must have a KeepClass policy.
- if (filter.getPolicyForClass(fullClassName).policy != FilterPolicy.KeepClass) {
- // TODO: Use real annotation name.
- options.errors.onErrorFound(
- "Native substitution class $fullClassName should have @Keep.")
- }
- }
-
- nativeSubstitutionClass = fullClassName
- }
// Inject annotations to generated classes.
- injectInStubAndKeepAnnotations(classPolicy.policy, UnifiedVisitor.on(this))
+ UnifiedVisitor.on(this).visitAnnotation(HostStubGenProcessedAsKeep.CLASS_DESCRIPTOR, true)
}
override fun visitEnd() {
@@ -141,11 +102,11 @@
}
override fun visitField(
- access: Int,
- name: String,
- descriptor: String,
- signature: String?,
- value: Any?,
+ access: Int,
+ name: String,
+ descriptor: String,
+ signature: String?,
+ value: Any?,
): FieldVisitor? {
if (skipMemberModificationNestCount > 0) {
return super.visitField(access, name, descriptor, signature, value)
@@ -154,7 +115,7 @@
log.d("visitField: %s %s [%x] Policy: %s", name, descriptor, access, policy)
log.withIndent {
- if (!shouldEmit(policy.policy)) {
+ if (policy.policy == FilterPolicy.Remove) {
log.d("Removing %s %s", name, policy)
return null
}
@@ -162,18 +123,19 @@
log.v("Emitting field: %s %s %s", name, descriptor, policy)
val ret = super.visitField(access, name, descriptor, signature, value)
- injectInStubAndKeepAnnotations(policy.policy, UnifiedVisitor.on(ret))
+ UnifiedVisitor.on(ret)
+ .visitAnnotation(HostStubGenProcessedAsKeep.CLASS_DESCRIPTOR, true)
return ret
}
}
override fun visitMethod(
- access: Int,
- name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
+ access: Int,
+ name: String,
+ descriptor: String,
+ signature: String?,
+ exceptions: Array<String>?,
): MethodVisitor? {
if (skipMemberModificationNestCount > 0) {
return super.visitMethod(access, name, descriptor, signature, exceptions)
@@ -187,11 +149,11 @@
// Instead of this method, we rename the substitute-to method with the original
// name, in the "Maybe rename the method" part below.
val policy = filter.getPolicyForMethod(currentClassName, name, descriptor)
- if (policy.policy.isSubstitute) {
+ if (policy.policy == FilterPolicy.Substitute) {
log.d("Skipping %s%s %s", name, descriptor, policy)
return null
}
- if (!shouldEmit(p.policy)) {
+ if (p.policy == FilterPolicy.Remove) {
log.d("Removing %s%s %s", name, descriptor, policy)
return null
}
@@ -209,13 +171,16 @@
// `name` is the name of the method we're currently visiting, so it's usually a
// "...$ravewnwood" name.
newAccess = checkSubstitutionMethodCompatibility(
- classes, currentClassName, newName, name, descriptor, options.errors)
+ classes, currentClassName, newName, name, descriptor, options.errors
+ )
if (newAccess == NOT_COMPATIBLE) {
return null
}
- log.v("Emitting %s.%s%s as %s %s", currentClassName, name, descriptor,
- newName, policy)
+ log.v(
+ "Emitting %s.%s%s as %s %s", currentClassName, name, descriptor,
+ newName, policy
+ )
} else {
log.v("Emitting method: %s%s %s", name, descriptor, policy)
newName = name
@@ -225,14 +190,17 @@
// But note, we only use it when calling the super's method,
// but not for visitMethodInner(), because when subclass wants to change access,
// it can do so inside visitMethodInner().
- newAccess = updateAccessFlags(newAccess, name, descriptor)
+ newAccess = updateAccessFlags(newAccess, name, descriptor, policy.policy)
- val ret = visitMethodInner(access, newName, descriptor, signature, exceptions, policy,
+ val ret = visitMethodInner(
+ access, newName, descriptor, signature, exceptions, policy,
renameTo != null,
- super.visitMethod(newAccess, newName, descriptor, signature, exceptions))
+ super.visitMethod(newAccess, newName, descriptor, signature, exceptions)
+ )
ret?.let {
- injectInStubAndKeepAnnotations(policy.policy, UnifiedVisitor.on(ret))
+ UnifiedVisitor.on(ret)
+ .visitAnnotation(HostStubGenProcessedAsKeep.CLASS_DESCRIPTOR, true)
}
return ret
@@ -240,9 +208,10 @@
}
open fun updateAccessFlags(
- access: Int,
- name: String,
- descriptor: String,
+ access: Int,
+ name: String,
+ descriptor: String,
+ policy: FilterPolicy,
): Int {
return access
}
@@ -256,7 +225,7 @@
policy: FilterPolicyWithReason,
substituted: Boolean,
superVisitor: MethodVisitor?,
- ): MethodVisitor?
+ ): MethodVisitor?
companion object {
fun getVisitor(
@@ -265,8 +234,6 @@
nextVisitor: ClassVisitor,
filter: OutputFilter,
packageRedirector: PackageRedirectRemapper,
- remapper: Remapper?,
- forImpl: Boolean,
options: Options,
): ClassVisitor {
var next = nextVisitor
@@ -289,23 +256,20 @@
if (!packageRedirector.isTarget(classInternalName)) {
next = ClassRemapper(next, packageRedirector)
} else {
- log.v("Class $classInternalName is a redirect-from class, not applying" +
- " --package-redirect")
+ log.v(
+ "Class $classInternalName is a redirect-from class, not applying" +
+ " --package-redirect"
+ )
}
}
- var ret: ClassVisitor
- if (forImpl) {
- ret = ImplGeneratingAdapter(classes, next, filter, options)
- } else {
- ret = StubGeneratingAdapter(classes, next, filter, options)
- }
+ next = ImplGeneratingAdapter(classes, next, filter, options)
// Inject TraceClassVisitor for debugging.
if (options.enablePreTrace) {
- ret = TraceClassVisitor(ret, verbosePrinter)
+ next = TraceClassVisitor(next, verbosePrinter)
}
- return ret
+ return next
}
}
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BodyReplacingMethodVisitor.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BodyReplacingMethodVisitor.kt
index 8250412..55d0c0e 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BodyReplacingMethodVisitor.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/BodyReplacingMethodVisitor.kt
@@ -20,38 +20,23 @@
import org.objectweb.asm.Handle
import org.objectweb.asm.Label
import org.objectweb.asm.MethodVisitor
-import org.objectweb.asm.Opcodes
import org.objectweb.asm.TypePath
/**
- * A method visitor that removes everything from method body.
+ * A method visitor that creates or replaces a method body.
*
- * To inject a method body, override [visitCode] and create the opcodes there.
+ * Override [emitNewCode] to build the method body.
*/
abstract class BodyReplacingMethodVisitor(
- access: Int,
- name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?,
+ private val createBody: Boolean,
+ next: MethodVisitor?
) : MethodVisitor(OPCODE_VERSION, next) {
- val isVoid: Boolean
- val isStatic: Boolean
-
- init {
- isVoid = descriptor.endsWith(")V")
- isStatic = access and Opcodes.ACC_STATIC != 0
- }
// Following methods are for things that we need to keep.
// Since they're all calling the super method, we can just remove them, but we keep them
// just to clarify what we're keeping.
- final override fun visitParameter(
- name: String?,
- access: Int
- ) {
+ final override fun visitParameter(name: String?, access: Int) {
super.visitParameter(name, access)
}
@@ -59,10 +44,7 @@
return super.visitAnnotationDefault()
}
- final override fun visitAnnotation(
- descriptor: String?,
- visible: Boolean
- ): AnnotationVisitor? {
+ final override fun visitAnnotation(descriptor: String?, visible: Boolean): AnnotationVisitor? {
return super.visitAnnotation(descriptor, visible)
}
@@ -75,17 +57,14 @@
return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible)
}
- final override fun visitAnnotableParameterCount(
- parameterCount: Int,
- visible: Boolean
- ) {
+ final override fun visitAnnotableParameterCount(parameterCount: Int, visible: Boolean) {
super.visitAnnotableParameterCount(parameterCount, visible)
}
final override fun visitParameterAnnotation(
- parameter: Int,
- descriptor: String?,
- visible: Boolean
+ parameter: Int,
+ descriptor: String?,
+ visible: Boolean
): AnnotationVisitor? {
return super.visitParameterAnnotation(parameter, descriptor, visible)
}
@@ -94,10 +73,6 @@
super.visitAttribute(attribute)
}
- override fun visitEnd() {
- super.visitEnd()
- }
-
/**
* Control when to emit the code. We use this to ignore all visitXxx method calls caused by
* the original method, so we'll remove all the original code.
@@ -108,9 +83,18 @@
* (See also https://asm.ow2.io/asm4-guide.pdf section 3.2.1 about the MethovVisitor
* call order.)
*/
- var emitCode = false
+ private var emitCode = false
+
+ /**
+ * This value will be set as true when [visitCode] is called. In [visitEnd], if this value
+ * is still false, this means that the original method does not have a body.
+ *
+ * We want to forcefully inject a method body in [visitEnd] if [createBody] is true.
+ */
+ private var visitedCode = false
final override fun visitCode() {
+ visitedCode = true
super.visitCode()
try {
@@ -122,15 +106,19 @@
}
}
+ final override fun visitEnd() {
+ if (!visitedCode && createBody) {
+ visitCode()
+ }
+ super.visitEnd()
+ }
+
/**
* Subclass must implement it and emit code, and call [visitMaxs] at the end.
*/
abstract fun emitNewCode()
- final override fun visitMaxs(
- maxStack: Int,
- maxLocals: Int
- ) {
+ final override fun visitMaxs(maxStack: Int, maxLocals: Int) {
if (emitCode) {
super.visitMaxs(maxStack, maxLocals)
}
@@ -140,11 +128,11 @@
// emit any of them, so they are all no-op.
final override fun visitFrame(
- type: Int,
- numLocal: Int,
- local: Array<out Any>?,
- numStack: Int,
- stack: Array<out Any>?
+ type: Int,
+ numLocal: Int,
+ local: Array<out Any>?,
+ numStack: Int,
+ stack: Array<out Any>?
) {
if (emitCode) {
super.visitFrame(type, numLocal, local, numStack, stack)
@@ -157,38 +145,29 @@
}
}
- final override fun visitIntInsn(
- opcode: Int,
- operand: Int
- ) {
+ final override fun visitIntInsn(opcode: Int, operand: Int) {
if (emitCode) {
super.visitIntInsn(opcode, operand)
}
}
- final override fun visitVarInsn(
- opcode: Int,
- varIndex: Int
- ) {
+ final override fun visitVarInsn(opcode: Int, varIndex: Int) {
if (emitCode) {
super.visitVarInsn(opcode, varIndex)
}
}
- final override fun visitTypeInsn(
- opcode: Int,
- type: String?
- ) {
+ final override fun visitTypeInsn(opcode: Int, type: String?) {
if (emitCode) {
super.visitTypeInsn(opcode, type)
}
}
final override fun visitFieldInsn(
- opcode: Int,
- owner: String?,
- name: String?,
- descriptor: String?
+ opcode: Int,
+ owner: String?,
+ name: String?,
+ descriptor: String?
) {
if (emitCode) {
super.visitFieldInsn(opcode, owner, name, descriptor)
@@ -196,11 +175,11 @@
}
final override fun visitMethodInsn(
- opcode: Int,
- owner: String?,
- name: String?,
- descriptor: String?,
- isInterface: Boolean
+ opcode: Int,
+ owner: String?,
+ name: String?,
+ descriptor: String?,
+ isInterface: Boolean
) {
if (emitCode) {
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface)
@@ -208,21 +187,20 @@
}
final override fun visitInvokeDynamicInsn(
- name: String?,
- descriptor: String?,
- bootstrapMethodHandle: Handle?,
- vararg bootstrapMethodArguments: Any?
+ name: String?,
+ descriptor: String?,
+ bootstrapMethodHandle: Handle?,
+ vararg bootstrapMethodArguments: Any?
) {
if (emitCode) {
- super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle,
- *bootstrapMethodArguments)
+ super.visitInvokeDynamicInsn(
+ name, descriptor, bootstrapMethodHandle,
+ *bootstrapMethodArguments
+ )
}
}
- final override fun visitJumpInsn(
- opcode: Int,
- label: Label?
- ) {
+ final override fun visitJumpInsn(opcode: Int, label: Label?) {
if (emitCode) {
super.visitJumpInsn(opcode, label)
}
@@ -240,20 +218,17 @@
}
}
- final override fun visitIincInsn(
- varIndex: Int,
- increment: Int
- ) {
+ final override fun visitIincInsn(varIndex: Int, increment: Int) {
if (emitCode) {
super.visitIincInsn(varIndex, increment)
}
}
final override fun visitTableSwitchInsn(
- min: Int,
- max: Int,
- dflt: Label?,
- vararg labels: Label?
+ min: Int,
+ max: Int,
+ dflt: Label?,
+ vararg labels: Label?
) {
if (emitCode) {
super.visitTableSwitchInsn(min, max, dflt, *labels)
@@ -261,29 +236,26 @@
}
final override fun visitLookupSwitchInsn(
- dflt: Label?,
- keys: IntArray?,
- labels: Array<out Label>?
+ dflt: Label?,
+ keys: IntArray?,
+ labels: Array<out Label>?
) {
if (emitCode) {
super.visitLookupSwitchInsn(dflt, keys, labels)
}
}
- final override fun visitMultiANewArrayInsn(
- descriptor: String?,
- numDimensions: Int
- ) {
+ final override fun visitMultiANewArrayInsn(descriptor: String?, numDimensions: Int) {
if (emitCode) {
super.visitMultiANewArrayInsn(descriptor, numDimensions)
}
}
final override fun visitInsnAnnotation(
- typeRef: Int,
- typePath: TypePath?,
- descriptor: String?,
- visible: Boolean
+ typeRef: Int,
+ typePath: TypePath?,
+ descriptor: String?,
+ visible: Boolean
): AnnotationVisitor? {
if (emitCode) {
return super.visitInsnAnnotation(typeRef, typePath, descriptor, visible)
@@ -292,10 +264,10 @@
}
final override fun visitTryCatchBlock(
- start: Label?,
- end: Label?,
- handler: Label?,
- type: String?
+ start: Label?,
+ end: Label?,
+ handler: Label?,
+ type: String?
) {
if (emitCode) {
super.visitTryCatchBlock(start, end, handler, type)
@@ -303,10 +275,10 @@
}
final override fun visitTryCatchAnnotation(
- typeRef: Int,
- typePath: TypePath?,
- descriptor: String?,
- visible: Boolean
+ typeRef: Int,
+ typePath: TypePath?,
+ descriptor: String?,
+ visible: Boolean
): AnnotationVisitor? {
if (emitCode) {
return super.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible)
@@ -315,12 +287,12 @@
}
final override fun visitLocalVariable(
- name: String?,
- descriptor: String?,
- signature: String?,
- start: Label?,
- end: Label?,
- index: Int
+ name: String?,
+ descriptor: String?,
+ signature: String?,
+ start: Label?,
+ end: Label?,
+ index: Int
) {
if (emitCode) {
super.visitLocalVariable(name, descriptor, signature, start, end, index)
@@ -328,25 +300,23 @@
}
final override fun visitLocalVariableAnnotation(
- typeRef: Int,
- typePath: TypePath?,
- start: Array<out Label>?,
- end: Array<out Label>?,
- index: IntArray?,
- descriptor: String?,
- visible: Boolean
+ typeRef: Int,
+ typePath: TypePath?,
+ start: Array<out Label>?,
+ end: Array<out Label>?,
+ index: IntArray?,
+ descriptor: String?,
+ visible: Boolean
): AnnotationVisitor? {
if (emitCode) {
return super.visitLocalVariableAnnotation(
- typeRef, typePath, start, end, index, descriptor, visible)
+ typeRef, typePath, start, end, index, descriptor, visible
+ )
}
return null
}
- final override fun visitLineNumber(
- line: Int,
- start: Label?
- ) {
+ final override fun visitLineNumber(line: Int, start: Label?) {
if (emitCode) {
super.visitLineNumber(line, start)
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt
index 416b782..567a69e 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt
@@ -18,7 +18,6 @@
import com.android.hoststubgen.asm.CLASS_INITIALIZER_DESC
import com.android.hoststubgen.asm.CLASS_INITIALIZER_NAME
import com.android.hoststubgen.asm.ClassNodes
-import com.android.hoststubgen.asm.isVisibilityPrivateOrPackagePrivate
import com.android.hoststubgen.asm.prependArgTypeToMethodDescriptor
import com.android.hoststubgen.asm.writeByteCodeToPushArguments
import com.android.hoststubgen.asm.writeByteCodeToReturn
@@ -33,22 +32,21 @@
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
+import org.objectweb.asm.Opcodes.INVOKEINTERFACE
+import org.objectweb.asm.Opcodes.INVOKESTATIC
+import org.objectweb.asm.Opcodes.INVOKEVIRTUAL
import org.objectweb.asm.Type
/**
* An adapter that generates the "impl" class file from an input class file.
*/
class ImplGeneratingAdapter(
- classes: ClassNodes,
- nextVisitor: ClassVisitor,
- filter: OutputFilter,
- options: Options,
+ classes: ClassNodes,
+ nextVisitor: ClassVisitor,
+ filter: OutputFilter,
+ options: Options,
) : BaseAdapter(classes, nextVisitor, filter, options) {
- override fun shouldEmit(policy: FilterPolicy): Boolean {
- return policy.needsInImpl
- }
-
private var classLoadHooks: List<String> = emptyList()
override fun visit(
@@ -104,14 +102,14 @@
private fun writeClassLoadHookCalls(mv: MethodVisitor) {
classLoadHooks.forEach { classLoadHook ->
// First argument: the class type.
- mv.visitLdcInsn(Type.getType("L" + currentClassName + ";"))
+ mv.visitLdcInsn(Type.getType("L$currentClassName;"))
// Second argument: method name
mv.visitLdcInsn(classLoadHook)
// Call HostTestUtils.onClassLoaded().
mv.visitMethodInsn(
- Opcodes.INVOKESTATIC,
+ INVOKESTATIC,
HostTestUtils.CLASS_INTERNAL_NAME,
"onClassLoaded",
"(Ljava/lang/Class;Ljava/lang/String;)V",
@@ -121,69 +119,49 @@
}
override fun updateAccessFlags(
- access: Int,
- name: String,
- descriptor: String,
+ access: Int,
+ name: String,
+ descriptor: String,
+ policy: FilterPolicy,
): Int {
- if ((access and Opcodes.ACC_NATIVE) != 0 && nativeSubstitutionClass != null) {
+ if (policy.isMethodRewriteBody) {
+ // If we are rewriting the entire method body, we need
+ // to convert native methods to non-native
return access and Opcodes.ACC_NATIVE.inv()
}
return access
}
override fun visitMethodInner(
- access: Int,
- name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- policy: FilterPolicyWithReason,
- substituted: Boolean,
- superVisitor: MethodVisitor?,
+ access: Int,
+ name: String,
+ descriptor: String,
+ signature: String?,
+ exceptions: Array<String>?,
+ policy: FilterPolicyWithReason,
+ substituted: Boolean,
+ superVisitor: MethodVisitor?,
): MethodVisitor? {
- // Inject method log, if needed.
var innerVisitor = superVisitor
// If method logging is enabled, inject call to the logging method.
val methodCallHooks = filter.getMethodCallHooks(currentClassName, name, descriptor)
if (methodCallHooks.isNotEmpty()) {
innerVisitor = MethodCallHookInjectingAdapter(
- access,
name,
descriptor,
- signature,
- exceptions,
- innerVisitor,
methodCallHooks,
- )
+ innerVisitor,
+ )
}
// If this class already has a class initializer and a class load hook is needed, then
// we inject code.
if (classLoadHooks.isNotEmpty() &&
name == CLASS_INITIALIZER_NAME &&
- descriptor == CLASS_INITIALIZER_DESC) {
- innerVisitor = ClassLoadHookInjectingMethodAdapter(
- access,
- name,
- descriptor,
- signature,
- exceptions,
- innerVisitor,
- )
- }
-
- // If non-stub method call detection is enabled, then inject a call to the checker.
- if (options.enableNonStubMethodCallDetection && doesMethodNeedNonStubCallCheck(
- access, name, descriptor, policy) ) {
- innerVisitor = NonStubMethodCallDetectingAdapter(
- access,
- name,
- descriptor,
- signature,
- exceptions,
- innerVisitor,
- )
+ descriptor == CLASS_INITIALIZER_DESC
+ ) {
+ innerVisitor = ClassLoadHookInjectingMethodAdapter(innerVisitor)
}
fun MethodVisitor.withAnnotation(descriptor: String): MethodVisitor {
@@ -192,38 +170,35 @@
}
log.withIndent {
- var willThrow = false
- if (policy.policy == FilterPolicy.Throw) {
- log.v("Making method throw...")
- willThrow = true
- innerVisitor = ThrowingMethodAdapter(
- access, name, descriptor, signature, exceptions, innerVisitor)
- .withAnnotation(HostStubGenProcessedAsThrow.CLASS_DESCRIPTOR)
- }
- if ((access and Opcodes.ACC_NATIVE) != 0 && nativeSubstitutionClass != null) {
- log.v("Rewriting native method...")
- return NativeSubstitutingMethodAdapter(
- access, name, descriptor, signature, exceptions, innerVisitor)
- .withAnnotation(HostStubGenProcessedAsSubstitute.CLASS_DESCRIPTOR)
- }
- if (willThrow) {
- return innerVisitor
- }
-
- if (policy.policy == FilterPolicy.Ignore) {
- when (Type.getReturnType(descriptor)) {
- Type.VOID_TYPE -> {
- log.v("Making method ignored...")
- return IgnoreMethodAdapter(
- access, name, descriptor, signature, exceptions, innerVisitor)
- .withAnnotation(HostStubGenProcessedAsIgnore.CLASS_DESCRIPTOR)
- }
- else -> {
- throw RuntimeException("Ignored policy only allowed for void methods")
- }
+ // When we encounter native methods, we want to forcefully
+ // inject a method body. Also see [updateAccessFlags].
+ val forceCreateBody = (access and Opcodes.ACC_NATIVE) != 0
+ when (policy.policy) {
+ FilterPolicy.Throw -> {
+ log.v("Making method throw...")
+ return ThrowingMethodAdapter(forceCreateBody, innerVisitor)
+ .withAnnotation(HostStubGenProcessedAsThrow.CLASS_DESCRIPTOR)
}
+ FilterPolicy.Ignore -> {
+ log.v("Making method ignored...")
+ return IgnoreMethodAdapter(descriptor, forceCreateBody, innerVisitor)
+ .withAnnotation(HostStubGenProcessedAsIgnore.CLASS_DESCRIPTOR)
+ }
+ FilterPolicy.Redirect -> {
+ log.v("Redirecting method...")
+ return RedirectMethodAdapter(
+ access, name, descriptor,
+ forceCreateBody, innerVisitor
+ )
+ .withAnnotation(HostStubGenProcessedAsSubstitute.CLASS_DESCRIPTOR)
+ }
+ else -> {}
}
}
+
+ if (filter.hasAnyMethodCallReplace()) {
+ innerVisitor = MethodCallReplacingAdapter(name, innerVisitor)
+ }
if (substituted) {
innerVisitor?.withAnnotation(HostStubGenProcessedAsSubstitute.CLASS_DESCRIPTOR)
}
@@ -231,53 +206,32 @@
return innerVisitor
}
- fun doesMethodNeedNonStubCallCheck(
- access: Int,
- name: String,
- descriptor: String,
- policy: FilterPolicyWithReason,
- ): Boolean {
- // If a method is in the stub, then no need to check.
- if (policy.policy.needsInStub) {
- return false
- }
- // If a method is private or package-private, no need to check.
- // Technically test code can use framework package name, so it's a bit too lenient.
- if (isVisibilityPrivateOrPackagePrivate(access)) {
- return false
- }
- // TODO: If the method overrides a method that's accessible by tests, then we shouldn't
- // do the check. (e.g. overrides a stub method or java standard method.)
-
- return true
- }
-
/**
* A method adapter that replaces the method body with a HostTestUtils.onThrowMethodCalled()
* call.
*/
private inner class ThrowingMethodAdapter(
- access: Int,
- val name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?
- ) : BodyReplacingMethodVisitor(access, name, descriptor, signature, exceptions, next) {
+ createBody: Boolean,
+ next: MethodVisitor?
+ ) : BodyReplacingMethodVisitor(createBody, next) {
override fun emitNewCode() {
- visitMethodInsn(Opcodes.INVOKESTATIC,
- HostTestUtils.CLASS_INTERNAL_NAME,
- "onThrowMethodCalled",
- "()V",
- false)
+ visitMethodInsn(
+ INVOKESTATIC,
+ HostTestUtils.CLASS_INTERNAL_NAME,
+ "onThrowMethodCalled",
+ "()V",
+ false
+ )
// We still need a RETURN opcode for the return type.
// For now, let's just inject a `throw`.
visitTypeInsn(Opcodes.NEW, "java/lang/RuntimeException")
visitInsn(Opcodes.DUP)
visitLdcInsn("Unreachable")
- visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException",
- "<init>", "(Ljava/lang/String;)V", false)
+ visitMethodInsn(
+ Opcodes.INVOKESPECIAL, "java/lang/RuntimeException",
+ "<init>", "(Ljava/lang/String;)V", false
+ )
visitInsn(Opcodes.ATHROW)
// visitMaxs(3, if (isStatic) 0 else 1)
@@ -289,54 +243,67 @@
* A method adapter that replaces the method body with a no-op return.
*/
private inner class IgnoreMethodAdapter(
- access: Int,
- val name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?
- ) : BodyReplacingMethodVisitor(access, name, descriptor, signature, exceptions, next) {
+ val descriptor: String,
+ createBody: Boolean,
+ next: MethodVisitor?
+ ) : BodyReplacingMethodVisitor(createBody, next) {
override fun emitNewCode() {
- visitInsn(Opcodes.RETURN)
+ when (Type.getReturnType(descriptor)) {
+ Type.VOID_TYPE -> visitInsn(Opcodes.RETURN)
+ Type.BOOLEAN_TYPE, Type.BYTE_TYPE, Type.CHAR_TYPE, Type.SHORT_TYPE,
+ Type.INT_TYPE -> {
+ visitInsn(Opcodes.ICONST_0)
+ visitInsn(Opcodes.IRETURN)
+ }
+ Type.LONG_TYPE -> {
+ visitInsn(Opcodes.LCONST_0)
+ visitInsn(Opcodes.LRETURN)
+ }
+ Type.FLOAT_TYPE -> {
+ visitInsn(Opcodes.FCONST_0)
+ visitInsn(Opcodes.FRETURN)
+ }
+ Type.DOUBLE_TYPE -> {
+ visitInsn(Opcodes.DCONST_0)
+ visitInsn(Opcodes.DRETURN)
+ }
+ else -> {
+ visitInsn(Opcodes.ACONST_NULL)
+ visitInsn(Opcodes.ARETURN)
+ }
+ }
visitMaxs(0, 0) // We let ASM figure them out.
}
}
/**
- * A method adapter that replaces a native method call with a call to the "native substitution"
- * class.
+ * A method adapter that rewrite a method body with a
+ * call to a method in the redirection class.
*/
- private inner class NativeSubstitutingMethodAdapter(
- val access: Int,
- private val name: String,
- private val descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?
- ) : MethodVisitor(OPCODE_VERSION, next) {
- override fun visitCode() {
- throw RuntimeException("NativeSubstitutingMethodVisitor should be called on " +
- " native method, where visitCode() shouldn't be called.")
- }
+ private inner class RedirectMethodAdapter(
+ access: Int,
+ private val name: String,
+ private val descriptor: String,
+ createBody: Boolean,
+ next: MethodVisitor?
+ ) : BodyReplacingMethodVisitor(createBody, next) {
- override fun visitEnd() {
- super.visitCode()
+ private val isStatic = (access and Opcodes.ACC_STATIC) != 0
+ override fun emitNewCode() {
var targetDescriptor = descriptor
var argOffset = 0
- // For non-static native method, we need to tweak it a bit.
- if ((access and Opcodes.ACC_STATIC) == 0) {
+ // For non-static method, we need to tweak it a bit.
+ if (!isStatic) {
// Push `this` as the first argument.
this.visitVarInsn(Opcodes.ALOAD, 0)
// Update the descriptor -- add this class's type as the first argument
// to the method descriptor.
- val thisType = Type.getType("L" + currentClassName + ";")
-
targetDescriptor = prependArgTypeToMethodDescriptor(
- descriptor,
- thisType,
+ descriptor,
+ currentClassName,
)
// Shift the original arguments by one.
@@ -345,16 +312,17 @@
writeByteCodeToPushArguments(descriptor, this, argOffset)
- visitMethodInsn(Opcodes.INVOKESTATIC,
- nativeSubstitutionClass,
- name,
- targetDescriptor,
- false)
+ visitMethodInsn(
+ INVOKESTATIC,
+ redirectionClass,
+ name,
+ targetDescriptor,
+ false
+ )
writeByteCodeToReturn(descriptor, this)
visitMaxs(99, 0) // We let ASM figure them out.
- super.visitEnd()
}
}
@@ -365,25 +333,22 @@
* `this(...)`. The logging code will be injected *before* such calls.
*/
private inner class MethodCallHookInjectingAdapter(
- access: Int,
- val name: String,
- val descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?,
- val hooks: List<String>,
+ val name: String,
+ val descriptor: String,
+ val hooks: List<String>,
+ next: MethodVisitor?,
) : MethodVisitor(OPCODE_VERSION, next) {
override fun visitCode() {
super.visitCode()
hooks.forEach { hook ->
- mv.visitLdcInsn(Type.getType("L" + currentClassName + ";"))
+ mv.visitLdcInsn(Type.getType("L$currentClassName;"))
visitLdcInsn(name)
visitLdcInsn(descriptor)
visitLdcInsn(hook)
visitMethodInsn(
- Opcodes.INVOKESTATIC,
+ INVOKESTATIC,
HostTestUtils.CLASS_INTERNAL_NAME,
"callMethodCallHook",
"(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
@@ -397,11 +362,6 @@
* Inject a class load hook call.
*/
private inner class ClassLoadHookInjectingMethodAdapter(
- access: Int,
- val name: String,
- val descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
next: MethodVisitor?
) : MethodVisitor(OPCODE_VERSION, next) {
override fun visitCode() {
@@ -411,44 +371,57 @@
}
}
- /**
- * A method adapter that detects calls to non-stub methods.
- */
- private inner class NonStubMethodCallDetectingAdapter(
- access: Int,
- val name: String,
- val descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?
+ private inner class MethodCallReplacingAdapter(
+ val callerMethodName: String,
+ next: MethodVisitor?,
) : MethodVisitor(OPCODE_VERSION, next) {
- override fun visitCode() {
- super.visitCode()
+ override fun visitMethodInsn(
+ opcode: Int,
+ owner: String?,
+ name: String?,
+ descriptor: String?,
+ isInterface: Boolean,
+ ) {
+ when (opcode) {
+ INVOKESTATIC, INVOKEVIRTUAL, INVOKEINTERFACE -> {}
+ else -> {
+ // Don't touch other opcodes.
+ super.visitMethodInsn(opcode, owner, name, descriptor, isInterface)
+ return
+ }
+ }
+ val to = filter.getMethodCallReplaceTo(
+ currentClassName, callerMethodName, owner!!, name!!, descriptor!!
+ )
- // First three arguments to HostTestUtils.onNonStubMethodCalled().
- visitLdcInsn(currentClassName)
- visitLdcInsn(name)
- visitLdcInsn(descriptor)
+ if (to == null
+ // Don't replace if the target is the callsite.
+ || (to.className == currentClassName && to.methodName == callerMethodName)
+ ) {
+ super.visitMethodInsn(opcode, owner, name, descriptor, isInterface)
+ return
+ }
- // Call: HostTestUtils.getStackWalker().getCallerClass().
- // This push the caller Class in the stack.
- visitMethodInsn(Opcodes.INVOKESTATIC,
- HostTestUtils.CLASS_INTERNAL_NAME,
- "getStackWalker",
- "()Ljava/lang/StackWalker;",
- false)
- visitMethodInsn(Opcodes.INVOKEVIRTUAL,
- "java/lang/StackWalker",
- "getCallerClass",
- "()Ljava/lang/Class;",
- false)
+ // Replace the method call with a (static) call to the target method.
+ // If it's a non-static call, the target method's first argument will receive "this".
+ // (Because of that, we don't need to manipulate the stack. Just replace the
+ // method call.)
- // Then call onNonStubMethodCalled().
- visitMethodInsn(Opcodes.INVOKESTATIC,
- HostTestUtils.CLASS_INTERNAL_NAME,
- "onNonStubMethodCalled",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V",
- false)
+ val toDesc = if (opcode == INVOKESTATIC) {
+ // Static call to static call, no need to change the desc.
+ descriptor
+ } else {
+ // Need to prepend the "this" type to the descriptor.
+ prependArgTypeToMethodDescriptor(descriptor, owner)
+ }
+
+ mv.visitMethodInsn(
+ INVOKESTATIC,
+ to.className,
+ to.methodName,
+ toDesc,
+ false
+ )
}
}
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/StubGeneratingAdapter.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/StubGeneratingAdapter.kt
deleted file mode 100644
index fc20f28..0000000
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/visitors/StubGeneratingAdapter.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 com.android.hoststubgen.visitors
-
-import com.android.hoststubgen.asm.ClassNodes
-import com.android.hoststubgen.filters.FilterPolicy
-import com.android.hoststubgen.filters.FilterPolicyWithReason
-import com.android.hoststubgen.filters.OutputFilter
-import com.android.hoststubgen.log
-import org.objectweb.asm.ClassVisitor
-import org.objectweb.asm.MethodVisitor
-import org.objectweb.asm.Opcodes
-
-/**
- * An adapter that generates the "impl" class file from an input class file.
- */
-class StubGeneratingAdapter(
- classes: ClassNodes,
- nextVisitor: ClassVisitor,
- filter: OutputFilter,
- options: Options,
-) : BaseAdapter(classes, nextVisitor, filter, options) {
-
- override fun shouldEmit(policy: FilterPolicy): Boolean {
- return policy.needsInStub
- }
-
- override fun visitMethodInner(
- access: Int,
- name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- policy: FilterPolicyWithReason,
- substituted: Boolean,
- superVisitor: MethodVisitor?,
- ): MethodVisitor? {
- return StubMethodVisitor(access, name, descriptor, signature, exceptions, superVisitor)
- }
-
- private inner class StubMethodVisitor(
- access: Int,
- val name: String,
- descriptor: String,
- signature: String?,
- exceptions: Array<String>?,
- next: MethodVisitor?
- ) : BodyReplacingMethodVisitor(access, name, descriptor, signature, exceptions, next) {
- override fun emitNewCode() {
- log.d(" Generating stub method for $currentClassName.$name")
-
- // Inject the following code:
- // throw new RuntimeException("Stub!");
-
- /*
- NEW java/lang/RuntimeException
- DUP
- LDC "not supported on host side"
- INVOKESPECIAL java/lang/RuntimeException.<init> (Ljava/lang/String;)V
- ATHROW
- MAXSTACK = 3
- MAXLOCALS = 2 <- 1 for this, 1 for return value.
- */
- visitTypeInsn(Opcodes.NEW, "java/lang/RuntimeException")
- visitInsn(Opcodes.DUP)
- visitLdcInsn("Stub!")
- visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException",
- "<init>", "(Ljava/lang/String;)V", false)
- visitInsn(Opcodes.ATHROW)
- visitMaxs(0, 0) // We let ASM figure them out.
- }
- }
-}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/Android.bp b/tools/hoststubgen/hoststubgen/test-tiny-framework/Android.bp
index e7873d6..ba2c869 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/Android.bp
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/Android.bp
@@ -21,7 +21,7 @@
// Create stub/impl jars from "hoststubgen-test-tiny-framework", using the following 3 rules.
java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host",
+ name: "hoststubgen-test-tiny-framework-host-base",
defaults: ["hoststubgen-command-defaults"],
cmd: hoststubgen_common_options +
"--in-jar $(location :hoststubgen-test-tiny-framework) " +
@@ -35,25 +35,13 @@
}
java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-stub",
+ name: "hoststubgen-test-tiny-framework-host",
cmd: "cp $(in) $(out)",
srcs: [
- ":hoststubgen-test-tiny-framework-host{host_stub.jar}",
+ ":hoststubgen-test-tiny-framework-host-base{host.jar}",
],
out: [
- "host_stub.jar",
- ],
- visibility: ["//visibility:private"],
-}
-
-java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-impl",
- cmd: "cp $(in) $(out)",
- srcs: [
- ":hoststubgen-test-tiny-framework-host{host_impl.jar}",
- ],
- out: [
- "host_impl.jar",
+ "host.jar",
],
visibility: ["//visibility:private"],
}
@@ -61,7 +49,7 @@
// Same as "hoststubgen-test-tiny-framework-host", but with more options, to test more hoststubgen
// features.
java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-ext",
+ name: "hoststubgen-test-tiny-framework-host-ext-base",
defaults: ["hoststubgen-command-defaults"],
cmd: hoststubgen_common_options +
"--in-jar $(location :hoststubgen-test-tiny-framework) " +
@@ -79,37 +67,25 @@
}
java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-ext-stub",
+ name: "hoststubgen-test-tiny-framework-host-ext",
cmd: "cp $(in) $(out)",
srcs: [
- ":hoststubgen-test-tiny-framework-host-ext{host_stub.jar}",
+ ":hoststubgen-test-tiny-framework-host-ext-base{host.jar}",
],
out: [
- "host_stub.jar",
- ],
- visibility: ["//visibility:private"],
-}
-
-java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-ext-impl",
- cmd: "cp $(in) $(out)",
- srcs: [
- ":hoststubgen-test-tiny-framework-host-ext{host_impl.jar}",
- ],
- out: [
- "host_impl.jar",
+ "host.jar",
],
visibility: ["//visibility:private"],
}
// Compile the test jar, using 2 rules.
-// 1. Build the test against the stub.
+// 1. Build the test against the original framework.
java_library_host {
name: "hoststubgen-test-tiny-test-lib",
srcs: ["tiny-test/src/**/*.java"],
libs: [
- "hoststubgen-test-tiny-framework-host-stub",
+ "hoststubgen-test-tiny-framework",
],
static_libs: [
"junit",
@@ -129,7 +105,7 @@
static_libs: [
"hoststubgen-test-tiny-test-lib",
"hoststubgen-helper-runtime",
- "hoststubgen-test-tiny-framework-host-impl",
+ "hoststubgen-test-tiny-framework-host",
],
test_suites: ["general-tests"],
}
@@ -149,49 +125,25 @@
}
java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-stub-dump",
+ name: "hoststubgen-test-tiny-framework-host-dump",
defaults: ["hoststubgen-jar-dump-defaults"],
srcs: [
- ":hoststubgen-test-tiny-framework-host-stub",
+ ":hoststubgen-test-tiny-framework-host",
],
out: [
- "02-hoststubgen-test-tiny-framework-host-stub-dump.txt",
+ "03-hoststubgen-test-tiny-framework-host-dump.txt",
],
visibility: ["//visibility:private"],
}
java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-impl-dump",
+ name: "hoststubgen-test-tiny-framework-host-ext-dump",
defaults: ["hoststubgen-jar-dump-defaults"],
srcs: [
- ":hoststubgen-test-tiny-framework-host-impl",
+ ":hoststubgen-test-tiny-framework-host-ext",
],
out: [
- "03-hoststubgen-test-tiny-framework-host-impl-dump.txt",
- ],
- visibility: ["//visibility:private"],
-}
-
-java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-ext-stub-dump",
- defaults: ["hoststubgen-jar-dump-defaults"],
- srcs: [
- ":hoststubgen-test-tiny-framework-host-ext-stub",
- ],
- out: [
- "12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt",
- ],
- visibility: ["//visibility:private"],
-}
-
-java_genrule_host {
- name: "hoststubgen-test-tiny-framework-host-ext-impl-dump",
- defaults: ["hoststubgen-jar-dump-defaults"],
- srcs: [
- ":hoststubgen-test-tiny-framework-host-ext-impl",
- ],
- out: [
- "13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt",
+ "13-hoststubgen-test-tiny-framework-host-ext-dump.txt",
],
visibility: ["//visibility:private"],
}
@@ -206,11 +158,9 @@
"golden-output/*.txt",
],
java_data: [
- "hoststubgen-test-tiny-framework-host-stub-dump",
- "hoststubgen-test-tiny-framework-host-impl-dump",
"hoststubgen-test-tiny-framework-orig-dump",
- "hoststubgen-test-tiny-framework-host-ext-stub-dump",
- "hoststubgen-test-tiny-framework-host-ext-impl-dump",
+ "hoststubgen-test-tiny-framework-host-dump",
+ "hoststubgen-test-tiny-framework-host-ext-dump",
],
test_suites: ["general-tests"],
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt
index bd9e85e..de4cb0c 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt
@@ -6,10 +6,10 @@
# To allow a specific class to use annotations:
-# com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
+# com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations
# To disallow a specific class to use annotations:
-# !com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
+# !com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations
# To allow a specific package to use annotations:
# com.android.hoststubgen.test.*
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/diff-and-update-golden.sh b/tools/hoststubgen/hoststubgen/test-tiny-framework/diff-and-update-golden.sh
index 00cbfe3..3726ca9 100755
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/diff-and-update-golden.sh
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/diff-and-update-golden.sh
@@ -63,7 +63,7 @@
# Build the dump files, which are the input of this test.
-run m tiny-framework-dump-test
+run m dump-jar tiny-framework-dump-test
# Get the path to the generate text files. (not the golden files.)
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt
index c127e67..103e152 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt
@@ -21,6 +21,26 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
+## Class: android/hosttest/annotation/HostSideTestIgnore.class
+ Compiled from "HostSideTestIgnore.java"
+public interface android.hosttest.annotation.HostSideTestIgnore extends java.lang.annotation.Annotation
+ minor version: 0
+ major version: 61
+ flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
+ this_class: #x // android/hosttest/annotation/HostSideTestIgnore
+ super_class: #x // java/lang/Object
+ interfaces: 1, fields: 0, methods: 0, attributes: 2
+}
+SourceFile: "HostSideTestIgnore.java"
+RuntimeVisibleAnnotations:
+ x: #x(#x=[e#x.#x,e#x.#x])
+ java.lang.annotation.Target(
+ value=[Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
+ )
+ x: #x(#x=e#x.#x)
+ java.lang.annotation.Retention(
+ value=Ljava/lang/annotation/RetentionPolicy;.CLASS
+ )
## Class: android/hosttest/annotation/HostSideTestKeep.class
Compiled from "HostSideTestKeep.java"
public interface android.hosttest.annotation.HostSideTestKeep extends java.lang.annotation.Annotation
@@ -41,20 +61,40 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestNativeSubstitutionClass.class
- Compiled from "HostSideTestNativeSubstitutionClass.java"
-public interface android.hosttest.annotation.HostSideTestNativeSubstitutionClass extends java.lang.annotation.Annotation
+## Class: android/hosttest/annotation/HostSideTestRedirect.class
+ Compiled from "HostSideTestRedirect.java"
+public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation
minor version: 0
major version: 61
flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestNativeSubstitutionClass
+ this_class: #x // android/hosttest/annotation/HostSideTestRedirect
+ super_class: #x // java/lang/Object
+ interfaces: 1, fields: 0, methods: 0, attributes: 2
+}
+SourceFile: "HostSideTestRedirect.java"
+RuntimeVisibleAnnotations:
+ x: #x(#x=[e#x.#x])
+ java.lang.annotation.Target(
+ value=[Ljava/lang/annotation/ElementType;.METHOD]
+ )
+ x: #x(#x=e#x.#x)
+ java.lang.annotation.Retention(
+ value=Ljava/lang/annotation/RetentionPolicy;.CLASS
+ )
+## Class: android/hosttest/annotation/HostSideTestRedirectionClass.class
+ Compiled from "HostSideTestRedirectionClass.java"
+public interface android.hosttest.annotation.HostSideTestRedirectionClass extends java.lang.annotation.Annotation
+ minor version: 0
+ major version: 61
+ flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
+ this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass
super_class: #x // java/lang/Object
interfaces: 1, fields: 0, methods: 1, attributes: 2
public abstract java.lang.String value();
descriptor: ()Ljava/lang/String;
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
}
-SourceFile: "HostSideTestNativeSubstitutionClass.java"
+SourceFile: "HostSideTestRedirectionClass.java"
RuntimeVisibleAnnotations:
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
@@ -104,26 +144,6 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestStub.class
- Compiled from "HostSideTestStub.java"
-public interface android.hosttest.annotation.HostSideTestStub extends java.lang.annotation.Annotation
- minor version: 0
- major version: 61
- flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestStub
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "HostSideTestStub.java"
-RuntimeVisibleAnnotations:
- x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
- java.lang.annotation.Target(
- value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
- )
- x: #x(#x=e#x.#x)
- java.lang.annotation.Retention(
- value=Ljava/lang/annotation/RetentionPolicy;.CLASS
- )
## Class: android/hosttest/annotation/HostSideTestSubstitute.class
Compiled from "HostSideTestSubstitute.java"
public interface android.hosttest.annotation.HostSideTestSubstitute extends java.lang.annotation.Annotation
@@ -187,26 +207,6 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestWholeClassStub.class
- Compiled from "HostSideTestWholeClassStub.java"
-public interface android.hosttest.annotation.HostSideTestWholeClassStub extends java.lang.annotation.Annotation
- minor version: 0
- major version: 61
- flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestWholeClassStub
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "HostSideTestWholeClassStub.java"
-RuntimeVisibleAnnotations:
- x: #x(#x=[e#x.#x])
- java.lang.annotation.Target(
- value=[Ljava/lang/annotation/ElementType;.TYPE]
- )
- x: #x(#x=e#x.#x)
- java.lang.annotation.Retention(
- value=Ljava/lang/annotation/RetentionPolicy;.CLASS
- )
## Class: android/hosttest/annotation/tests/HostSideTestSuppress.class
Compiled from "HostSideTestSuppress.java"
public interface android.hosttest.annotation.tests.HostSideTestSuppress extends java.lang.annotation.Annotation
@@ -394,120 +394,15 @@
com/android/hoststubgen/test/tinyframework/R$Nested
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.class
- Compiled from "TinyFrameworkCallerCheck.java"
-class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl
- minor version: 0
- major version: 61
- flags: (0x0020) ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 3, attributes: 3
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl;
-
- public static int getOneKeep();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: iconst_1
- x: ireturn
- LineNumberTable:
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestKeep
-
- public static int getOneStub();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: iconst_1
- x: ireturn
- LineNumberTable:
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-SourceFile: "TinyFrameworkCallerCheck.java"
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.class
- Compiled from "TinyFrameworkCallerCheck.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations.class
+ Compiled from "TinyFrameworkAnnotations.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations
minor version: 0
major version: 61
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 3, attributes: 4
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck;
-
- public static int getOne_withCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.getOneKeep:()I
- x: ireturn
- LineNumberTable:
-
- public static int getOne_noCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.getOneStub:()I
- x: ireturn
- LineNumberTable:
-}
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.class
- Compiled from "TinyFrameworkClassAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 10, attributes: 2
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
+ interfaces: 0, fields: 2, methods: 9, attributes: 2
public int keep;
descriptor: I
flags: (0x0001) ACC_PUBLIC
@@ -519,7 +414,7 @@
descriptor: I
flags: (0x0001) ACC_PUBLIC
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations();
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
@@ -528,42 +423,21 @@
x: invokespecial #x // Method java/lang/Object."<init>":()V
x: aload_0
x: iconst_1
- x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
+ x: putfield #x // Field keep:I
+ x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public int addOne(int);
descriptor: (I)I
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=2, args_size=2
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
- 0 6 1 value I
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
x: iload_1
x: iconst_1
x: iadd
@@ -571,7 +445,7 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
0 4 1 value I
RuntimeInvisibleAnnotations:
x: #x()
@@ -589,7 +463,7 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
0 8 1 foo Ljava/lang/String;
RuntimeInvisibleAnnotations:
x: #x()
@@ -608,11 +482,9 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
0 10 1 value I
RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
x: #x(#x=s#x)
android.hosttest.annotation.HostSideTestSubstitute(
suffix="_host"
@@ -630,15 +502,13 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
0 4 1 value I
public static native int nativeAddThree(int);
descriptor: (I)I
flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
x: #x(#x=s#x)
android.hosttest.annotation.HostSideTestSubstitute(
suffix="_host"
@@ -668,125 +538,16 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestThrow
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
+ public int toBeIgnored();
+ descriptor: ()I
flags: (0x0001) ACC_PUBLIC
Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-SourceFile: "TinyFrameworkClassAnnotations.java"
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestClassLoadHook(
- value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
- )
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.class
- Compiled from "TinyFrameworkClassClassWideAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 10, attributes: 2
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
-
- public int remove;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=1, args_size=1
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: aload_0
- x: iconst_1
- x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 6 1 value I
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: iload_1
- x: iconst_1
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 4 1 value I
-
- public void toBeRemoved(java.lang.String);
- descriptor: (Ljava/lang/String;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
- x: athrow
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 8 1 foo Ljava/lang/String;
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
+ stack=3, locals=1, args_size=1
x: new #x // class java/lang/RuntimeException
x: dup
x: ldc #x // String not supported on host side
@@ -795,85 +556,19 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 10 1 value I
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestSubstitute(
- suffix="_host"
- )
-
- public int addTwo_host(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: iload_1
- x: iconst_2
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 4 1 value I
-
- public static native int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestSubstitute(
- suffix="_host"
- )
-
- public static int nativeAddThree_host(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=2, locals=1, args_size=1
- x: iload_0
- x: iconst_3
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 4 0 value I
-
- public java.lang.String unsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: ldc #x // String This value shouldn\'t be seen on the host side.
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
+ android.hosttest.annotation.HostSideTestIgnore
}
-SourceFile: "TinyFrameworkClassClassWideAnnotations.java"
+SourceFile: "TinyFrameworkAnnotations.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestKeep
+ x: #x(#x=s#x)
+ android.hosttest.annotation.HostSideTestClassLoadHook(
+ value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
+ )
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.class
Compiled from "TinyFrameworkClassLoadHook.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook
@@ -935,7 +630,131 @@
SourceFile: "TinyFrameworkClassLoadHook.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations.class
+ Compiled from "TinyFrameworkClassWideAnnotations.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAnnotations
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 2, methods: 6, attributes: 2
+ public int keep;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+
+ public int remove;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRemove
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAnnotations();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: iconst_1
+ x: putfield #x // Field keep:I
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+
+ public int addOne(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_1
+ x: iconst_1
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 0 4 1 value I
+
+ public int addTwo(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=3, locals=2, args_size=2
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: ldc #x // String not supported on host side
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 0 10 1 value I
+ RuntimeInvisibleAnnotations:
+ x: #x(#x=s#x)
+ android.hosttest.annotation.HostSideTestSubstitute(
+ suffix="_host"
+ )
+
+ public int addTwo_host(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_1
+ x: iconst_2
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 0 4 1 value I
+
+ public void toBeRemoved(java.lang.String);
+ descriptor: (Ljava/lang/String;)V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 0 8 1 foo Ljava/lang/String;
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRemove
+
+ public java.lang.String unsupportedMethod();
+ descriptor: ()Ljava/lang/String;
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: ldc #x // String This value shouldn\'t be seen on the host side.
+ x: areturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestThrow
+}
+SourceFile: "TinyFrameworkClassWideAnnotations.java"
+RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.class
Compiled from "TinyFrameworkClassWithInitializerDefault.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerDefault
@@ -950,14 +769,14 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.lang.Object sObject;
descriptor: Ljava/lang/Object;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerDefault();
descriptor: ()V
@@ -989,7 +808,7 @@
SourceFile: "TinyFrameworkClassWithInitializerDefault.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.class
Compiled from "TinyFrameworkClassWithInitializerStub.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerStub
@@ -1004,14 +823,14 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.lang.Object sObject;
descriptor: Ljava/lang/Object;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerStub();
descriptor: ()V
@@ -1047,7 +866,7 @@
value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
)
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.class
@@ -1064,21 +883,21 @@
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex GREEN;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex BLUE;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private final java.lang.String mLongName;
descriptor: Ljava/lang/String;
@@ -1158,7 +977,7 @@
Signature: #x // (Ljava/lang/String;Ljava/lang/String;)V
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.lang.String getLongName();
descriptor: ()Ljava/lang/String;
@@ -1174,7 +993,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.lang.String getShortName();
descriptor: ()Ljava/lang/String;
@@ -1190,7 +1009,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1252,7 +1071,7 @@
SourceFile: "TinyFrameworkEnumComplex.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.class
Compiled from "TinyFrameworkEnumSimple.java"
public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple>
@@ -1267,14 +1086,14 @@
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple DOG;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $VALUES;
descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
@@ -1373,7 +1192,7 @@
SourceFile: "TinyFrameworkEnumSimple.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.class
Compiled from "TinyFrameworkExceptionTester.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester
@@ -1427,7 +1246,7 @@
SourceFile: "TinyFrameworkExceptionTester.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.class
Compiled from "TinyFrameworkForTextPolicy.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy
@@ -1436,15 +1255,11 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 10, attributes: 1
+ interfaces: 0, fields: 2, methods: 17, attributes: 1
public int stub;
descriptor: I
flags: (0x0001) ACC_PUBLIC
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
-
public int remove;
descriptor: I
flags: (0x0001) ACC_PUBLIC
@@ -1459,35 +1274,17 @@
x: aload_0
x: iconst_1
x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
+ x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
public int addOne(int);
descriptor: (I)I
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=2, args_size=2
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- 0 6 1 value I
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
x: iload_1
x: iconst_1
x: iadd
@@ -1513,6 +1310,132 @@
0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
0 8 1 foo Ljava/lang/String;
+ public java.lang.String toBeIgnoredObj();
+ descriptor: ()Ljava/lang/String;
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public void toBeIgnoredV();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public boolean toBeIgnoredZ();
+ descriptor: ()Z
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public byte toBeIgnoredB();
+ descriptor: ()B
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public char toBeIgnoredC();
+ descriptor: ()C
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public short toBeIgnoredS();
+ descriptor: ()S
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public int toBeIgnoredI();
+ descriptor: ()I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public float toBeIgnoredF();
+ descriptor: ()F
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
+ public double toBeIgnoredD();
+ descriptor: ()D
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+
public int addTwo(int);
descriptor: (I)I
flags: (0x0001) ACC_PUBLIC
@@ -1573,19 +1496,6 @@
LocalVariableTable:
Start Length Slot Name Signature
0 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
}
SourceFile: "TinyFrameworkForTextPolicy.java"
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested.class
@@ -1603,7 +1513,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -1611,7 +1521,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested();
descriptor: ()V
@@ -1630,7 +1540,7 @@
0 14 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -1646,7 +1556,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -1659,7 +1569,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static java.lang.Integer lambda$getSupplier_static$3();
descriptor: ()Ljava/lang/Integer;
@@ -1714,7 +1624,7 @@
SourceFile: "TinyFrameworkLambdas.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
@@ -1757,7 +1667,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -1765,7 +1675,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas();
descriptor: ()V
@@ -1784,7 +1694,7 @@
0 14 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -1800,7 +1710,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -1813,7 +1723,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static java.lang.Integer lambda$getSupplier_static$3();
descriptor: ()Ljava/lang/Integer;
@@ -1868,7 +1778,7 @@
SourceFile: "TinyFrameworkLambdas.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
NestMembers:
@@ -1897,6 +1807,174 @@
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class
+ Compiled from "TinyFrameworkMethodCallReplace.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 0, methods: 3, attributes: 3
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo;
+
+ public static void startThread(java.lang.Thread);
+ descriptor: (Ljava/lang/Thread;)V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: iconst_1
+ x: invokevirtual #x // Method java/lang/Thread.setDaemon:(Z)V
+ x: aload_0
+ x: invokevirtual #x // Method java/lang/Thread.start:()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 10 0 thread Ljava/lang/Thread;
+
+ public static int add(int, int);
+ descriptor: (II)I
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_0
+ x: iload_1
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 4 0 a I
+ 0 4 1 b I
+}
+SourceFile: "TinyFrameworkMethodCallReplace.java"
+NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+InnerClasses:
+ public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.class
+ Compiled from "TinyFrameworkMethodCallReplace.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 0, methods: 5, attributes: 5
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace;
+
+ public static boolean nonStaticMethodCallReplaceTester() throws java.lang.Exception;
+ descriptor: ()Z
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=3, locals=2, args_size=0
+ x: new #x // class java/util/concurrent/atomic/AtomicBoolean
+ x: dup
+ x: iconst_0
+ x: invokespecial #x // Method java/util/concurrent/atomic/AtomicBoolean."<init>":(Z)V
+ x: astore_0
+ x: new #x // class java/lang/Thread
+ x: dup
+ x: aload_0
+ x: invokedynamic #x, 0 // InvokeDynamic #x:run:(Ljava/util/concurrent/atomic/AtomicBoolean;)Ljava/lang/Runnable;
+ x: invokespecial #x // Method java/lang/Thread."<init>":(Ljava/lang/Runnable;)V
+ x: astore_1
+ x: aload_1
+ x: invokevirtual #x // Method java/lang/Thread.start:()V
+ x: aload_1
+ x: invokevirtual #x // Method java/lang/Thread.join:()V
+ x: aload_0
+ x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.get:()Z
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 9 27 0 ab Ljava/util/concurrent/atomic/AtomicBoolean;
+ 23 13 1 th Ljava/lang/Thread;
+ Exceptions:
+ throws java.lang.Exception
+
+ public static int staticMethodCallReplaceTester();
+ descriptor: ()I
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: iconst_1
+ x: iconst_2
+ x: invokestatic #x // Method originalAdd:(II)I
+ x: ireturn
+ LineNumberTable:
+
+ private static int originalAdd(int, int);
+ descriptor: (II)I
+ flags: (0x000a) ACC_PRIVATE, ACC_STATIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_0
+ x: iload_1
+ x: iadd
+ x: iconst_1
+ x: isub
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 6 0 a I
+ 0 6 1 b I
+
+ private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean);
+ descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;
+ x: invokevirtual #x // Method java/lang/Thread.isDaemon:()Z
+ x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.set:(Z)V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 11 0 ab Ljava/util/concurrent/atomic/AtomicBoolean;
+}
+SourceFile: "TinyFrameworkMethodCallReplace.java"
+RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestWholeClassKeep
+NestMembers:
+ com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+BootstrapMethods:
+ x: #x REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
+ Method arguments:
+ #x ()V
+ #x REF_invokeStatic com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.lambda$nonStaticMethodCallReplaceTester$0:(Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ #x ()V
+InnerClasses:
+ public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class
Compiled from "TinyFrameworkNative.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative
@@ -1905,7 +1983,7 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 11, attributes: 2
+ interfaces: 0, fields: 1, methods: 14, attributes: 2
int value;
descriptor: I
flags: (0x0000)
@@ -1926,6 +2004,9 @@
public static native int nativeAddTwo(int);
descriptor: (I)I
flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
public static int nativeAddTwo_should_be_like_this(int);
descriptor: (I)I
@@ -1943,6 +2024,9 @@
public static native long nativeLongPlus(long, long);
descriptor: (JJ)J
flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
public static long nativeLongPlus_should_be_like_this(long, long);
descriptor: (JJ)J
@@ -1977,6 +2061,9 @@
public native int nativeNonStaticAddToValue(int);
descriptor: (I)I
flags: (0x0101) ACC_PUBLIC, ACC_NATIVE
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
public int nativeNonStaticAddToValue_should_be_like_this(int);
descriptor: (I)I
@@ -2000,6 +2087,10 @@
x: #x()
android.hosttest.annotation.HostSideTestThrow
+ public static native void nativeStillKeep();
+ descriptor: ()V
+ flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
+
public static void nativeStillNotSupported_should_be_like_this();
descriptor: ()V
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
@@ -2014,13 +2105,47 @@
public static native byte nativeBytePlus(byte, byte);
descriptor: (BB)B
flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
+
+ public void notNativeRedirected();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
+
+ public static void notNativeStaticRedirected();
+ descriptor: ()V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: athrow
+ LineNumberTable:
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
}
SourceFile: "TinyFrameworkNative.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass(
+ android.hosttest.annotation.HostSideTestRedirectionClass(
value="TinyFrameworkNative_host"
)
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.class
@@ -2031,7 +2156,7 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 5, attributes: 2
+ interfaces: 0, fields: 0, methods: 7, attributes: 2
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
@@ -2105,6 +2230,25 @@
Start Length Slot Name Signature
0 5 0 arg1 B
0 5 1 arg2 B
+
+ public static void notNativeRedirected(com.android.hoststubgen.test.tinyframework.TinyFrameworkNative);
+ descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;)V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=0, locals=1, args_size=1
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 1 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
+
+ public static void notNativeStaticRedirected();
+ descriptor: ()V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=0, locals=0, args_size=0
+ x: return
+ LineNumberTable:
}
SourceFile: "TinyFrameworkNative_host.java"
RuntimeInvisibleAnnotations:
@@ -2390,7 +2534,7 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 1, attributes: 4
+ interfaces: 0, fields: 2, methods: 1, attributes: 3
public int value;
descriptor: I
flags: (0x0001) ACC_PUBLIC
@@ -2423,9 +2567,6 @@
<no name> final mandated
}
SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
InnerClasses:
public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
@@ -2484,6 +2625,40 @@
InnerClasses:
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass.class
+ Compiled from "TinyFrameworkNestedClasses.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 1, methods: 1, attributes: 3
+ public int value;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: bipush 8
+ x: putfield #x // Field value:I
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 11 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass;
+}
+SourceFile: "TinyFrameworkNestedClasses.java"
+NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+InnerClasses:
+ public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass.class
Compiled from "TinyFrameworkNestedClasses.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass
@@ -2492,7 +2667,7 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 4
+ interfaces: 0, fields: 1, methods: 2, attributes: 3
public int value;
descriptor: I
flags: (0x0001) ACC_PUBLIC
@@ -2526,13 +2701,11 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
}
SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
InnerClasses:
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass.class
Compiled from "TinyFrameworkNestedClasses.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass extends com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass
@@ -2643,11 +2816,12 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
+ com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
@@ -2663,6 +2837,7 @@
public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.class
Compiled from "TinyFrameworkPackageRedirect.java"
@@ -2705,7 +2880,7 @@
SourceFile: "TinyFrameworkPackageRedirect.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class
Compiled from "TinyFrameworkRenamedClassCaller.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller
@@ -2747,7 +2922,7 @@
SourceFile: "TinyFrameworkRenamedClassCaller.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class
Compiled from "TinyFrameworkToBeRenamed.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed
@@ -2794,7 +2969,7 @@
SourceFile: "TinyFrameworkToBeRenamed.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class
Compiled from "A.java"
public class com.android.hoststubgen.test.tinyframework.packagetest.A
@@ -3540,4 +3715,4 @@
SourceFile: "UnsupportedClass.java"
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt
deleted file mode 100644
index 17ba48c..0000000
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/02-hoststubgen-test-tiny-framework-host-stub-dump.txt
+++ /dev/null
@@ -1,2530 +0,0 @@
-## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy.class
- Compiled from "IPretendingAidl.java"
-public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Proxy
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 4
- public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Proxy();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int addTwo(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
-SourceFile: "IPretendingAidl.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
-## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub.class
- Compiled from "IPretendingAidl.java"
-public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 4
- public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int addOne(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
-SourceFile: "IPretendingAidl.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
-## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl.class
- Compiled from "IPretendingAidl.java"
-public interface com.android.hoststubgen.test.tinyframework.IPretendingAidl
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 4
-}
-InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
-SourceFile: "IPretendingAidl.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestMembers:
- com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
- com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
-## Class: com/android/hoststubgen/test/tinyframework/R$Nested.class
- Compiled from "R.java"
-public class com.android.hoststubgen.test.tinyframework.R$Nested
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/R$Nested
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 4
- public static int[] ARRAY;
- descriptor: [I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.R$Nested();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
-SourceFile: "R.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/R
-## Class: com/android/hoststubgen/test/tinyframework/R.class
- Compiled from "R.java"
-public class com.android.hoststubgen.test.tinyframework.R
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/R
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 1, attributes: 4
- public com.android.hoststubgen.test.tinyframework.R();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
-SourceFile: "R.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestMembers:
- com/android/hoststubgen/test/tinyframework/R$Nested
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.class
- Compiled from "TinyFrameworkCallerCheck.java"
-class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl
- minor version: 0
- major version: 61
- flags: (0x0020) ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 4
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOneStub();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.class
- Compiled from "TinyFrameworkCallerCheck.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 3, attributes: 5
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_withCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_noCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.class
- Compiled from "TinyFrameworkClassAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 5, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-SourceFile: "TinyFrameworkClassAnnotations.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestClassLoadHook(
- value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
- )
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.class
- Compiled from "TinyFrameworkClassClassWideAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 8, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int remove;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public void toBeRemoved(java.lang.String);
- descriptor: (Ljava/lang/String;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String unsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkClassClassWideAnnotations.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.class
- Compiled from "TinyFrameworkClassLoadHook.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 3, attributes: 3
- public static final java.util.Set<java.lang.Class<?>> sLoadedClasses;
- descriptor: Ljava/util/Set;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/Set<Ljava/lang/Class<*>;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static void onClassLoaded(java.lang.Class<?>);
- descriptor: (Ljava/lang/Class;)V
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // (Ljava/lang/Class<*>;)V
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkClassLoadHook.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.class
- Compiled from "TinyFrameworkClassWithInitializerDefault.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerDefault
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 0, attributes: 3
- public static boolean sInitialized;
- descriptor: Z
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.lang.Object sObject;
- descriptor: Ljava/lang/Object;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
-}
-SourceFile: "TinyFrameworkClassWithInitializerDefault.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.class
- Compiled from "TinyFrameworkClassWithInitializerStub.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerStub
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 0, attributes: 3
- public static boolean sInitialized;
- descriptor: Z
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.lang.Object sObject;
- descriptor: Ljava/lang/Object;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
-}
-SourceFile: "TinyFrameworkClassWithInitializerStub.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestClassLoadHook(
- value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
- )
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x()
- android.hosttest.annotation.HostSideTestStaticInitializerKeep
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.class
- Compiled from "TinyFrameworkEnumComplex.java"
-public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex>
- minor version: 0
- major version: 61
- flags: (0x4031) ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_ENUM
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex
- super_class: #x // java/lang/Enum
- interfaces: 0, fields: 4, methods: 7, attributes: 4
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex RED;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex GREEN;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex BLUE;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $VALUES;
- descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex valueOf(java.lang.String);
- descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> mandated
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex(java.lang.String, java.lang.String);
- descriptor: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=5, args_size=5
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // (Ljava/lang/String;Ljava/lang/String;)V
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- MethodParameters:
- Name Flags
- <no name> synthetic
- <no name> synthetic
- <no name>
- <no name>
-
- public java.lang.String getLongName();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public java.lang.String getShortName();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;>;
-SourceFile: "TinyFrameworkEnumComplex.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.class
- Compiled from "TinyFrameworkEnumSimple.java"
-public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple>
- minor version: 0
- major version: 61
- flags: (0x4031) ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_ENUM
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple
- super_class: #x // java/lang/Enum
- interfaces: 0, fields: 3, methods: 5, attributes: 4
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple CAT;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple DOG;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $VALUES;
- descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple valueOf(java.lang.String);
- descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> mandated
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple();
- descriptor: (Ljava/lang/String;I)V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=3, args_size=3
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()V
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> synthetic
- <no name> synthetic
-
- private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;>;
-SourceFile: "TinyFrameworkEnumSimple.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.class
- Compiled from "TinyFrameworkExceptionTester.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int testException();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkExceptionTester.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.class
- Compiled from "TinyFrameworkForTextPolicy.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 5, attributes: 2
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkForTextPolicy.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested.class
- Compiled from "TinyFrameworkLambdas.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 7, attributes: 5
- public final java.util.function.Supplier<java.lang.Integer> mSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0011) ACC_PUBLIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public java.util.function.Supplier<java.lang.Integer> getSupplier();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static java.lang.Integer lambda$getSupplier_static$3();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$getSupplier$2();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$static$1();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$new$0();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
- public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
-SourceFile: "TinyFrameworkLambdas.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x()
- android.hosttest.annotation.HostSideTestStaticInitializerKeep
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas.class
- Compiled from "TinyFrameworkLambdas.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 7, attributes: 5
- public final java.util.function.Supplier<java.lang.Integer> mSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0011) ACC_PUBLIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public java.util.function.Supplier<java.lang.Integer> getSupplier();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static java.lang.Integer lambda$getSupplier_static$3();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$getSupplier$2();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$static$1();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$new$0();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
- public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
-SourceFile: "TinyFrameworkLambdas.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x()
- android.hosttest.annotation.HostSideTestStaticInitializerKeep
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class
- Compiled from "TinyFrameworkNative.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 10, attributes: 3
- int value;
- descriptor: I
- flags: (0x0000)
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static native int nativeAddTwo(int);
- descriptor: (I)I
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddTwo_should_be_like_this(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static native long nativeLongPlus(long, long);
- descriptor: (JJ)J
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static long nativeLongPlus_should_be_like_this(long, long);
- descriptor: (JJ)J
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=4, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public void setValue(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public native int nativeNonStaticAddToValue(int);
- descriptor: (I)I
- flags: (0x0101) ACC_PUBLIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int nativeNonStaticAddToValue_should_be_like_this(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static void nativeStillNotSupported_should_be_like_this();
- descriptor: ()V
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static native byte nativeBytePlus(byte, byte);
- descriptor: (BB)B
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkNative.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass(
- value="TinyFrameworkNative_host"
- )
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 1, attributes: 4
- public int value;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$InnerClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 1, attributes: 5
- public int value;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
- flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$InnerClass(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses);
- descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> final mandated
-}
-InnerClasses:
- public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 5
- public int value;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass extends com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
- super_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- interfaces: 0, fields: 0, methods: 1, attributes: 4
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 4, attributes: 5
- public final java.util.function.Supplier<java.lang.Integer> mSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0011) ACC_PUBLIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.util.function.Supplier<java.lang.Integer> getSupplier();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.class
- Compiled from "TinyFrameworkPackageRedirect.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedirect
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedirect();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int foo(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkPackageRedirect.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class
- Compiled from "TinyFrameworkRenamedClassCaller.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int foo(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkRenamedClassCaller.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class
- Compiled from "A.java"
-public class com.android.hoststubgen.test.tinyframework.packagetest.A
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "A.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class
- Compiled from "A.java"
-public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "A.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class
- Compiled from "C1.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.C1
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "C1.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C2.class
- Compiled from "C2.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends com.android.hoststubgen.test.tinyframework.subclasstest.C1
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2
- super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "C2.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C3.class
- Compiled from "C3.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends com.android.hoststubgen.test.tinyframework.subclasstest.C2
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3
- super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "C3.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CA.class
- Compiled from "CA.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.CA
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CA
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "CA.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CB.class
- Compiled from "CB.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.CB
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CB
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "CB.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I1.class
- Compiled from "I1.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I1
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "I1.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I2.class
- Compiled from "I2.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 extends com.android.hoststubgen.test.tinyframework.subclasstest.I1
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I2
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "I2.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I3.class
- Compiled from "I3.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 extends com.android.hoststubgen.test.tinyframework.subclasstest.I2
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I3
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "I3.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IA.class
- Compiled from "IA.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IA
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "IA.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IB.class
- Compiled from "IB.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IB
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "IB.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/unsupported/UnsupportedClass.class
- Compiled from "UnsupportedClass.java"
-public class com.unsupported.UnsupportedClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/unsupported/UnsupportedClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.unsupported.UnsupportedClass(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int getValue();
- descriptor: ()I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "UnsupportedClass.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class
- Compiled from "TinyFrameworkToBeRenamed.java"
-public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 3
- private final int mValue;
- descriptor: I
- flags: (0x0012) ACC_PRIVATE, ACC_FINAL
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int getValue();
- descriptor: ()I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkToBeRenamed.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt
similarity index 68%
rename from tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt
rename to tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt
index 0f5f7e7..eeec554 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-impl-dump.txt
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt
@@ -12,12 +12,12 @@
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "HostSideTestClassLoadHook.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE]
@@ -39,7 +39,7 @@
SourceFile: "HostSideTestKeep.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -48,13 +48,35 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestNativeSubstitutionClass.class
- Compiled from "HostSideTestNativeSubstitutionClass.java"
-public interface android.hosttest.annotation.HostSideTestNativeSubstitutionClass extends java.lang.annotation.Annotation
+## Class: android/hosttest/annotation/HostSideTestRedirect.class
+ Compiled from "HostSideTestRedirect.java"
+public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation
minor version: 0
major version: 61
flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestNativeSubstitutionClass
+ this_class: #x // android/hosttest/annotation/HostSideTestRedirect
+ super_class: #x // java/lang/Object
+ interfaces: 1, fields: 0, methods: 0, attributes: 2
+}
+SourceFile: "HostSideTestRedirect.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ x: #x(#x=[e#x.#x])
+ java.lang.annotation.Target(
+ value=[Ljava/lang/annotation/ElementType;.METHOD]
+ )
+ x: #x(#x=e#x.#x)
+ java.lang.annotation.Retention(
+ value=Ljava/lang/annotation/RetentionPolicy;.CLASS
+ )
+## Class: android/hosttest/annotation/HostSideTestRedirectionClass.class
+ Compiled from "HostSideTestRedirectionClass.java"
+public interface android.hosttest.annotation.HostSideTestRedirectionClass extends java.lang.annotation.Annotation
+ minor version: 0
+ major version: 61
+ flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
+ this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass
super_class: #x // java/lang/Object
interfaces: 1, fields: 0, methods: 1, attributes: 2
public abstract java.lang.String value();
@@ -62,12 +84,12 @@
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
-SourceFile: "HostSideTestNativeSubstitutionClass.java"
+SourceFile: "HostSideTestRedirectionClass.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE]
@@ -89,7 +111,7 @@
SourceFile: "HostSideTestRemove.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -98,20 +120,20 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestStub.class
- Compiled from "HostSideTestStub.java"
-public interface android.hosttest.annotation.HostSideTestStub extends java.lang.annotation.Annotation
+## Class: android/hosttest/annotation/HostSideTestStaticInitializerKeep.class
+ Compiled from "HostSideTestStaticInitializerKeep.java"
+public interface android.hosttest.annotation.HostSideTestStaticInitializerKeep extends java.lang.annotation.Annotation
minor version: 0
major version: 61
flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestStub
+ this_class: #x // android/hosttest/annotation/HostSideTestStaticInitializerKeep
super_class: #x // java/lang/Object
interfaces: 1, fields: 0, methods: 0, attributes: 2
}
-SourceFile: "HostSideTestStub.java"
+SourceFile: "HostSideTestStaticInitializerKeep.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -134,12 +156,12 @@
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "HostSideTestSubstitute.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.METHOD]
@@ -161,7 +183,7 @@
SourceFile: "HostSideTestThrow.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -183,29 +205,7 @@
SourceFile: "HostSideTestWholeClassKeep.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- x: #x(#x=[e#x.#x])
- java.lang.annotation.Target(
- value=[Ljava/lang/annotation/ElementType;.TYPE]
- )
- x: #x(#x=e#x.#x)
- java.lang.annotation.Retention(
- value=Ljava/lang/annotation/RetentionPolicy;.CLASS
- )
-## Class: android/hosttest/annotation/HostSideTestWholeClassStub.class
- Compiled from "HostSideTestWholeClassStub.java"
-public interface android.hosttest.annotation.HostSideTestWholeClassStub extends java.lang.annotation.Annotation
- minor version: 0
- major version: 61
- flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestWholeClassStub
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "HostSideTestWholeClassStub.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE]
@@ -237,9 +237,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int addTwo(int);
descriptor: (I)I
@@ -256,9 +254,7 @@
0 4 0 a I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
@@ -266,9 +262,7 @@
SourceFile: "IPretendingAidl.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub.class
Compiled from "IPretendingAidl.java"
@@ -293,9 +287,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int addOne(int);
descriptor: (I)I
@@ -312,19 +304,15 @@
0 4 0 a I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
+ public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
SourceFile: "IPretendingAidl.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl.class
Compiled from "IPretendingAidl.java"
@@ -342,9 +330,7 @@
SourceFile: "IPretendingAidl.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
@@ -362,9 +348,7 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.R$Nested();
descriptor: ()V
@@ -380,9 +364,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/R$Nested;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -400,18 +382,14 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
+ public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
SourceFile: "R.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/R
## Class: com/android/hoststubgen/test/tinyframework/R.class
Compiled from "R.java"
@@ -436,189 +414,31 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/R;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
+ public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
SourceFile: "R.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/R$Nested
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.class
- Compiled from "TinyFrameworkCallerCheck.java"
-class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl
- minor version: 0
- major version: 61
- flags: (0x0020) ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 3, attributes: 4
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOneKeep();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=4, locals=0, args_size=0
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- x: ldc #x // String getOneKeep
- x: ldc #x // String ()I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iconst_1
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestKeep
-
- public static int getOneStub();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: iconst_1
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.class
- Compiled from "TinyFrameworkCallerCheck.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations.class
+ Compiled from "TinyFrameworkAnnotations.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations
minor version: 0
major version: 61
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 3, attributes: 5
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_withCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.getOneKeep:()I
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_noCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=1, locals=0, args_size=0
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.getOneStub:()I
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.class
- Compiled from "TinyFrameworkClassAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 8, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
+ interfaces: 0, fields: 1, methods: 7, attributes: 3
public int keep;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -628,12 +448,12 @@
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=2, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
+ x: ldc #x // String com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations();
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
@@ -642,70 +462,36 @@
x: invokespecial #x // Method java/lang/Object."<init>":()V
x: aload_0
x: iconst_1
- x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
+ x: putfield #x // Field keep:I
+ x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public int addOne(int);
descriptor: (I)I
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=2, args_size=2
- x: aload_0
x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
+ x: iconst_1
+ x: iadd
x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
- 0 6 1 value I
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
+ 0 4 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iload_1
- x: iconst_1
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 15 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
- 15 4 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -722,15 +508,13 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
0 4 1 value I
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddThree(int);
descriptor: (I)I
@@ -749,277 +533,55 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.String unsupportedMethod();
descriptor: ()Ljava/lang/String;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String unsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Unreachable
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ stack=3, locals=1, args_size=1
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: ldc #x // String Unreachable
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
x: athrow
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestThrow
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
+ public int toBeIgnored();
+ descriptor: ()I
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ x: iconst_0
+ x: ireturn
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestIgnore
}
-SourceFile: "TinyFrameworkClassAnnotations.java"
+SourceFile: "TinyFrameworkAnnotations.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x(#x=s#x)
android.hosttest.annotation.HostSideTestClassLoadHook(
value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
)
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.class
- Compiled from "TinyFrameworkClassClassWideAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 8, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int remove;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=1, args_size=1
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: aload_0
- x: iconst_1
- x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 6 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: iload_1
- x: iconst_1
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 4 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public void toBeRemoved(java.lang.String);
- descriptor: (Ljava/lang/String;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
- x: athrow
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 8 1 foo Ljava/lang/String;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=2, locals=2, args_size=2
- x: iload_1
- x: iconst_2
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 0 4 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=2, locals=1, args_size=1
- x: iload_0
- x: iconst_3
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 4 0 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String unsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: ldc #x // String This value shouldn\'t be seen on the host side.
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkClassClassWideAnnotations.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.class
Compiled from "TinyFrameworkClassLoadHook.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook
@@ -1035,9 +597,7 @@
Signature: #x // Ljava/util/Set<Ljava/lang/Class<*>;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook();
descriptor: ()V
@@ -1053,9 +613,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static void onClassLoaded(java.lang.Class<?>);
descriptor: (Ljava/lang/Class;)V
@@ -1077,9 +635,7 @@
Signature: #x // (Ljava/lang/Class<*>;)V
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -1094,19 +650,115 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkClassLoadHook.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations.class
+ Compiled from "TinyFrameworkClassWideAnnotations.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAnnotations
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 1, methods: 4, attributes: 3
+ public int keep;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAnnotations();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: iconst_1
+ x: putfield #x // Field keep:I
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public int addOne(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_1
+ x: iconst_1
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 0 4 1 value I
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public int addTwo(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_1
+ x: iconst_2
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 0 4 1 value I
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public java.lang.String unsupportedMethod();
+ descriptor: ()Ljava/lang/String;
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=3, locals=1, args_size=1
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: ldc #x // String Unreachable
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ x: athrow
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestThrow
+}
+SourceFile: "TinyFrameworkClassWideAnnotations.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.class
Compiled from "TinyFrameworkClassWithInitializerDefault.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerDefault
@@ -1121,35 +773,29 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.lang.Object sObject;
descriptor: Ljava/lang/Object;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
}
SourceFile: "TinyFrameworkClassWithInitializerDefault.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.class
Compiled from "TinyFrameworkClassWithInitializerStub.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerStub
@@ -1164,24 +810,20 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.lang.Object sObject;
descriptor: Ljava/lang/Object;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
static {};
descriptor: ()V
@@ -1201,21 +843,19 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkClassWithInitializerStub.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x(#x=s#x)
android.hosttest.annotation.HostSideTestClassLoadHook(
value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
)
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.class
@@ -1232,43 +872,37 @@
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex GREEN;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex BLUE;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private final java.lang.String mLongName;
descriptor: Ljava/lang/String;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -1278,7 +912,7 @@
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -1288,9 +922,7 @@
flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1304,9 +936,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex valueOf(java.lang.String);
descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1324,9 +954,7 @@
0 10 0 name Ljava/lang/String;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> mandated
@@ -1356,12 +984,10 @@
Signature: #x // (Ljava/lang/String;Ljava/lang/String;)V
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
MethodParameters:
Name Flags
<no name> synthetic
@@ -1383,12 +1009,10 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.lang.String getShortName();
descriptor: ()Ljava/lang/String;
@@ -1404,12 +1028,10 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1434,9 +1056,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -1473,20 +1093,16 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;>;
SourceFile: "TinyFrameworkEnumComplex.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.class
Compiled from "TinyFrameworkEnumSimple.java"
public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple>
@@ -1501,33 +1117,27 @@
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple DOG;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $VALUES;
descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
@@ -1541,9 +1151,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple valueOf(java.lang.String);
descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
@@ -1561,9 +1169,7 @@
0 10 0 name Ljava/lang/String;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> mandated
@@ -1585,9 +1191,7 @@
Signature: #x // ()V
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> synthetic
@@ -1612,9 +1216,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -1639,20 +1241,16 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;>;
SourceFile: "TinyFrameworkEnumSimple.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.class
Compiled from "TinyFrameworkExceptionTester.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester
@@ -1676,9 +1274,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int testException();
descriptor: ()I
@@ -1709,19 +1305,15 @@
11 11 0 e Ljava/lang/Exception;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkExceptionTester.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.class
Compiled from "TinyFrameworkForTextPolicy.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy
@@ -1730,22 +1322,13 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 8, attributes: 2
+ interfaces: 0, fields: 1, methods: 15, attributes: 2
public int stub;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -1753,7 +1336,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
+ x: ldc #x // String com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -1767,63 +1350,148 @@
x: aload_0
x: iconst_1
x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
+ x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+ 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int addOne(int);
descriptor: (I)I
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=2, args_size=2
- x: aload_0
x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
+ x: iconst_1
+ x: iadd
x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- 0 6 1 value I
+ 0 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+ 0 4 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
- public int addOneInner(int);
- descriptor: (I)I
+ public java.lang.String toBeIgnoredObj();
+ descriptor: ()Ljava/lang/String;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iload_1
- x: iconst_1
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 15 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- 15 4 1 value I
+ stack=1, locals=1, args_size=1
+ x: aconst_null
+ x: areturn
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public void toBeIgnoredV();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=0, locals=1, args_size=1
+ x: return
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public boolean toBeIgnoredZ();
+ descriptor: ()Z
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public byte toBeIgnoredB();
+ descriptor: ()B
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public char toBeIgnoredC();
+ descriptor: ()C
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public short toBeIgnoredS();
+ descriptor: ()S
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public int toBeIgnoredI();
+ descriptor: ()I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public float toBeIgnoredF();
+ descriptor: ()F
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: fconst_0
+ x: freturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public double toBeIgnoredD();
+ descriptor: ()D
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: dconst_0
+ x: dreturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int addTwo(int);
descriptor: (I)I
@@ -1843,9 +1511,7 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddThree(int);
descriptor: (I)I
@@ -1864,57 +1530,29 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.String unsupportedMethod();
descriptor: ()Ljava/lang/String;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String unsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Unreachable
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ stack=3, locals=1, args_size=1
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: ldc #x // String Unreachable
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
x: athrow
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=1, locals=1, args_size=1
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkForTextPolicy.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested.class
Compiled from "TinyFrameworkLambdas.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested
@@ -1930,12 +1568,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -1943,12 +1579,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested();
descriptor: ()V
@@ -1967,12 +1601,10 @@
0 14 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -1988,12 +1620,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -2006,12 +1636,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static java.lang.Integer lambda$getSupplier_static$3();
descriptor: ()Ljava/lang/Integer;
@@ -2024,9 +1652,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$getSupplier$2();
descriptor: ()Ljava/lang/Integer;
@@ -2039,9 +1665,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$static$1();
descriptor: ()Ljava/lang/Integer;
@@ -2054,9 +1678,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$new$0();
descriptor: ()Ljava/lang/Integer;
@@ -2069,9 +1691,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -2084,7 +1704,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
@@ -2092,12 +1712,10 @@
SourceFile: "TinyFrameworkLambdas.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
BootstrapMethods:
@@ -2137,12 +1755,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -2150,12 +1766,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas();
descriptor: ()V
@@ -2174,12 +1788,10 @@
0 14 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -2195,12 +1807,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -2213,12 +1823,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static java.lang.Integer lambda$getSupplier_static$3();
descriptor: ()Ljava/lang/Integer;
@@ -2231,9 +1839,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$getSupplier$2();
descriptor: ()Ljava/lang/Integer;
@@ -2246,9 +1852,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$static$1();
descriptor: ()Ljava/lang/Integer;
@@ -2261,9 +1865,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$new$0();
descriptor: ()Ljava/lang/Integer;
@@ -2276,9 +1878,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -2291,7 +1891,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
@@ -2299,12 +1899,10 @@
SourceFile: "TinyFrameworkLambdas.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
BootstrapMethods:
@@ -2330,6 +1928,184 @@
#x ()Ljava/lang/Integer;
NestMembers:
com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class
+ Compiled from "TinyFrameworkMethodCallReplace.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 0, methods: 3, attributes: 4
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static void startThread(java.lang.Thread);
+ descriptor: (Ljava/lang/Thread;)V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: iconst_1
+ x: invokevirtual #x // Method java/lang/Thread.setDaemon:(Z)V
+ x: aload_0
+ x: invokevirtual #x // Method java/lang/Thread.start:()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 10 0 thread Ljava/lang/Thread;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static int add(int, int);
+ descriptor: (II)I
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=2, args_size=2
+ x: iload_0
+ x: iload_1
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 4 0 a I
+ 0 4 1 b I
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+}
+InnerClasses:
+ public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+SourceFile: "TinyFrameworkMethodCallReplace.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.class
+ Compiled from "TinyFrameworkMethodCallReplace.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 0, methods: 4, attributes: 6
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static boolean nonStaticMethodCallReplaceTester() throws java.lang.Exception;
+ descriptor: ()Z
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=3, locals=2, args_size=0
+ x: new #x // class java/util/concurrent/atomic/AtomicBoolean
+ x: dup
+ x: iconst_0
+ x: invokespecial #x // Method java/util/concurrent/atomic/AtomicBoolean."<init>":(Z)V
+ x: astore_0
+ x: new #x // class java/lang/Thread
+ x: dup
+ x: aload_0
+ x: invokedynamic #x, 0 // InvokeDynamic #x:run:(Ljava/util/concurrent/atomic/AtomicBoolean;)Ljava/lang/Runnable;
+ x: invokespecial #x // Method java/lang/Thread."<init>":(Ljava/lang/Runnable;)V
+ x: astore_1
+ x: aload_1
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.startThread:(Ljava/lang/Thread;)V
+ x: aload_1
+ x: invokevirtual #x // Method java/lang/Thread.join:()V
+ x: aload_0
+ x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.get:()Z
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 9 27 0 ab Ljava/util/concurrent/atomic/AtomicBoolean;
+ 23 13 1 th Ljava/lang/Thread;
+ Exceptions:
+ throws java.lang.Exception
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static int staticMethodCallReplaceTester();
+ descriptor: ()I
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: iconst_1
+ x: iconst_2
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.add:(II)I
+ x: ireturn
+ LineNumberTable:
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean);
+ descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;
+ x: invokevirtual #x // Method java/lang/Thread.isDaemon:()Z
+ x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.set:(Z)V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 11 0 ab Ljava/util/concurrent/atomic/AtomicBoolean;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+}
+InnerClasses:
+ public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
+SourceFile: "TinyFrameworkMethodCallReplace.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestWholeClassKeep
+BootstrapMethods:
+ x: #x REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
+ Method arguments:
+ #x ()V
+ #x REF_invokeStatic com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.lambda$nonStaticMethodCallReplaceTester$0:(Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ #x ()V
+NestMembers:
+ com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class
Compiled from "TinyFrameworkNative.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative
@@ -2338,15 +2114,13 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 11, attributes: 3
+ interfaces: 0, fields: 1, methods: 14, attributes: 3
int value;
descriptor: I
flags: (0x0000)
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative();
descriptor: ()V
@@ -2362,9 +2136,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddTwo(int);
descriptor: (I)I
@@ -2378,9 +2150,10 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
public static int nativeAddTwo_should_be_like_this(int);
descriptor: (I)I
@@ -2396,9 +2169,7 @@
0 5 0 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static long nativeLongPlus(long, long);
descriptor: (JJ)J
@@ -2413,9 +2184,10 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
public static long nativeLongPlus_should_be_like_this(long, long);
descriptor: (JJ)J
@@ -2433,9 +2205,7 @@
0 6 2 arg2 J
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public void setValue(int);
descriptor: (I)V
@@ -2453,9 +2223,7 @@
0 6 1 v I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int nativeNonStaticAddToValue(int);
descriptor: (I)I
@@ -2470,9 +2238,10 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
public int nativeNonStaticAddToValue_should_be_like_this(int);
descriptor: (I)I
@@ -2490,38 +2259,35 @@
0 6 1 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static void nativeStillNotSupported();
descriptor: ()V
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
- stack=4, locals=0, args_size=0
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- x: ldc #x // String nativeStillNotSupported
- x: ldc #x // String ()V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Unreachable
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ stack=3, locals=0, args_size=0
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: ldc #x // String Unreachable
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
x: athrow
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestThrow
+ public static native void nativeStillKeep();
+ descriptor: ()V
+ flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
public static void nativeStillNotSupported_should_be_like_this();
descriptor: ()V
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
@@ -2534,9 +2300,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static byte nativeBytePlus(byte, byte);
descriptor: (BB)B
@@ -2551,21 +2315,53 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
+
+ public void notNativeRedirected();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.notNativeRedirected:(Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;)V
+ x: return
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
+
+ public static void notNativeStaticRedirected();
+ descriptor: ()V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=0, locals=0, args_size=0
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.notNativeStaticRedirected:()V
+ x: return
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
}
SourceFile: "TinyFrameworkNative.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass(
+ android.hosttest.annotation.HostSideTestRedirectionClass(
value="TinyFrameworkNative_host"
)
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.class
@@ -2576,130 +2372,125 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 5, attributes: 3
+ interfaces: 0, fields: 0, methods: 7, attributes: 3
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String <init>
- x: ldc #x // String ()V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddTwo(int);
descriptor: (I)I
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeAddTwo
- x: ldc #x // String (I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iload_0
- x: iconst_2
- x: iadd
- x: ireturn
+ stack=2, locals=1, args_size=1
+ x: iload_0
+ x: iconst_2
+ x: iadd
+ x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 4 0 arg I
+ 0 4 0 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static long nativeLongPlus(long, long);
descriptor: (JJ)J
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=4, args_size=2
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeLongPlus
- x: ldc #x // String (JJ)J
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: lload_0
- x: lload_2
- x: ladd
- x: lreturn
+ x: lload_0
+ x: lload_2
+ x: ladd
+ x: lreturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 4 0 arg1 J
- 15 4 2 arg2 J
+ 0 4 0 arg1 J
+ 0 4 2 arg2 J
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeNonStaticAddToValue(com.android.hoststubgen.test.tinyframework.TinyFrameworkNative, int);
descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;I)I
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeNonStaticAddToValue
- x: ldc #x // String (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: getfield #x // Field com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.value:I
- x: iload_1
- x: iadd
- x: ireturn
+ stack=2, locals=2, args_size=2
+ x: aload_0
+ x: getfield #x // Field com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.value:I
+ x: iload_1
+ x: iadd
+ x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 7 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
- 15 7 1 arg I
+ 0 7 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
+ 0 7 1 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static byte nativeBytePlus(byte, byte);
descriptor: (BB)B
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeBytePlus
- x: ldc #x // String (BB)B
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iload_0
- x: iload_1
- x: iadd
- x: i2b
- x: ireturn
+ stack=2, locals=2, args_size=2
+ x: iload_0
+ x: iload_1
+ x: iadd
+ x: i2b
+ x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 arg1 B
- 15 5 1 arg2 B
+ 0 5 0 arg1 B
+ 0 5 1 arg2 B
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static void notNativeRedirected(com.android.hoststubgen.test.tinyframework.TinyFrameworkNative);
+ descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;)V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=0, locals=1, args_size=1
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 1 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static void notNativeStaticRedirected();
+ descriptor: ()V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=0, locals=0, args_size=0
+ x: return
+ LineNumberTable:
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkNative_host.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestWholeClassKeep
@@ -2717,7 +2508,7 @@
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$1(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses);
descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V
@@ -2737,7 +2528,7 @@
0 10 1 this$0 Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> final mandated
@@ -2746,45 +2537,33 @@
descriptor: ()Ljava/lang/Integer;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iconst_1
- x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: iconst_1
+ x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokevirtual #x // Method get:()Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokevirtual #x // Method get:()Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
@@ -2793,7 +2572,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -2818,51 +2597,39 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Integer get();
descriptor: ()Ljava/lang/Integer;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iconst_2
- x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: iconst_2
+ x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokevirtual #x // Method get:()Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokevirtual #x // Method get:()Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
@@ -2871,7 +2638,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -2887,7 +2654,7 @@
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$3(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses);
descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V
@@ -2907,7 +2674,7 @@
0 10 1 this$0 Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> final mandated
@@ -2916,45 +2683,33 @@
descriptor: ()Ljava/lang/Integer;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iconst_3
- x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: iconst_3
+ x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokevirtual #x // Method get:()Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokevirtual #x // Method get:()Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
@@ -2963,7 +2718,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -2988,51 +2743,39 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Integer get();
descriptor: ()Ljava/lang/Integer;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iconst_4
- x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: iconst_4
+ x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokevirtual #x // Method get:()Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokevirtual #x // Method get:()Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
@@ -3041,7 +2784,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3057,9 +2800,7 @@
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass(int);
descriptor: (I)V
@@ -3079,18 +2820,14 @@
0 10 1 x I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3100,24 +2837,20 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 1, attributes: 5
+ interfaces: 0, fields: 2, methods: 1, attributes: 4
public int value;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$InnerClass(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses);
descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V
@@ -3140,24 +2873,17 @@
0 15 1 this$0 Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> final mandated
}
InnerClasses:
- public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3182,51 +2908,39 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Integer get();
descriptor: ()Ljava/lang/Integer;
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: bipush 7
- x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: bipush 7
+ x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
+ 0 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokevirtual #x // Method get:()Ljava/lang/Integer;
- x: areturn
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: invokevirtual #x // Method get:()Ljava/lang/Integer;
+ x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
+ 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
@@ -3236,7 +2950,50 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass.class
+ Compiled from "TinyFrameworkNestedClasses.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 1, methods: 1, attributes: 4
+ public int value;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=2, locals=1, args_size=1
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: bipush 8
+ x: putfield #x // Field value:I
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 0 11 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+}
+InnerClasses:
+ public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
+SourceFile: "TinyFrameworkNestedClasses.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3246,15 +3003,13 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 5
+ interfaces: 0, fields: 1, methods: 2, attributes: 4
public int value;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass();
descriptor: ()V
@@ -3273,9 +3028,7 @@
0 11 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -3290,22 +3043,16 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3332,19 +3079,15 @@
0 6 1 x I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3361,9 +3104,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -3371,9 +3112,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses();
descriptor: ()V
@@ -3395,9 +3134,7 @@
0 17 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -3416,9 +3153,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -3433,9 +3168,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -3450,33 +3183,31 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
+ com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
@@ -3506,9 +3237,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int foo(int);
descriptor: (I)I
@@ -3527,19 +3256,15 @@
0 12 0 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkPackageRedirect.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class
Compiled from "TinyFrameworkRenamedClassCaller.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller
@@ -3563,9 +3288,7 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int foo(int);
descriptor: (I)I
@@ -3584,19 +3307,15 @@
0 12 0 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkRenamedClassCaller.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class
Compiled from "A.java"
public class com.android.hoststubgen.test.tinyframework.packagetest.A
@@ -3610,9 +3329,7 @@
SourceFile: "A.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class
Compiled from "A.java"
public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A
@@ -3626,9 +3343,7 @@
SourceFile: "A.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class
Compiled from "C1.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.C1
@@ -3642,9 +3357,7 @@
SourceFile: "C1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C2.class
Compiled from "C2.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends com.android.hoststubgen.test.tinyframework.subclasstest.C1
@@ -3658,9 +3371,7 @@
SourceFile: "C2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C3.class
Compiled from "C3.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends com.android.hoststubgen.test.tinyframework.subclasstest.C2
@@ -3674,9 +3385,7 @@
SourceFile: "C3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CA.class
Compiled from "CA.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.CA
@@ -3690,9 +3399,7 @@
SourceFile: "CA.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CB.class
Compiled from "CB.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.CB
@@ -3706,9 +3413,7 @@
SourceFile: "CB.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_C1.class
Compiled from "Class_C1.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C1 extends com.android.hoststubgen.test.tinyframework.subclasstest.C1
@@ -3722,7 +3427,7 @@
SourceFile: "Class_C1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_C2.class
Compiled from "Class_C2.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C2 extends com.android.hoststubgen.test.tinyframework.subclasstest.C2
@@ -3736,7 +3441,7 @@
SourceFile: "Class_C2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_C3.class
Compiled from "Class_C3.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C3 extends com.android.hoststubgen.test.tinyframework.subclasstest.C3
@@ -3750,7 +3455,7 @@
SourceFile: "Class_C3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1.class
Compiled from "Class_I1.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1 implements com.android.hoststubgen.test.tinyframework.subclasstest.I1
@@ -3764,7 +3469,7 @@
SourceFile: "Class_I1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1_IA.class
Compiled from "Class_I1_IA.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1_IA implements com.android.hoststubgen.test.tinyframework.subclasstest.I1,com.android.hoststubgen.test.tinyframework.subclasstest.IA
@@ -3778,7 +3483,7 @@
SourceFile: "Class_I1_IA.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I2.class
Compiled from "Class_I2.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I2 implements com.android.hoststubgen.test.tinyframework.subclasstest.I2
@@ -3792,7 +3497,7 @@
SourceFile: "Class_I2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I3.class
Compiled from "Class_I3.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I3 implements com.android.hoststubgen.test.tinyframework.subclasstest.I3
@@ -3806,7 +3511,7 @@
SourceFile: "Class_I3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I1.class
Compiled from "I1.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1
@@ -3820,9 +3525,7 @@
SourceFile: "I1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I2.class
Compiled from "I2.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 extends com.android.hoststubgen.test.tinyframework.subclasstest.I1
@@ -3836,9 +3539,7 @@
SourceFile: "I2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I3.class
Compiled from "I3.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 extends com.android.hoststubgen.test.tinyframework.subclasstest.I2
@@ -3852,9 +3553,7 @@
SourceFile: "I3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IA.class
Compiled from "IA.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA
@@ -3868,9 +3567,7 @@
SourceFile: "IA.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IB.class
Compiled from "IB.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB
@@ -3884,9 +3581,7 @@
SourceFile: "IB.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/supported/UnsupportedClass.class
Compiled from "UnsupportedClass.java"
public class com.supported.UnsupportedClass
@@ -3901,60 +3596,48 @@
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.supported.UnsupportedClass(int);
descriptor: (I)V
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // String com/supported/UnsupportedClass
- x: ldc #x // String <init>
- x: ldc #x // String (I)V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: aload_0
- x: iload_1
- x: putfield #x // Field mValue:I
- x: return
+ stack=2, locals=2, args_size=2
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: iload_1
+ x: putfield #x // Field mValue:I
+ x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 10 0 this Lcom/supported/UnsupportedClass;
- 15 10 1 value I
+ 0 10 0 this Lcom/supported/UnsupportedClass;
+ 0 10 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int getValue();
descriptor: ()I
flags: (0x0001) ACC_PUBLIC
Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // String com/supported/UnsupportedClass
- x: ldc #x // String getValue
- x: ldc #x // String ()I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: aload_0
- x: getfield #x // Field mValue:I
- x: ireturn
+ stack=1, locals=1, args_size=1
+ x: aload_0
+ x: getfield #x // Field mValue:I
+ x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 15 5 0 this Lcom/supported/UnsupportedClass;
+ 0 5 0 this Lcom/supported/UnsupportedClass;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "UnsupportedClass.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestWholeClassKeep
@@ -3986,9 +3669,7 @@
0 14 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int getValue();
descriptor: ()I
@@ -4006,19 +3687,15 @@
0 10 0 this Lcom/unsupported/UnsupportedClass;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "UnsupportedClass.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class
Compiled from "TinyFrameworkToBeRenamed.java"
public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed
@@ -4033,9 +3710,7 @@
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int);
descriptor: (I)V
@@ -4055,9 +3730,7 @@
0 10 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int getValue();
descriptor: ()I
@@ -4073,16 +3746,12 @@
0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkToBeRenamed.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt
deleted file mode 100644
index 17ba48c..0000000
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/12-hoststubgen-test-tiny-framework-host-ext-stub-dump.txt
+++ /dev/null
@@ -1,2530 +0,0 @@
-## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy.class
- Compiled from "IPretendingAidl.java"
-public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Proxy
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 4
- public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Proxy();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int addTwo(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
-SourceFile: "IPretendingAidl.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
-## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub.class
- Compiled from "IPretendingAidl.java"
-public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 4
- public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int addOne(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
-SourceFile: "IPretendingAidl.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
-## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl.class
- Compiled from "IPretendingAidl.java"
-public interface com.android.hoststubgen.test.tinyframework.IPretendingAidl
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 4
-}
-InnerClasses:
- public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- public static #x= #x of #x; // Proxy=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy of class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
-SourceFile: "IPretendingAidl.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestMembers:
- com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
- com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
-## Class: com/android/hoststubgen/test/tinyframework/R$Nested.class
- Compiled from "R.java"
-public class com.android.hoststubgen.test.tinyframework.R$Nested
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/R$Nested
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 4
- public static int[] ARRAY;
- descriptor: [I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.R$Nested();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
-SourceFile: "R.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/R
-## Class: com/android/hoststubgen/test/tinyframework/R.class
- Compiled from "R.java"
-public class com.android.hoststubgen.test.tinyframework.R
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/R
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 1, attributes: 4
- public com.android.hoststubgen.test.tinyframework.R();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
-SourceFile: "R.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestMembers:
- com/android/hoststubgen/test/tinyframework/R$Nested
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.class
- Compiled from "TinyFrameworkCallerCheck.java"
-class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl
- minor version: 0
- major version: 61
- flags: (0x0020) ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 4
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOneStub();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.class
- Compiled from "TinyFrameworkCallerCheck.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 3, attributes: 5
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_withCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_noCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.class
- Compiled from "TinyFrameworkClassAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 5, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-SourceFile: "TinyFrameworkClassAnnotations.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestClassLoadHook(
- value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
- )
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.class
- Compiled from "TinyFrameworkClassClassWideAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 8, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int remove;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public void toBeRemoved(java.lang.String);
- descriptor: (Ljava/lang/String;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String unsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkClassClassWideAnnotations.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.class
- Compiled from "TinyFrameworkClassLoadHook.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 3, attributes: 3
- public static final java.util.Set<java.lang.Class<?>> sLoadedClasses;
- descriptor: Ljava/util/Set;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/Set<Ljava/lang/Class<*>;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static void onClassLoaded(java.lang.Class<?>);
- descriptor: (Ljava/lang/Class;)V
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // (Ljava/lang/Class<*>;)V
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkClassLoadHook.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.class
- Compiled from "TinyFrameworkClassWithInitializerDefault.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerDefault
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 0, attributes: 3
- public static boolean sInitialized;
- descriptor: Z
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.lang.Object sObject;
- descriptor: Ljava/lang/Object;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
-}
-SourceFile: "TinyFrameworkClassWithInitializerDefault.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.class
- Compiled from "TinyFrameworkClassWithInitializerStub.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerStub
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 0, attributes: 3
- public static boolean sInitialized;
- descriptor: Z
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.lang.Object sObject;
- descriptor: Ljava/lang/Object;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
-}
-SourceFile: "TinyFrameworkClassWithInitializerStub.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestClassLoadHook(
- value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
- )
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x()
- android.hosttest.annotation.HostSideTestStaticInitializerKeep
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.class
- Compiled from "TinyFrameworkEnumComplex.java"
-public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex>
- minor version: 0
- major version: 61
- flags: (0x4031) ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_ENUM
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex
- super_class: #x // java/lang/Enum
- interfaces: 0, fields: 4, methods: 7, attributes: 4
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex RED;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex GREEN;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex BLUE;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $VALUES;
- descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex valueOf(java.lang.String);
- descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> mandated
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex(java.lang.String, java.lang.String);
- descriptor: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=5, args_size=5
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // (Ljava/lang/String;Ljava/lang/String;)V
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- MethodParameters:
- Name Flags
- <no name> synthetic
- <no name> synthetic
- <no name>
- <no name>
-
- public java.lang.String getLongName();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public java.lang.String getShortName();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;>;
-SourceFile: "TinyFrameworkEnumComplex.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.class
- Compiled from "TinyFrameworkEnumSimple.java"
-public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple>
- minor version: 0
- major version: 61
- flags: (0x4031) ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_ENUM
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple
- super_class: #x // java/lang/Enum
- interfaces: 0, fields: 3, methods: 5, attributes: 4
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple CAT;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple DOG;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $VALUES;
- descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple valueOf(java.lang.String);
- descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> mandated
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple();
- descriptor: (Ljava/lang/String;I)V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=3, locals=3, args_size=3
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()V
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> synthetic
- <no name> synthetic
-
- private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $values();
- descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;>;
-SourceFile: "TinyFrameworkEnumSimple.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.class
- Compiled from "TinyFrameworkExceptionTester.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int testException();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkExceptionTester.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.class
- Compiled from "TinyFrameworkForTextPolicy.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 5, attributes: 2
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkForTextPolicy.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested.class
- Compiled from "TinyFrameworkLambdas.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 7, attributes: 5
- public final java.util.function.Supplier<java.lang.Integer> mSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0011) ACC_PUBLIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public java.util.function.Supplier<java.lang.Integer> getSupplier();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static java.lang.Integer lambda$getSupplier_static$3();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$getSupplier$2();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$static$1();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$new$0();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
- public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
-SourceFile: "TinyFrameworkLambdas.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x()
- android.hosttest.annotation.HostSideTestStaticInitializerKeep
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas.class
- Compiled from "TinyFrameworkLambdas.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 7, attributes: 5
- public final java.util.function.Supplier<java.lang.Integer> mSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0011) ACC_PUBLIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public java.util.function.Supplier<java.lang.Integer> getSupplier();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- private static java.lang.Integer lambda$getSupplier_static$3();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$getSupplier$2();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$static$1();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static java.lang.Integer lambda$new$0();
- descriptor: ()Ljava/lang/Integer;
- flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
- public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
-SourceFile: "TinyFrameworkLambdas.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
- x: #x()
- android.hosttest.annotation.HostSideTestStaticInitializerKeep
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class
- Compiled from "TinyFrameworkNative.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 10, attributes: 3
- int value;
- descriptor: I
- flags: (0x0000)
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static native int nativeAddTwo(int);
- descriptor: (I)I
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddTwo_should_be_like_this(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static native long nativeLongPlus(long, long);
- descriptor: (JJ)J
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static long nativeLongPlus_should_be_like_this(long, long);
- descriptor: (JJ)J
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=4, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public void setValue(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public native int nativeNonStaticAddToValue(int);
- descriptor: (I)I
- flags: (0x0101) ACC_PUBLIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int nativeNonStaticAddToValue_should_be_like_this(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static void nativeStillNotSupported_should_be_like_this();
- descriptor: ()V
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static native byte nativeBytePlus(byte, byte);
- descriptor: (BB)B
- flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkNative.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
- x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass(
- value="TinyFrameworkNative_host"
- )
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 1, attributes: 4
- public int value;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$InnerClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 1, attributes: 5
- public int value;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0;
- descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
- flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$InnerClass(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses);
- descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- MethodParameters:
- Name Flags
- <no name> final mandated
-}
-InnerClasses:
- public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 5
- public int value;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass extends com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$BaseClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
- super_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- interfaces: 0, fields: 0, methods: 1, attributes: 4
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.class
- Compiled from "TinyFrameworkNestedClasses.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 4, attributes: 5
- public final java.util.function.Supplier<java.lang.Integer> mSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0011) ACC_PUBLIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
- descriptor: Ljava/util/function/Supplier;
- flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
- Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.util.function.Supplier<java.lang.Integer> getSupplier();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
- descriptor: ()Ljava/util/function/Supplier;
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- static {};
- descriptor: ()V
- flags: (0x0008) ACC_STATIC
- Code:
- stack=3, locals=0, args_size=0
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
- #x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
-SourceFile: "TinyFrameworkNestedClasses.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.class
- Compiled from "TinyFrameworkPackageRedirect.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedirect
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedirect();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int foo(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkPackageRedirect.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class
- Compiled from "TinyFrameworkRenamedClassCaller.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int foo(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkRenamedClassCaller.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class
- Compiled from "A.java"
-public class com.android.hoststubgen.test.tinyframework.packagetest.A
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "A.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class
- Compiled from "A.java"
-public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "A.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class
- Compiled from "C1.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.C1
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "C1.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C2.class
- Compiled from "C2.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends com.android.hoststubgen.test.tinyframework.subclasstest.C1
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2
- super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "C2.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C3.class
- Compiled from "C3.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends com.android.hoststubgen.test.tinyframework.subclasstest.C2
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3
- super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "C3.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CA.class
- Compiled from "CA.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.CA
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CA
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "CA.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CB.class
- Compiled from "CB.java"
-public class com.android.hoststubgen.test.tinyframework.subclasstest.CB
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CB
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "CB.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I1.class
- Compiled from "I1.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I1
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "I1.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I2.class
- Compiled from "I2.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 extends com.android.hoststubgen.test.tinyframework.subclasstest.I1
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I2
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "I2.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I3.class
- Compiled from "I3.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 extends com.android.hoststubgen.test.tinyframework.subclasstest.I2
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I3
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "I3.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IA.class
- Compiled from "IA.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IA
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "IA.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IB.class
- Compiled from "IB.java"
-public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB
- minor version: 0
- major version: 61
- flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
- this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IB
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 0, attributes: 2
-}
-SourceFile: "IB.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-## Class: com/unsupported/UnsupportedClass.class
- Compiled from "UnsupportedClass.java"
-public class com.unsupported.UnsupportedClass
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/unsupported/UnsupportedClass
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 2, attributes: 3
- public com.unsupported.UnsupportedClass(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int getValue();
- descriptor: ()I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "UnsupportedClass.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class
- Compiled from "TinyFrameworkToBeRenamed.java"
-public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 2, attributes: 3
- private final int mValue;
- descriptor: I
- flags: (0x0012) ACC_PRIVATE, ACC_FINAL
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed(int);
- descriptor: (I)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=2, args_size=2
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int getValue();
- descriptor: ()I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=3, locals=1, args_size=1
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: ldc #x // String Stub!
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
- x: athrow
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkToBeRenamed.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt
similarity index 78%
rename from tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt
rename to tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt
index 3beea64..0f8af92 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-impl-dump.txt
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt
@@ -22,12 +22,12 @@
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "HostSideTestClassLoadHook.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE]
@@ -58,7 +58,7 @@
SourceFile: "HostSideTestKeep.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -67,13 +67,44 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestNativeSubstitutionClass.class
- Compiled from "HostSideTestNativeSubstitutionClass.java"
-public interface android.hosttest.annotation.HostSideTestNativeSubstitutionClass extends java.lang.annotation.Annotation
+## Class: android/hosttest/annotation/HostSideTestRedirect.class
+ Compiled from "HostSideTestRedirect.java"
+public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation
minor version: 0
major version: 61
flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestNativeSubstitutionClass
+ this_class: #x // android/hosttest/annotation/HostSideTestRedirect
+ super_class: #x // java/lang/Object
+ interfaces: 1, fields: 0, methods: 1, attributes: 2
+ private static {};
+ descriptor: ()V
+ flags: (0x000a) ACC_PRIVATE, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: ldc #x // class android/hosttest/annotation/HostSideTestRedirect
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
+ x: return
+}
+SourceFile: "HostSideTestRedirect.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ x: #x(#x=[e#x.#x])
+ java.lang.annotation.Target(
+ value=[Ljava/lang/annotation/ElementType;.METHOD]
+ )
+ x: #x(#x=e#x.#x)
+ java.lang.annotation.Retention(
+ value=Ljava/lang/annotation/RetentionPolicy;.CLASS
+ )
+## Class: android/hosttest/annotation/HostSideTestRedirectionClass.class
+ Compiled from "HostSideTestRedirectionClass.java"
+public interface android.hosttest.annotation.HostSideTestRedirectionClass extends java.lang.annotation.Annotation
+ minor version: 0
+ major version: 61
+ flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
+ this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass
super_class: #x // java/lang/Object
interfaces: 1, fields: 0, methods: 2, attributes: 2
private static {};
@@ -81,7 +112,7 @@
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=2, locals=0, args_size=0
- x: ldc #x // class android/hosttest/annotation/HostSideTestNativeSubstitutionClass
+ x: ldc #x // class android/hosttest/annotation/HostSideTestRedirectionClass
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -91,12 +122,12 @@
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
-SourceFile: "HostSideTestNativeSubstitutionClass.java"
+SourceFile: "HostSideTestRedirectionClass.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE]
@@ -127,7 +158,7 @@
SourceFile: "HostSideTestRemove.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -136,13 +167,13 @@
java.lang.annotation.Retention(
value=Ljava/lang/annotation/RetentionPolicy;.CLASS
)
-## Class: android/hosttest/annotation/HostSideTestStub.class
- Compiled from "HostSideTestStub.java"
-public interface android.hosttest.annotation.HostSideTestStub extends java.lang.annotation.Annotation
+## Class: android/hosttest/annotation/HostSideTestStaticInitializerKeep.class
+ Compiled from "HostSideTestStaticInitializerKeep.java"
+public interface android.hosttest.annotation.HostSideTestStaticInitializerKeep extends java.lang.annotation.Annotation
minor version: 0
major version: 61
flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestStub
+ this_class: #x // android/hosttest/annotation/HostSideTestStaticInitializerKeep
super_class: #x // java/lang/Object
interfaces: 1, fields: 0, methods: 1, attributes: 2
private static {};
@@ -150,15 +181,15 @@
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=2, locals=0, args_size=0
- x: ldc #x // class android/hosttest/annotation/HostSideTestStub
+ x: ldc #x // class android/hosttest/annotation/HostSideTestStaticInitializerKeep
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
-SourceFile: "HostSideTestStub.java"
+SourceFile: "HostSideTestStaticInitializerKeep.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x,e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE,Ljava/lang/annotation/ElementType;.FIELD,Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -191,12 +222,12 @@
flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "HostSideTestSubstitute.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.METHOD]
@@ -227,7 +258,7 @@
SourceFile: "HostSideTestThrow.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x,e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.METHOD,Ljava/lang/annotation/ElementType;.CONSTRUCTOR]
@@ -258,38 +289,7 @@
SourceFile: "HostSideTestWholeClassKeep.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- x: #x(#x=[e#x.#x])
- java.lang.annotation.Target(
- value=[Ljava/lang/annotation/ElementType;.TYPE]
- )
- x: #x(#x=e#x.#x)
- java.lang.annotation.Retention(
- value=Ljava/lang/annotation/RetentionPolicy;.CLASS
- )
-## Class: android/hosttest/annotation/HostSideTestWholeClassStub.class
- Compiled from "HostSideTestWholeClassStub.java"
-public interface android.hosttest.annotation.HostSideTestWholeClassStub extends java.lang.annotation.Annotation
- minor version: 0
- major version: 61
- flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION
- this_class: #x // android/hosttest/annotation/HostSideTestWholeClassStub
- super_class: #x // java/lang/Object
- interfaces: 1, fields: 0, methods: 1, attributes: 2
- private static {};
- descriptor: ()V
- flags: (0x000a) ACC_PRIVATE, ACC_STATIC
- Code:
- stack=2, locals=0, args_size=0
- x: ldc #x // class android/hosttest/annotation/HostSideTestWholeClassStub
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
- x: return
-}
-SourceFile: "HostSideTestWholeClassStub.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
x: #x(#x=[e#x.#x])
java.lang.annotation.Target(
value=[Ljava/lang/annotation/ElementType;.TYPE]
@@ -313,7 +313,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -336,9 +336,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int addTwo(int);
descriptor: (I)I
@@ -360,9 +358,7 @@
11 4 0 a I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
@@ -370,9 +366,7 @@
SourceFile: "IPretendingAidl.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub.class
Compiled from "IPretendingAidl.java"
@@ -389,7 +383,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -412,9 +406,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int addOne(int);
descriptor: (I)I
@@ -436,9 +428,7 @@
11 4 0 a I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl
@@ -446,9 +436,7 @@
SourceFile: "IPretendingAidl.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/IPretendingAidl
## Class: com/android/hoststubgen/test/tinyframework/IPretendingAidl.class
Compiled from "IPretendingAidl.java"
@@ -465,7 +453,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/IPretendingAidl
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
@@ -475,9 +463,7 @@
SourceFile: "IPretendingAidl.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub
com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy
@@ -495,9 +481,7 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.R$Nested();
descriptor: ()V
@@ -518,9 +502,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/R$Nested;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -546,18 +528,14 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
- public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
+ public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
SourceFile: "R.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/R
## Class: com/android/hoststubgen/test/tinyframework/R.class
Compiled from "R.java"
@@ -574,7 +552,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/R
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -597,239 +575,31 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/R;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/R$Nested of class com/android/hoststubgen/test/tinyframework/R
SourceFile: "R.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/R$Nested
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.class
- Compiled from "TinyFrameworkCallerCheck.java"
-class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl
- minor version: 0
- major version: 61
- flags: (0x0020) ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 4, attributes: 4
- private static {};
- descriptor: ()V
- flags: (0x000a) ACC_PRIVATE, ACC_STATIC
- Code:
- stack=2, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
- x: return
-
- private com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck$Impl();
- descriptor: ()V
- flags: (0x0002) ACC_PRIVATE
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- x: ldc #x // String <init>
- x: ldc #x // String ()V
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOneKeep();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=4, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- x: ldc #x // String getOneKeep
- x: ldc #x // String ()I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- x: ldc #x // String getOneKeep
- x: ldc #x // String ()I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
- x: iconst_1
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestKeep
-
- public static int getOneStub();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=4, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
- x: ldc #x // String getOneStub
- x: ldc #x // String ()I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: iconst_1
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.class
- Compiled from "TinyFrameworkCallerCheck.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations.class
+ Compiled from "TinyFrameworkAnnotations.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations
minor version: 0
major version: 61
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 4, attributes: 5
- private static {};
- descriptor: ()V
- flags: (0x000a) ACC_PRIVATE, ACC_STATIC
- Code:
- stack=2, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
- x: return
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkCallerCheck();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
- x: ldc #x // String <init>
- x: ldc #x // String ()V
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_withCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=4, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
- x: ldc #x // String getOne_withCheck
- x: ldc #x // String ()I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.getOneKeep:()I
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int getOne_noCheck();
- descriptor: ()I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=4, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
- x: ldc #x // String getOne_noCheck
- x: ldc #x // String ()I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl.getOneStub:()I
- x: ireturn
- LineNumberTable:
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-InnerClasses:
- private static #x= #x of #x; // Impl=class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl of class com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck
-SourceFile: "TinyFrameworkCallerCheck.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
-NestMembers:
- com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck$Impl
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.class
- Compiled from "TinyFrameworkClassAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 8, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
+ interfaces: 0, fields: 1, methods: 7, attributes: 3
public int keep;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -839,20 +609,20 @@
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=2, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
x: ldc #x // String com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassAnnotations();
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
x: ldc #x // String <init>
x: ldc #x // String ()V
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -861,68 +631,29 @@
x: invokespecial #x // Method java/lang/Object."<init>":()V
x: aload_0
x: iconst_1
- x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
x: putfield #x // Field keep:I
x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 11 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public int addOne(int);
descriptor: (I)I
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
x: ldc #x // String addOne
x: ldc #x // String (I)I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
- 11 6 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
- RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestStub
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iload_1
x: iconst_1
x: iadd
@@ -930,11 +661,11 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
- 26 4 1 value I
+ 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
+ 11 4 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -944,7 +675,7 @@
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
x: ldc #x // String addTwo
x: ldc #x // String (I)I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -956,22 +687,20 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations;
11 4 1 value I
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddThree(int);
descriptor: (I)I
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
x: ldc #x // String nativeAddThree
x: ldc #x // String (I)I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -988,26 +717,18 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.String unsupportedMethod();
descriptor: ()Ljava/lang/String;
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
x: ldc #x // String unsupportedMethod
x: ldc #x // String ()Ljava/lang/String;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String unsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
x: new #x // class java/lang/RuntimeException
x: dup
@@ -1018,307 +739,43 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestThrow
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
+ public int toBeIgnored();
+ descriptor: ()I
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations
- x: ldc #x // String visibleButUsesUnsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations
+ x: ldc #x // String toBeIgnored
+ x: ldc #x // String ()I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations;
+ x: iconst_0
+ x: ireturn
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestIgnore
}
-SourceFile: "TinyFrameworkClassAnnotations.java"
+SourceFile: "TinyFrameworkAnnotations.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x(#x=s#x)
android.hosttest.annotation.HostSideTestClassLoadHook(
value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
)
-## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.class
- Compiled from "TinyFrameworkClassClassWideAnnotations.java"
-public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations
- minor version: 0
- major version: 61
- flags: (0x0021) ACC_PUBLIC, ACC_SUPER
- this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- super_class: #x // java/lang/Object
- interfaces: 0, fields: 3, methods: 9, attributes: 3
- public int stub;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int remove;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- private static {};
- descriptor: ()V
- flags: (0x000a) ACC_PRIVATE, ACC_STATIC
- Code:
- stack=2, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
- x: return
-
- public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassClassWideAnnotations();
- descriptor: ()V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String <init>
- x: ldc #x // String ()V
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: invokespecial #x // Method java/lang/Object."<init>":()V
- x: aload_0
- x: iconst_1
- x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
- x: return
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOne(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String addOne
- x: ldc #x // String (I)I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 11 6 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: iload_1
- x: iconst_1
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 11 4 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public void toBeRemoved(java.lang.String);
- descriptor: (Ljava/lang/String;)V
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String toBeRemoved
- x: ldc #x // String (Ljava/lang/String;)V
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: new #x // class java/lang/RuntimeException
- x: dup
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
- x: athrow
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 8 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 11 8 1 foo Ljava/lang/String;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addTwo(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String addTwo
- x: ldc #x // String (I)I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: iload_1
- x: iconst_2
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- 11 4 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public static int nativeAddThree(int);
- descriptor: (I)I
- flags: (0x0009) ACC_PUBLIC, ACC_STATIC
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String nativeAddThree
- x: ldc #x // String (I)I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: iload_0
- x: iconst_3
- x: iadd
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 4 0 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String unsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String unsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String This value shouldn\'t be seen on the host side.
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 3 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations
- x: ldc #x // String visibleButUsesUnsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-}
-SourceFile: "TinyFrameworkClassClassWideAnnotations.java"
-RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.class
Compiled from "TinyFrameworkClassLoadHook.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook
@@ -1334,9 +791,7 @@
Signature: #x // Ljava/util/Set<Ljava/lang/Class<*>;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook();
descriptor: ()V
@@ -1357,9 +812,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static void onClassLoaded(java.lang.Class<?>);
descriptor: (Ljava/lang/Class;)V
@@ -1386,9 +839,7 @@
Signature: #x // (Ljava/lang/Class<*>;)V
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -1411,19 +862,145 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkClassLoadHook.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations.class
+ Compiled from "TinyFrameworkClassWideAnnotations.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAnnotations
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 1, methods: 5, attributes: 3
+ public int keep;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ private static {};
+ descriptor: ()V
+ flags: (0x000a) ACC_PRIVATE, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
+ x: return
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAnnotations();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ x: ldc #x // String <init>
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: iconst_1
+ x: putfield #x // Field keep:I
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public int addOne(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=2, args_size=2
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ x: ldc #x // String addOne
+ x: ldc #x // String (I)I
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iload_1
+ x: iconst_1
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 11 4 1 value I
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public int addTwo(int);
+ descriptor: (I)I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=2, args_size=2
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ x: ldc #x // String addTwo
+ x: ldc #x // String (I)I
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iload_1
+ x: iconst_2
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations;
+ 11 4 1 value I
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public java.lang.String unsupportedMethod();
+ descriptor: ()Ljava/lang/String;
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations
+ x: ldc #x // String unsupportedMethod
+ x: ldc #x // String ()Ljava/lang/String;
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
+ x: new #x // class java/lang/RuntimeException
+ x: dup
+ x: ldc #x // String Unreachable
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ x: athrow
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestThrow
+}
+SourceFile: "TinyFrameworkClassWideAnnotations.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.class
Compiled from "TinyFrameworkClassWithInitializerDefault.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerDefault
@@ -1438,35 +1015,29 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.lang.Object sObject;
descriptor: Ljava/lang/Object;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
}
SourceFile: "TinyFrameworkClassWithInitializerDefault.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.class
Compiled from "TinyFrameworkClassWithInitializerStub.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithInitializerStub
@@ -1481,24 +1052,20 @@
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.lang.Object sObject;
descriptor: Ljava/lang/Object;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
static {};
descriptor: ()V
@@ -1526,21 +1093,19 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkClassWithInitializerStub.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x(#x=s#x)
android.hosttest.annotation.HostSideTestClassLoadHook(
value="com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded"
)
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.class
@@ -1557,43 +1122,37 @@
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex GREEN;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex BLUE;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private final java.lang.String mLongName;
descriptor: Ljava/lang/String;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -1603,7 +1162,7 @@
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestKeep
@@ -1613,9 +1172,7 @@
flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1634,9 +1191,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex valueOf(java.lang.String);
descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1659,9 +1214,7 @@
11 10 0 name Ljava/lang/String;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> mandated
@@ -1696,12 +1249,10 @@
Signature: #x // (Ljava/lang/String;Ljava/lang/String;)V
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
MethodParameters:
Name Flags
<no name> synthetic
@@ -1728,12 +1279,10 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.lang.String getShortName();
descriptor: ()Ljava/lang/String;
@@ -1754,12 +1303,10 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex[] $values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1789,9 +1336,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -1826,7 +1371,7 @@
x: dup
x: ldc #x // String BLUE
x: iconst_2
- x: ldc #x // String Blue
+ x: ldc #x // String Blue
x: ldc #x // String B
x: invokespecial #x // Method "<init>":(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
x: putstatic #x // Field BLUE:Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;
@@ -1836,20 +1381,16 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex;>;
SourceFile: "TinyFrameworkEnumComplex.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.class
Compiled from "TinyFrameworkEnumSimple.java"
public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple extends java.lang.Enum<com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple>
@@ -1864,33 +1405,27 @@
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple DOG;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] $VALUES;
descriptor: [Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
flags: (0x101a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple[] values();
descriptor: ()[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
@@ -1909,9 +1444,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple valueOf(java.lang.String);
descriptor: (Ljava/lang/String;)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;
@@ -1934,9 +1467,7 @@
11 10 0 name Ljava/lang/String;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> mandated
@@ -1963,9 +1494,7 @@
Signature: #x // ()V
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> synthetic
@@ -1995,9 +1524,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -2030,20 +1557,16 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
Signature: #x // Ljava/lang/Enum<Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple;>;
SourceFile: "TinyFrameworkEnumSimple.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.class
Compiled from "TinyFrameworkExceptionTester.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester
@@ -2059,7 +1582,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -2082,9 +1605,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int testException();
descriptor: ()I
@@ -2120,19 +1641,15 @@
22 11 0 e Ljava/lang/Exception;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkExceptionTester.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.class
Compiled from "TinyFrameworkForTextPolicy.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy
@@ -2141,22 +1658,13 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 8, attributes: 2
+ interfaces: 0, fields: 1, methods: 15, attributes: 2
public int stub;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int keep;
- descriptor: I
- flags: (0x0001) ACC_PUBLIC
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -2164,7 +1672,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
x: ldc #x // String com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
@@ -2186,19 +1694,14 @@
x: aload_0
x: iconst_1
x: putfield #x // Field stub:I
- x: aload_0
- x: iconst_2
- x: putfield #x // Field keep:I
x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 11 15 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+ 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int addOne(int);
descriptor: (I)I
@@ -2210,37 +1713,6 @@
x: ldc #x // String (I)I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: iload_1
- x: invokevirtual #x // Method addOneInner:(I)I
- x: ireturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- 11 6 1 value I
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public int addOneInner(int);
- descriptor: (I)I
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String addOneInner
- x: ldc #x // String (I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iload_1
x: iconst_1
x: iadd
@@ -2248,11 +1720,172 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- 26 4 1 value I
+ 11 4 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
+ 11 4 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public java.lang.String toBeIgnoredObj();
+ descriptor: ()Ljava/lang/String;
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredObj
+ x: ldc #x // String ()Ljava/lang/String;
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aconst_null
+ x: areturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public void toBeIgnoredV();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredV
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: return
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public boolean toBeIgnoredZ();
+ descriptor: ()Z
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredZ
+ x: ldc #x // String ()Z
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public byte toBeIgnoredB();
+ descriptor: ()B
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredB
+ x: ldc #x // String ()B
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public char toBeIgnoredC();
+ descriptor: ()C
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredC
+ x: ldc #x // String ()C
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public short toBeIgnoredS();
+ descriptor: ()S
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredS
+ x: ldc #x // String ()S
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public int toBeIgnoredI();
+ descriptor: ()I
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredI
+ x: ldc #x // String ()I
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iconst_0
+ x: ireturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public float toBeIgnoredF();
+ descriptor: ()F
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredF
+ x: ldc #x // String ()F
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: fconst_0
+ x: freturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public double toBeIgnoredD();
+ descriptor: ()D
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
+ x: ldc #x // String toBeIgnoredD
+ x: ldc #x // String ()D
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: dconst_0
+ x: dreturn
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsIgnore
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int addTwo(int);
descriptor: (I)I
@@ -2277,9 +1910,7 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddThree(int);
descriptor: (I)I
@@ -2303,9 +1934,7 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.String unsupportedMethod();
descriptor: ()Ljava/lang/String;
@@ -2317,12 +1946,6 @@
x: ldc #x // String ()Ljava/lang/String;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String unsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
x: new #x // class java/lang/RuntimeException
x: dup
@@ -2333,37 +1956,12 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-
- public java.lang.String visibleButUsesUnsupportedMethod();
- descriptor: ()Ljava/lang/String;
- flags: (0x0001) ACC_PUBLIC
- Code:
- stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy
- x: ldc #x // String visibleButUsesUnsupportedMethod
- x: ldc #x // String ()Ljava/lang/String;
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: aload_0
- x: invokevirtual #x // Method unsupportedMethod:()Ljava/lang/String;
- x: areturn
- LineNumberTable:
- LocalVariableTable:
- Start Length Slot Name Signature
- 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy;
- RuntimeVisibleAnnotations:
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkForTextPolicy.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested.class
Compiled from "TinyFrameworkLambdas.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested
@@ -2379,12 +1977,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -2392,12 +1988,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nested();
descriptor: ()V
@@ -2421,12 +2015,10 @@
11 14 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -2447,12 +2039,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -2470,12 +2060,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static java.lang.Integer lambda$getSupplier_static$3();
descriptor: ()Ljava/lang/Integer;
@@ -2493,9 +2081,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$getSupplier$2();
descriptor: ()Ljava/lang/Integer;
@@ -2513,9 +2099,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$static$1();
descriptor: ()Ljava/lang/Integer;
@@ -2533,9 +2117,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$new$0();
descriptor: ()Ljava/lang/Integer;
@@ -2553,9 +2135,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -2571,12 +2151,12 @@
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: invokedynamic #x, 0 // InvokeDynamic #x:get:()Ljava/util/function/Supplier;
- x: putstatic #x // Field sSupplier:Ljava/util/function/Supplier;
+ x: putstatic #x // Field sSupplier:Ljava/util/function/Supplier;
x: return
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
@@ -2584,12 +2164,10 @@
SourceFile: "TinyFrameworkLambdas.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
BootstrapMethods:
@@ -2629,12 +2207,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -2642,12 +2218,10 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas();
descriptor: ()V
@@ -2671,12 +2245,10 @@
11 14 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -2697,12 +2269,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -2720,12 +2290,10 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
private static java.lang.Integer lambda$getSupplier_static$3();
descriptor: ()Ljava/lang/Integer;
@@ -2743,9 +2311,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$getSupplier$2();
descriptor: ()Ljava/lang/Integer;
@@ -2763,9 +2329,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$static$1();
descriptor: ()Ljava/lang/Integer;
@@ -2783,9 +2347,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static java.lang.Integer lambda$new$0();
descriptor: ()Ljava/lang/Integer;
@@ -2803,9 +2365,7 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -2821,12 +2381,12 @@
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: invokedynamic #x, 0 // InvokeDynamic #x:get:()Ljava/util/function/Supplier;
- x: putstatic #x // Field sSupplier:Ljava/util/function/Supplier;
+ x: putstatic #x // Field sSupplier:Ljava/util/function/Supplier;
x: return
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas
@@ -2834,12 +2394,10 @@
SourceFile: "TinyFrameworkLambdas.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestStub
+ android.hosttest.annotation.HostSideTestKeep
x: #x()
android.hosttest.annotation.HostSideTestStaticInitializerKeep
BootstrapMethods:
@@ -2865,6 +2423,239 @@
#x ()Ljava/lang/Integer;
NestMembers:
com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class
+ Compiled from "TinyFrameworkMethodCallReplace.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 0, methods: 4, attributes: 4
+ private static {};
+ descriptor: ()V
+ flags: (0x000a) ACC_PRIVATE, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
+ x: return
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ x: ldc #x // String <init>
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static void startThread(java.lang.Thread);
+ descriptor: (Ljava/lang/Thread;)V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ x: ldc #x // String startThread
+ x: ldc #x // String (Ljava/lang/Thread;)V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: iconst_1
+ x: invokevirtual #x // Method java/lang/Thread.setDaemon:(Z)V
+ x: aload_0
+ x: invokevirtual #x // Method java/lang/Thread.start:()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 10 0 thread Ljava/lang/Thread;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static int add(int, int);
+ descriptor: (II)I
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=2, args_size=2
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
+ x: ldc #x // String add
+ x: ldc #x // String (II)I
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iload_0
+ x: iload_1
+ x: iadd
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 4 0 a I
+ 11 4 1 b I
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+}
+InnerClasses:
+ public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+SourceFile: "TinyFrameworkMethodCallReplace.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.class
+ Compiled from "TinyFrameworkMethodCallReplace.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 0, methods: 5, attributes: 6
+ private static {};
+ descriptor: ()V
+ flags: (0x000a) ACC_PRIVATE, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
+ x: return
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ x: ldc #x // String <init>
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static boolean nonStaticMethodCallReplaceTester() throws java.lang.Exception;
+ descriptor: ()Z
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=2, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ x: ldc #x // String nonStaticMethodCallReplaceTester
+ x: ldc #x // String ()Z
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: new #x // class java/util/concurrent/atomic/AtomicBoolean
+ x: dup
+ x: iconst_0
+ x: invokespecial #x // Method java/util/concurrent/atomic/AtomicBoolean."<init>":(Z)V
+ x: astore_0
+ x: new #x // class java/lang/Thread
+ x: dup
+ x: aload_0
+ x: invokedynamic #x, 0 // InvokeDynamic #x:run:(Ljava/util/concurrent/atomic/AtomicBoolean;)Ljava/lang/Runnable;
+ x: invokespecial #x // Method java/lang/Thread."<init>":(Ljava/lang/Runnable;)V
+ x: astore_1
+ x: aload_1
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.startThread:(Ljava/lang/Thread;)V
+ x: aload_1
+ x: invokevirtual #x // Method java/lang/Thread.join:()V
+ x: aload_0
+ x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.get:()Z
+ x: ireturn
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 20 27 0 ab Ljava/util/concurrent/atomic/AtomicBoolean;
+ 34 13 1 th Ljava/lang/Thread;
+ Exceptions:
+ throws java.lang.Exception
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static int staticMethodCallReplaceTester();
+ descriptor: ()I
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ x: ldc #x // String staticMethodCallReplaceTester
+ x: ldc #x // String ()I
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: iconst_1
+ x: iconst_2
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.add:(II)I
+ x: ireturn
+ LineNumberTable:
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean);
+ descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ x: ldc #x // String lambda$nonStaticMethodCallReplaceTester$0
+ x: ldc #x // String (Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;
+ x: invokevirtual #x // Method java/lang/Thread.isDaemon:()Z
+ x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.set:(Z)V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 11 0 ab Ljava/util/concurrent/atomic/AtomicBoolean;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+}
+InnerClasses:
+ public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace
+ public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
+SourceFile: "TinyFrameworkMethodCallReplace.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestWholeClassKeep
+BootstrapMethods:
+ x: #x REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
+ Method arguments:
+ #x ()V
+ #x REF_invokeStatic com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.lambda$nonStaticMethodCallReplaceTester$0:(Ljava/util/concurrent/atomic/AtomicBoolean;)V
+ #x ()V
+NestMembers:
+ com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class
Compiled from "TinyFrameworkNative.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative
@@ -2873,15 +2664,13 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 12, attributes: 3
+ interfaces: 0, fields: 1, methods: 15, attributes: 3
int value;
descriptor: I
flags: (0x0000)
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -2889,7 +2678,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -2912,9 +2701,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddTwo(int);
descriptor: (I)I
@@ -2933,9 +2720,10 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
public static int nativeAddTwo_should_be_like_this(int);
descriptor: (I)I
@@ -2956,9 +2744,7 @@
11 5 0 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static long nativeLongPlus(long, long);
descriptor: (JJ)J
@@ -2978,9 +2764,10 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
public static long nativeLongPlus_should_be_like_this(long, long);
descriptor: (JJ)J
@@ -3003,9 +2790,7 @@
11 6 2 arg2 J
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public void setValue(int);
descriptor: (I)V
@@ -3028,9 +2813,7 @@
11 6 1 v I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int nativeNonStaticAddToValue(int);
descriptor: (I)I
@@ -3050,9 +2833,10 @@
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
public int nativeNonStaticAddToValue_should_be_like_this(int);
descriptor: (I)I
@@ -3075,9 +2859,7 @@
11 6 1 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static void nativeStillNotSupported();
descriptor: ()V
@@ -3089,49 +2871,46 @@
x: ldc #x // String ()V
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- x: ldc #x // String nativeStillNotSupported
- x: ldc #x // String ()V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onThrowMethodCalled:()V
x: new #x // class java/lang/RuntimeException
x: dup
x: ldc #x // String Unreachable
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
x: athrow
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsThrow
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestThrow
+ public static native void nativeStillKeep();
+ descriptor: ()V
+ flags: (0x0109) ACC_PUBLIC, ACC_STATIC, ACC_NATIVE
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
public static void nativeStillNotSupported_should_be_like_this();
descriptor: ()V
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- x: ldc #x // String nativeStillNotSupported_should_be_like_this
+ x: ldc #x // String nativeStillNotSupported_should_be_like_this
x: ldc #x // String ()V
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
x: new #x // class java/lang/RuntimeException
x: dup
- x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
+ x: invokespecial #x // Method java/lang/RuntimeException."<init>":()V
x: athrow
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static byte nativeBytePlus(byte, byte);
descriptor: (BB)B
@@ -3139,33 +2918,75 @@
Code:
stack=4, locals=2, args_size=2
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
- x: ldc #x // String nativeBytePlus
- x: ldc #x // String (BB)B
+ x: ldc #x // String nativeBytePlus
+ x: ldc #x // String (BB)B
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
x: iload_0
x: iload_1
- x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.nativeBytePlus:(BB)B
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.nativeBytePlus:(BB)B
x: ireturn
RuntimeVisibleAnnotations:
x: #x()
com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ android.hosttest.annotation.HostSideTestRedirect
+
+ public void notNativeRedirected();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
+ x: ldc #x // String notNativeRedirected
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.notNativeRedirected:(Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;)V
+ x: return
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
+
+ public static void notNativeStaticRedirected();
+ descriptor: ()V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative
+ x: ldc #x // String notNativeStaticRedirected
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.notNativeStaticRedirected:()V
+ x: return
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsSubstitute
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+ RuntimeInvisibleAnnotations:
+ x: #x()
+ android.hosttest.annotation.HostSideTestRedirect
}
SourceFile: "TinyFrameworkNative.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
x: #x(#x=s#x)
- android.hosttest.annotation.HostSideTestNativeSubstitutionClass(
+ android.hosttest.annotation.HostSideTestRedirectionClass(
value="TinyFrameworkNative_host"
)
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.class
@@ -3176,7 +2997,7 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
super_class: #x // java/lang/Object
- interfaces: 0, fields: 0, methods: 6, attributes: 3
+ interfaces: 0, fields: 0, methods: 8, attributes: 3
private static {};
descriptor: ()V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
@@ -3197,22 +3018,16 @@
x: ldc #x // String ()V
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String <init>
- x: ldc #x // String ()V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokespecial #x // Method java/lang/Object."<init>":()V
x: return
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeAddTwo(int);
descriptor: (I)I
@@ -3224,12 +3039,6 @@
x: ldc #x // String (I)I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeAddTwo
- x: ldc #x // String (I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iload_0
x: iconst_2
x: iadd
@@ -3237,10 +3046,10 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 4 0 arg I
+ 11 4 0 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static long nativeLongPlus(long, long);
descriptor: (JJ)J
@@ -3252,12 +3061,6 @@
x: ldc #x // String (JJ)J
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeLongPlus
- x: ldc #x // String (JJ)J
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: lload_0
x: lload_2
x: ladd
@@ -3265,11 +3068,11 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 4 0 arg1 J
- 26 4 2 arg2 J
+ 11 4 0 arg1 J
+ 11 4 2 arg2 J
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int nativeNonStaticAddToValue(com.android.hoststubgen.test.tinyframework.TinyFrameworkNative, int);
descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;I)I
@@ -3281,12 +3084,6 @@
x: ldc #x // String (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;I)I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeNonStaticAddToValue
- x: ldc #x // String (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;I)I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: getfield #x // Field com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.value:I
x: iload_1
@@ -3295,11 +3092,11 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 7 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
- 26 7 1 arg I
+ 11 7 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
+ 11 7 1 arg I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static byte nativeBytePlus(byte, byte);
descriptor: (BB)B
@@ -3311,12 +3108,6 @@
x: ldc #x // String (BB)B
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
- x: ldc #x // String nativeBytePlus
- x: ldc #x // String (BB)B
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iload_0
x: iload_1
x: iadd
@@ -3325,16 +3116,51 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 arg1 B
- 26 5 1 arg2 B
+ 11 5 0 arg1 B
+ 11 5 1 arg2 B
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static void notNativeRedirected(com.android.hoststubgen.test.tinyframework.TinyFrameworkNative);
+ descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;)V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
+ x: ldc #x // String notNativeRedirected
+ x: ldc #x // String (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;)V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 1 0 source Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNative;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ public static void notNativeStaticRedirected();
+ descriptor: ()V
+ flags: (0x0009) ACC_PUBLIC, ACC_STATIC
+ Code:
+ stack=4, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host
+ x: ldc #x // String notNativeStaticRedirected
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: return
+ LineNumberTable:
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkNative_host.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestWholeClassKeep
@@ -3352,7 +3178,7 @@
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -3387,7 +3213,7 @@
11 10 1 this$0 Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> final mandated
@@ -3402,22 +3228,16 @@
x: ldc #x // String ()Ljava/lang/Integer;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iconst_1
x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
@@ -3429,22 +3249,16 @@
x: ldc #x // String ()Ljava/lang/Object;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokevirtual #x // Method get:()Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
@@ -3453,7 +3267,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3493,7 +3307,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Integer get();
descriptor: ()Ljava/lang/Integer;
@@ -3505,22 +3319,16 @@
x: ldc #x // String ()Ljava/lang/Integer;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iconst_2
x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
@@ -3532,22 +3340,16 @@
x: ldc #x // String ()Ljava/lang/Object;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokevirtual #x // Method get:()Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
@@ -3556,7 +3358,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3572,7 +3374,7 @@
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -3607,7 +3409,7 @@
11 10 1 this$0 Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> final mandated
@@ -3622,22 +3424,16 @@
x: ldc #x // String ()Ljava/lang/Integer;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iconst_3
x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
@@ -3649,22 +3445,16 @@
x: ldc #x // String ()Ljava/lang/Object;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokevirtual #x // Method get:()Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
@@ -3673,7 +3463,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3713,7 +3503,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Integer get();
descriptor: ()Ljava/lang/Integer;
@@ -3725,22 +3515,16 @@
x: ldc #x // String ()Ljava/lang/Integer;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: iconst_4
x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
@@ -3752,22 +3536,16 @@
x: ldc #x // String ()Ljava/lang/Object;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokevirtual #x // Method get:()Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
@@ -3776,7 +3554,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3792,9 +3570,7 @@
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -3802,7 +3578,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -3829,18 +3605,14 @@
11 10 1 x I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3850,24 +3622,20 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
super_class: #x // java/lang/Object
- interfaces: 0, fields: 2, methods: 2, attributes: 5
+ interfaces: 0, fields: 2, methods: 2, attributes: 4
public int value;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0;
descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -3875,7 +3643,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -3905,9 +3673,7 @@
11 15 1 this$0 Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
MethodParameters:
Name Flags
<no name> final mandated
@@ -3917,12 +3683,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -3962,7 +3723,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Integer get();
descriptor: ()Ljava/lang/Integer;
@@ -3974,22 +3735,16 @@
x: ldc #x // String ()Ljava/lang/Integer;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Integer;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: bipush 7
x: invokestatic #x // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
+ 11 6 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.lang.Object get();
descriptor: ()Ljava/lang/Object;
@@ -4001,22 +3756,16 @@
x: ldc #x // String ()Ljava/lang/Object;
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
- x: ldc #x // String get
- x: ldc #x // String ()Ljava/lang/Object;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokevirtual #x // Method get:()Ljava/lang/Integer;
x: areturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
+ 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
@@ -4026,7 +3775,65 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass.class
+ Compiled from "TinyFrameworkNestedClasses.java"
+public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ minor version: 0
+ major version: 61
+ flags: (0x0021) ACC_PUBLIC, ACC_SUPER
+ this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ super_class: #x // java/lang/Object
+ interfaces: 0, fields: 1, methods: 2, attributes: 4
+ public int value;
+ descriptor: I
+ flags: (0x0001) ACC_PUBLIC
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+
+ private static {};
+ descriptor: ()V
+ flags: (0x000a) ACC_PRIVATE, ACC_STATIC
+ Code:
+ stack=2, locals=0, args_size=0
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
+ x: return
+
+ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass();
+ descriptor: ()V
+ flags: (0x0001) ACC_PUBLIC
+ Code:
+ stack=4, locals=1, args_size=1
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
+ x: ldc #x // String <init>
+ x: ldc #x // String ()V
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+ x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ x: aload_0
+ x: invokespecial #x // Method java/lang/Object."<init>":()V
+ x: aload_0
+ x: bipush 8
+ x: putfield #x // Field value:I
+ x: return
+ LineNumberTable:
+ LocalVariableTable:
+ Start Length Slot Name Signature
+ 11 11 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass;
+ RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
+}
+InnerClasses:
+ public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
+SourceFile: "TinyFrameworkNestedClasses.java"
+RuntimeVisibleAnnotations:
+ x: #x()
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -4036,15 +3843,13 @@
flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
super_class: #x // java/lang/Object
- interfaces: 0, fields: 1, methods: 3, attributes: 5
+ interfaces: 0, fields: 1, methods: 3, attributes: 4
public int value;
descriptor: I
flags: (0x0001) ACC_PUBLIC
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -4052,7 +3857,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -4078,9 +3883,7 @@
11 11 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -4100,22 +3903,16 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
-RuntimeInvisibleAnnotations:
- x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -4132,7 +3929,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -4157,9 +3954,7 @@
11 6 1 x I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
@@ -4167,9 +3962,7 @@
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.class
Compiled from "TinyFrameworkNestedClasses.java"
@@ -4186,9 +3979,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static final java.util.function.Supplier<java.lang.Integer> sSupplier;
descriptor: Ljava/util/function/Supplier;
@@ -4196,9 +3987,7 @@
Signature: #x // Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses();
descriptor: ()V
@@ -4225,9 +4014,7 @@
11 17 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public java.util.function.Supplier<java.lang.Integer> getSupplier();
descriptor: ()Ljava/util/function/Supplier;
@@ -4251,9 +4038,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static java.util.function.Supplier<java.lang.Integer> getSupplier_static();
descriptor: ()Ljava/util/function/Supplier;
@@ -4273,9 +4058,7 @@
Signature: #x // ()Ljava/util/function/Supplier<Ljava/lang/Integer;>;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
static {};
descriptor: ()V
@@ -4298,33 +4081,31 @@
LineNumberTable:
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
InnerClasses:
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2
- public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // SubClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public static #x= #x of #x; // BaseClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public static #x= #x of #x; // StaticNestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
public #x= #x of #x; // InnerClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses
+ public static #x= #x of #x; // Double$NestedClass=class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass of class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
#x; // class com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
SourceFile: "TinyFrameworkNestedClasses.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
NestMembers:
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass
+ com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass
com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4
@@ -4346,7 +4127,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -4369,9 +4150,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int foo(int);
descriptor: (I)I
@@ -4395,19 +4174,15 @@
11 12 0 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkPackageRedirect.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class
Compiled from "TinyFrameworkRenamedClassCaller.java"
public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller
@@ -4423,7 +4198,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -4446,9 +4221,7 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public static int foo(int);
descriptor: (I)I
@@ -4472,19 +4245,15 @@
11 12 0 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkRenamedClassCaller.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: com/android/hoststubgen/test/tinyframework/packagetest/A.class
Compiled from "A.java"
public class com.android.hoststubgen.test.tinyframework.packagetest.A
@@ -4500,16 +4269,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/packagetest/A
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "A.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/packagetest/sub/A.class
Compiled from "A.java"
public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A
@@ -4525,16 +4292,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/packagetest/sub/A
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "A.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C1.class
Compiled from "C1.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.C1
@@ -4550,16 +4315,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/C1
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "C1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C2.class
Compiled from "C2.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends com.android.hoststubgen.test.tinyframework.subclasstest.C1
@@ -4575,16 +4338,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/C2
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "C2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/C3.class
Compiled from "C3.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends com.android.hoststubgen.test.tinyframework.subclasstest.C2
@@ -4600,16 +4361,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/C3
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "C3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CA.class
Compiled from "CA.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.CA
@@ -4625,16 +4384,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/CA
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "CA.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/CB.class
Compiled from "CB.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.CB
@@ -4650,16 +4407,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/CB
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "CB.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_C1.class
Compiled from "Class_C1.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C1 extends com.android.hoststubgen.test.tinyframework.subclasstest.C1
@@ -4682,7 +4437,7 @@
SourceFile: "Class_C1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_C2.class
Compiled from "Class_C2.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C2 extends com.android.hoststubgen.test.tinyframework.subclasstest.C2
@@ -4705,7 +4460,7 @@
SourceFile: "Class_C2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_C3.class
Compiled from "Class_C3.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C3 extends com.android.hoststubgen.test.tinyframework.subclasstest.C3
@@ -4728,7 +4483,7 @@
SourceFile: "Class_C3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1.class
Compiled from "Class_I1.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1 implements com.android.hoststubgen.test.tinyframework.subclasstest.I1
@@ -4751,7 +4506,7 @@
SourceFile: "Class_I1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1_IA.class
Compiled from "Class_I1_IA.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1_IA implements com.android.hoststubgen.test.tinyframework.subclasstest.I1,com.android.hoststubgen.test.tinyframework.subclasstest.IA
@@ -4774,7 +4529,7 @@
SourceFile: "Class_I1_IA.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I2.class
Compiled from "Class_I2.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I2 implements com.android.hoststubgen.test.tinyframework.subclasstest.I2
@@ -4797,7 +4552,7 @@
SourceFile: "Class_I2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/Class_I3.class
Compiled from "Class_I3.java"
public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I3 implements com.android.hoststubgen.test.tinyframework.subclasstest.I3
@@ -4820,7 +4575,7 @@
SourceFile: "Class_I3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I1.class
Compiled from "I1.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1
@@ -4836,16 +4591,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/I1
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "I1.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I2.class
Compiled from "I2.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 extends com.android.hoststubgen.test.tinyframework.subclasstest.I1
@@ -4868,9 +4621,7 @@
SourceFile: "I2.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/I3.class
Compiled from "I3.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 extends com.android.hoststubgen.test.tinyframework.subclasstest.I2
@@ -4893,9 +4644,7 @@
SourceFile: "I3.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IA.class
Compiled from "IA.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA
@@ -4911,16 +4660,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/IA
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "IA.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/android/hoststubgen/test/tinyframework/subclasstest/IB.class
Compiled from "IB.java"
public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB
@@ -4936,16 +4683,14 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/android/hoststubgen/test/tinyframework/subclasstest/IB
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
}
SourceFile: "IB.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
## Class: com/supported/UnsupportedClass.class
Compiled from "UnsupportedClass.java"
public class com.supported.UnsupportedClass
@@ -4960,7 +4705,7 @@
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
@@ -4982,12 +4727,6 @@
x: ldc #x // String (I)V
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/supported/UnsupportedClass
- x: ldc #x // String <init>
- x: ldc #x // String (I)V
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: invokespecial #x // Method java/lang/Object."<init>":()V
x: aload_0
@@ -4997,11 +4736,11 @@
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 10 0 this Lcom/supported/UnsupportedClass;
- 26 10 1 value I
+ 11 10 0 this Lcom/supported/UnsupportedClass;
+ 11 10 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int getValue();
descriptor: ()I
@@ -5013,27 +4752,21 @@
x: ldc #x // String ()I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- x: ldc #x // String com/supported/UnsupportedClass
- x: ldc #x // String getValue
- x: ldc #x // String ()I
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.getStackWalker:()Ljava/lang/StackWalker;
- x: invokevirtual #x // Method java/lang/StackWalker.getCallerClass:()Ljava/lang/Class;
- x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onNonStubMethodCalled:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
x: aload_0
x: getfield #x // Field mValue:I
x: ireturn
LineNumberTable:
LocalVariableTable:
Start Length Slot Name Signature
- 26 5 0 this Lcom/supported/UnsupportedClass;
+ 11 5 0 this Lcom/supported/UnsupportedClass;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "UnsupportedClass.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
android.hosttest.annotation.HostSideTestWholeClassKeep
@@ -5052,7 +4785,7 @@
Code:
stack=2, locals=0, args_size=0
x: ldc #x // class com/unsupported/UnsupportedClass
- x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
+ x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -5080,9 +4813,7 @@
11 14 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int getValue();
descriptor: ()I
@@ -5105,19 +4836,15 @@
11 10 0 this Lcom/unsupported/UnsupportedClass;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "UnsupportedClass.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
## Class: rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.class
Compiled from "TinyFrameworkToBeRenamed.java"
public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed
@@ -5132,16 +4859,14 @@
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
private static {};
descriptor: ()V
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=2, locals=0, args_size=0
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded
x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V
x: return
@@ -5151,7 +4876,7 @@
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=2, args_size=2
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
x: ldc #x // String <init>
x: ldc #x // String (I)V
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -5169,16 +4894,14 @@
11 10 1 value I
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
public int getValue();
descriptor: ()I
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=1, args_size=1
- x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
+ x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed
x: ldc #x // String getValue
x: ldc #x // String ()I
x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -5192,16 +4915,12 @@
11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed;
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
}
SourceFile: "TinyFrameworkToBeRenamed.java"
RuntimeVisibleAnnotations:
x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInStub
- x: #x()
- com.android.hoststubgen.hosthelper.HostStubGenKeptInImpl
+ com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep
RuntimeInvisibleAnnotations:
x: #x()
- android.hosttest.annotation.HostSideTestWholeClassStub
+ android.hosttest.annotation.HostSideTestWholeClassKeep
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt b/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt
index 75c9721..3c138d2 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt
@@ -1,9 +1,8 @@
-class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy stub
- field stub stub
- field keep keep
+class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy keep
+ field stub keep
# field remove remove # Implicitly remove
- method <init> ()V stub
- method addOne (I)I stub
+ method <init> ()V keep
+ method addOne (I)I keep
method addOneInner (I)I keep
method toBeRemoved (Ljava/lang/String;)V remove
method addTwo (I)I @addTwo_host
@@ -11,28 +10,38 @@
method nativeAddThree (I)I @addThree_host
# method addThree_host (I)I # used as a substitute
method unsupportedMethod ()Ljava/lang/String; throw
- method visibleButUsesUnsupportedMethod ()Ljava/lang/String; stub
+ method visibleButUsesUnsupportedMethod ()Ljava/lang/String; keep
+ method toBeIgnoredObj ()Ljava/lang/String; ignore
+ method toBeIgnoredV ()V ignore
+ method toBeIgnoredZ ()Z ignore
+ method toBeIgnoredB ()B ignore
+ method toBeIgnoredC ()C ignore
+ method toBeIgnoredS ()S ignore
+ method toBeIgnoredI ()I ignore
+ method toBeIgnoredL ()L ignore
+ method toBeIgnoredF ()F ignore
+ method toBeIgnoredD ()D ignore
# Class load hook
class com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy ~com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded
# Heuristics rule: Stub all the AIDL classes.
-class :aidl stubclass
+class :aidl keepclass
# Heuristics rule: Stub all the R classes.
-class :r stubclass
+class :r keepclass
# Default is "remove", so let's put all the base classes / interfaces in the stub first.
-class com.android.hoststubgen.test.tinyframework.subclasstest.C1 stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.C2 stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.C3 stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.CA stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.CB stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.I1 stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.I2 stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.I3 stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.IA stub
-class com.android.hoststubgen.test.tinyframework.subclasstest.IB stub
+class com.android.hoststubgen.test.tinyframework.subclasstest.C1 keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.C2 keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.C3 keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.CA keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.CB keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.I1 keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.I2 keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.I3 keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.IA keep
+class com.android.hoststubgen.test.tinyframework.subclasstest.IB keep
# Then define inheritance based policies.
class *com.android.hoststubgen.test.tinyframework.subclasstest.C1 keep
@@ -42,15 +51,25 @@
class *com.android.hoststubgen.test.tinyframework.subclasstest.IA remove
# Test package directive
-package com.android.hoststubgen.test.tinyframework.packagetest stub
+package com.android.hoststubgen.test.tinyframework.packagetest keep
class com.android.hoststubgen.test.tinyframework.packagetest.B remove
class com.android.hoststubgen.test.tinyframework.packagetest.sub.B remove
# The following rules are the same as above
-# class com.android.hoststubgen.test.tinyframework.packagetest.A stub
-# class com.android.hoststubgen.test.tinyframework.packagetest.sub.A stub
+# class com.android.hoststubgen.test.tinyframework.packagetest.A keep
+# class com.android.hoststubgen.test.tinyframework.packagetest.sub.A keep
+
+# Used to test method call replacement.
+class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace keepclass
+ method originalAdd (II)I @com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo.add
+
+# Used to test method call replacement.
+# Note because java.lang.Thread is _not_ within the tiny-framework jar, the policy ("keep")
+# doesn't realy matter.
+class java.lang.Thread keep
+ method start ()V @com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo.startThread
# "rename" takes a type internal name, so '/'s is used as a separator.
# The leading / in the prefix is not needed (it'll be stripped), but it's added to make
# sure the stripping works.
-rename ^.*/TinyFrameworkToBeRenamed$ /rename_prefix/
\ No newline at end of file
+rename ^.*/TinyFrameworkToBeRenamed$ /rename_prefix/
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/run-test-manually.sh b/tools/hoststubgen/hoststubgen/test-tiny-framework/run-test-manually.sh
index 872bbf8..80ebf3a 100755
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/run-test-manually.sh
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/run-test-manually.sh
@@ -43,8 +43,7 @@
tiny_framework_classes=$out/tiny-framework/classes/
tiny_framework_jar=$out/tiny-framework.jar
-tiny_framework_host_stub_jar=$out/tiny-framework_host_stub.jar
-tiny_framework_host_impl_jar=$out/tiny-framework_host_impl.jar
+tiny_framework_host_jar=$out/tiny-framework_host.jar
tiny_test_classes=$out/tiny-test/classes/
tiny_test_jar=$out/tiny-test.jar
@@ -87,8 +86,7 @@
run $HOSTSTUBGEN \
@../hoststubgen-standard-options.txt \
--in-jar $tiny_framework_jar \
- --out-stub-jar $tiny_framework_host_stub_jar \
- --out-impl-jar $tiny_framework_host_impl_jar \
+ --out-jar $tiny_framework_host_jar \
--policy-override-file policy-override-tiny-framework.txt \
--gen-keep-all-file out/tiny-framework_keep_all.txt \
--gen-input-dump-file out/tiny-framework_dump.txt \
@@ -97,14 +95,14 @@
$HOSTSTUBGEN_OPTS
# Extract the jar files, so we can look into them.
-extract $tiny_framework_host_stub_jar $tiny_framework_host_impl_jar
+extract $tiny_framework_host_jar
# Build the test
echo "# Building tiny-test..."
run $JAVAC \
-cp $( \
join : \
- $tiny_framework_host_stub_jar \
+ $tiny_framework_jar \
"${test_compile_classpaths[@]}" \
) \
-d $tiny_test_classes \
@@ -124,7 +122,7 @@
-cp $( \
join : \
$tiny_test_jar \
- $tiny_framework_host_impl_jar \
+ $tiny_framework_host_jar \
"${test_compile_classpaths[@]}" \
"${test_runtime_classpaths[@]}" \
) \
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations.java
similarity index 81%
rename from tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.java
rename to tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations.java
index 6d8a48a..3415deb 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassAnnotations.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations.java
@@ -16,41 +16,33 @@
package com.android.hoststubgen.test.tinyframework;
import android.hosttest.annotation.HostSideTestClassLoadHook;
+import android.hosttest.annotation.HostSideTestIgnore;
import android.hosttest.annotation.HostSideTestKeep;
import android.hosttest.annotation.HostSideTestRemove;
-import android.hosttest.annotation.HostSideTestStub;
import android.hosttest.annotation.HostSideTestSubstitute;
import android.hosttest.annotation.HostSideTestThrow;
/**
* Test without class-wide annotations.
*/
-@HostSideTestStub
+@HostSideTestKeep
@HostSideTestClassLoadHook(
"com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded")
-public class TinyFrameworkClassAnnotations {
- @HostSideTestStub
- public TinyFrameworkClassAnnotations() {
+public class TinyFrameworkAnnotations {
+ @HostSideTestKeep
+ public TinyFrameworkAnnotations() {
}
- @HostSideTestStub
- public int stub = 1;
-
@HostSideTestKeep
- public int keep = 2;
+ public int keep = 1;
// Members will be deleted by default.
// Deleted fields cannot have an initial value, because otherwise .ctor will fail to set it at
// runtime.
public int remove;
- @HostSideTestStub
- public int addOne(int value) {
- return addOneInner(value);
- }
-
@HostSideTestKeep
- public int addOneInner(int value) {
+ public int addOne(int value) {
return value + 1;
}
@@ -59,7 +51,6 @@
throw new RuntimeException();
}
- @HostSideTestStub
@HostSideTestSubstitute(suffix = "_host")
public int addTwo(int value) {
throw new RuntimeException("not supported on host side");
@@ -69,7 +60,6 @@
return value + 2;
}
- @HostSideTestStub
@HostSideTestSubstitute(suffix = "_host")
public static native int nativeAddThree(int value);
@@ -83,8 +73,8 @@
return "This value shouldn't be seen on the host side.";
}
- @HostSideTestStub
- public String visibleButUsesUnsupportedMethod() {
- return unsupportedMethod();
+ @HostSideTestIgnore
+ public int toBeIgnored() {
+ throw new RuntimeException("not supported on host side");
}
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.java
deleted file mode 100644
index f530207..0000000
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkCallerCheck.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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 com.android.hoststubgen.test.tinyframework;
-
-import android.hosttest.annotation.HostSideTestKeep;
-import android.hosttest.annotation.HostSideTestStub;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
-
-/**
- * Used by the benchmark.
- */
-@HostSideTestWholeClassStub
-public class TinyFrameworkCallerCheck {
-
- /**
- * This method uses an inner method (which has the caller check).
- *
- * Benchmark result: 768ns
- */
- public static int getOne_withCheck() {
- return Impl.getOneKeep();
- }
-
- /**
- * This method doesn't have any caller check.
- *
- * Benchmark result: 2ns
- */
- public static int getOne_noCheck() {
- return Impl.getOneStub();
- }
-
- private static class Impl {
- @HostSideTestKeep
- public static int getOneKeep() {
- return 1;
- }
-
- @HostSideTestStub
- public static int getOneStub() {
- return 1;
- }
- }
-}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.java
deleted file mode 100644
index 145b65a..0000000
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassClassWideAnnotations.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 com.android.hoststubgen.test.tinyframework;
-
-import android.hosttest.annotation.HostSideTestStub;
-import android.hosttest.annotation.HostSideTestSubstitute;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
-
-@HostSideTestWholeClassStub
-public class TinyFrameworkClassClassWideAnnotations {
- public TinyFrameworkClassClassWideAnnotations() {
- }
-
- public int stub = 1;
-
- public int keep = 2;
-
- // Cannot have an initial value, because otherwise .ctor will fail to set it at runtime.
- public int remove;
-
- // @Stub
- public int addOne(int value) {
- return addOneInner(value);
- }
-
- // @Keep
- public int addOneInner(int value) {
- return value + 1;
- }
-
- // @Remove
- public void toBeRemoved(String foo) {
- throw new RuntimeException();
- }
-
- @HostSideTestStub
- @HostSideTestSubstitute(suffix = "_host")
- public int addTwo(int value) {
- throw new RuntimeException("not supported on host side");
- }
-
- public int addTwo_host(int value) {
- return value + 2;
- }
-
- @HostSideTestStub
- @HostSideTestSubstitute(suffix = "_host")
- public static native int nativeAddThree(int value);
-
- public static int nativeAddThree_host(int value) {
- return value + 3;
- }
-
- public String unsupportedMethod() {
- return "This value shouldn't be seen on the host side.";
- }
-
- public String visibleButUsesUnsupportedMethod() {
- return unsupportedMethod();
- }
-}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.java
index 98fc634..f734790 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook.java
@@ -15,12 +15,12 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
import java.util.HashSet;
import java.util.Set;
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class TinyFrameworkClassLoadHook {
private TinyFrameworkClassLoadHook() {
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations.java
new file mode 100644
index 0000000..e83163e
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations.java
@@ -0,0 +1,55 @@
+/*
+ * 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 com.android.hoststubgen.test.tinyframework;
+
+import android.hosttest.annotation.HostSideTestRemove;
+import android.hosttest.annotation.HostSideTestSubstitute;
+import android.hosttest.annotation.HostSideTestThrow;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
+
+@HostSideTestWholeClassKeep
+public class TinyFrameworkClassWideAnnotations {
+ public TinyFrameworkClassWideAnnotations() {
+ }
+
+ public int keep = 1;
+
+ @HostSideTestRemove
+ public int remove;
+
+ public int addOne(int value) {
+ return value + 1;
+ }
+
+ @HostSideTestSubstitute(suffix = "_host")
+ public int addTwo(int value) {
+ throw new RuntimeException("not supported on host side");
+ }
+
+ public int addTwo_host(int value) {
+ return value + 2;
+ }
+
+ @HostSideTestRemove
+ public void toBeRemoved(String foo) {
+ throw new RuntimeException();
+ }
+
+ @HostSideTestThrow
+ public String unsupportedMethod() {
+ return "This value shouldn't be seen on the host side.";
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.java
index 8324ed9..3df21d9 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault.java
@@ -15,18 +15,16 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestClassLoadHook;
-import android.hosttest.annotation.HostSideTestStub;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestKeep;
-@HostSideTestStub
+@HostSideTestKeep
public class TinyFrameworkClassWithInitializerDefault {
static {
sInitialized = true;
}
- @HostSideTestStub
+ @HostSideTestKeep
public static boolean sInitialized;
- @HostSideTestStub
+ @HostSideTestKeep
public static Object sObject = new Object();
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.java
index ea1ad93..cc665de 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub.java
@@ -16,20 +16,20 @@
package com.android.hoststubgen.test.tinyframework;
import android.hosttest.annotation.HostSideTestClassLoadHook;
+import android.hosttest.annotation.HostSideTestKeep;
import android.hosttest.annotation.HostSideTestStaticInitializerKeep;
-import android.hosttest.annotation.HostSideTestStub;
@HostSideTestClassLoadHook(
"com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHook.onClassLoaded")
-@HostSideTestStub
+@HostSideTestKeep
@HostSideTestStaticInitializerKeep
public class TinyFrameworkClassWithInitializerStub {
static {
sInitialized = true;
}
- @HostSideTestStub
+ @HostSideTestKeep
public static boolean sInitialized;
- @HostSideTestStub
+ @HostSideTestKeep
public static Object sObject = new Object();
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.java
index 51f4818..f833ad8 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex.java
@@ -16,15 +16,14 @@
package com.android.hoststubgen.test.tinyframework;
import android.hosttest.annotation.HostSideTestKeep;
-import android.hosttest.annotation.HostSideTestStub;
-@HostSideTestStub
+@HostSideTestKeep
public enum TinyFrameworkEnumComplex {
- @HostSideTestStub
+ @HostSideTestKeep
RED("Red", "R"),
- @HostSideTestStub
+ @HostSideTestKeep
GREEN("Green", "G"),
- @HostSideTestStub
+ @HostSideTestKeep
BLUE("Blue", "B");
@HostSideTestKeep
@@ -33,18 +32,18 @@
@HostSideTestKeep
private final String mShortName;
- @HostSideTestStub
+ @HostSideTestKeep
TinyFrameworkEnumComplex(String longName, String shortName) {
mLongName = longName;
mShortName = shortName;
}
- @HostSideTestStub
+ @HostSideTestKeep
public String getLongName() {
return mLongName;
}
- @HostSideTestStub
+ @HostSideTestKeep
public String getShortName() {
return mShortName;
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.java
index f440d86..c023169 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple.java
@@ -15,12 +15,12 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestStub;
+import android.hosttest.annotation.HostSideTestKeep;
-@HostSideTestStub
+@HostSideTestKeep
public enum TinyFrameworkEnumSimple {
- @HostSideTestStub
+ @HostSideTestKeep
CAT,
- @HostSideTestStub
+ @HostSideTestKeep
DOG,
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.java
index 909d3b4..f7cae7d 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester.java
@@ -15,9 +15,9 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class TinyFrameworkExceptionTester {
public static int testException() {
try {
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.java
index bde7c35..ec1efba 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy.java
@@ -24,17 +24,11 @@
public int stub = 1;
- public int keep = 2;
-
// Removed fields cannot have an initial value, because otherwise .ctor will fail to set it at
// runtime.
public int remove;
public int addOne(int value) {
- return addOneInner(value);
- }
-
- public int addOneInner(int value) {
return value + 1;
}
@@ -42,6 +36,42 @@
throw new RuntimeException();
}
+ public String toBeIgnoredObj() {
+ throw new RuntimeException();
+ }
+
+ public void toBeIgnoredV() {
+ throw new RuntimeException();
+ }
+
+ public boolean toBeIgnoredZ() {
+ throw new RuntimeException();
+ }
+
+ public byte toBeIgnoredB() {
+ throw new RuntimeException();
+ }
+
+ public char toBeIgnoredC() {
+ throw new RuntimeException();
+ }
+
+ public short toBeIgnoredS() {
+ throw new RuntimeException();
+ }
+
+ public int toBeIgnoredI() {
+ throw new RuntimeException();
+ }
+
+ public float toBeIgnoredF() {
+ throw new RuntimeException();
+ }
+
+ public double toBeIgnoredD() {
+ throw new RuntimeException();
+ }
+
public int addTwo(int value) {
throw new RuntimeException("not supported on host side");
}
@@ -59,8 +89,4 @@
public String unsupportedMethod() {
return "This value shouldn't be seen on the host side.";
}
-
- public String visibleButUsesUnsupportedMethod() {
- return unsupportedMethod();
- }
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas.java
index 0d1203b..1ca653e 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas.java
@@ -15,8 +15,8 @@
*/
package com.android.hoststubgen.test.tinyframework;
+import android.hosttest.annotation.HostSideTestKeep;
import android.hosttest.annotation.HostSideTestStaticInitializerKeep;
-import android.hosttest.annotation.HostSideTestStub;
import java.util.function.Supplier;
@@ -28,48 +28,48 @@
*
* Implicit filter should take care of them.
*/
-@HostSideTestStub
+@HostSideTestKeep
@HostSideTestStaticInitializerKeep
public class TinyFrameworkLambdas {
- @HostSideTestStub
+ @HostSideTestKeep
public TinyFrameworkLambdas() {
}
- @HostSideTestStub
+ @HostSideTestKeep
public final Supplier<Integer> mSupplier = () -> 1;
- @HostSideTestStub
+ @HostSideTestKeep
public static final Supplier<Integer> sSupplier = () -> 2;
- @HostSideTestStub
+ @HostSideTestKeep
public Supplier<Integer> getSupplier() {
return () -> 3;
}
- @HostSideTestStub
+ @HostSideTestKeep
public static Supplier<Integer> getSupplier_static() {
return () -> 4;
}
- @HostSideTestStub
+ @HostSideTestKeep
@HostSideTestStaticInitializerKeep
public static class Nested {
- @HostSideTestStub
+ @HostSideTestKeep
public Nested() {
}
- @HostSideTestStub
+ @HostSideTestKeep
public final Supplier<Integer> mSupplier = () -> 5;
- @HostSideTestStub
+ @HostSideTestKeep
public static final Supplier<Integer> sSupplier = () -> 6;
- @HostSideTestStub
+ @HostSideTestKeep
public Supplier<Integer> getSupplier() {
return () -> 7;
}
- @HostSideTestStub
+ @HostSideTestKeep
public static Supplier<Integer> getSupplier_static() {
return () -> 8;
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java
new file mode 100644
index 0000000..57c69a3
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.test.tinyframework;
+
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+@HostSideTestWholeClassKeep
+public class TinyFrameworkMethodCallReplace {
+ // This method should return true.
+ public static boolean nonStaticMethodCallReplaceTester() throws Exception {
+ final AtomicBoolean ab = new AtomicBoolean(false);
+
+ Thread th = new Thread(() -> {
+ ab.set(Thread.currentThread().isDaemon());
+ });
+ // This Thread.start() call will be redirected to ReplaceTo.startThread()
+ // (because of the policy file directive) which will make the thread "daemon" and start it.
+ th.start();
+ th.join();
+
+ return ab.get(); // This should be true.
+ }
+
+ public static int staticMethodCallReplaceTester() {
+ // This method call will be replaced with ReplaceTo.add().
+ return originalAdd(1, 2);
+ }
+
+ private static int originalAdd(int a, int b) {
+ return a + b - 1; // Original is broken.
+ }
+
+ public static class ReplaceTo {
+ public static void startThread(Thread thread) {
+ thread.setDaemon(true);
+ thread.start();
+ }
+
+ public static int add(int a, int b) {
+ return a + b;
+ }
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.java
index 09ee183..04a551c 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.java
@@ -15,19 +15,23 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestNativeSubstitutionClass;
+import android.hosttest.annotation.HostSideTestRedirect;
+import android.hosttest.annotation.HostSideTestRedirectionClass;
import android.hosttest.annotation.HostSideTestThrow;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
-@HostSideTestWholeClassStub
-@HostSideTestNativeSubstitutionClass("TinyFrameworkNative_host")
+@HostSideTestWholeClassKeep
+@HostSideTestRedirectionClass("TinyFrameworkNative_host")
public class TinyFrameworkNative {
+
+ @HostSideTestRedirect
public static native int nativeAddTwo(int arg);
public static int nativeAddTwo_should_be_like_this(int arg) {
return TinyFrameworkNative_host.nativeAddTwo(arg);
}
+ @HostSideTestRedirect
public static native long nativeLongPlus(long arg1, long arg2);
public static long nativeLongPlus_should_be_like_this(long arg1, long arg2) {
@@ -40,6 +44,7 @@
this.value = v;
}
+ @HostSideTestRedirect
public native int nativeNonStaticAddToValue(int arg);
public int nativeNonStaticAddToValue_should_be_like_this(int arg) {
@@ -49,9 +54,22 @@
@HostSideTestThrow
public static native void nativeStillNotSupported();
+ public static native void nativeStillKeep();
+
public static void nativeStillNotSupported_should_be_like_this() {
throw new RuntimeException();
}
+ @HostSideTestRedirect
public static native byte nativeBytePlus(byte arg1, byte arg2);
+
+ @HostSideTestRedirect
+ public void notNativeRedirected() {
+ throw new RuntimeException();
+ }
+
+ @HostSideTestRedirect
+ public static void notNativeStaticRedirected() {
+ throw new RuntimeException();
+ }
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.java
index b23c216..c7a29a1 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host.java
@@ -17,8 +17,6 @@
import android.hosttest.annotation.HostSideTestWholeClassKeep;
-// TODO: This annotation shouldn't be needed.
-// We should infer it from HostSideTestNativeSubstitutionClass.
@HostSideTestWholeClassKeep
public class TinyFrameworkNative_host {
public static int nativeAddTwo(int arg) {
@@ -38,4 +36,10 @@
public static byte nativeBytePlus(byte arg1, byte arg2) {
return (byte) (arg1 + arg2);
}
+
+ public static void notNativeRedirected(TinyFrameworkNative source) {
+ }
+
+ public static void notNativeStaticRedirected() {
+ }
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.java
index e1c48bb..c1ea2ee 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses.java
@@ -15,11 +15,11 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
import java.util.function.Supplier;
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class TinyFrameworkNestedClasses {
public final Supplier<Integer> mSupplier = new Supplier<Integer>() {
@Override
@@ -34,6 +34,7 @@
return 2;
}
};
+
public Supplier<Integer> getSupplier() {
return new Supplier<Integer>() {
@Override
@@ -52,12 +53,10 @@
};
}
- @HostSideTestWholeClassStub
public class InnerClass {
public int value = 5;
}
- @HostSideTestWholeClassStub
public static class StaticNestedClass {
public int value = 6;
@@ -70,6 +69,10 @@
}
};
}
+
+ public static class Double$NestedClass {
+ public int value = 8;
+ }
}
public static class BaseClass {
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.java
index a82be54..941fcff 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect.java
@@ -15,9 +15,9 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class TinyFrameworkPackageRedirect {
/**
* A method that uses "unsupported" class. HostStubGen will redirect them to the "supported"
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java
index 31a164a..707bc0e 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java
@@ -15,9 +15,9 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class TinyFrameworkRenamedClassCaller {
/** Calls the class that'll be renamed. */
public static int foo(int value) {
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java
index 1430bcb..8319ced 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java
@@ -15,12 +15,12 @@
*/
package com.android.hoststubgen.test.tinyframework;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
/**
* This class will be renamed by the "rename" directive in the policy file.
*/
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class TinyFrameworkToBeRenamed {
private final int mValue;
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/unsupported/UnsupportedClass.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/unsupported/UnsupportedClass.java
index 0409b02..92f41ac 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/unsupported/UnsupportedClass.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-framework/src/com/unsupported/UnsupportedClass.java
@@ -15,10 +15,10 @@
*/
package com.unsupported;
-import android.hosttest.annotation.HostSideTestWholeClassStub;
+import android.hosttest.annotation.HostSideTestWholeClassKeep;
// Used for testing --package-redirect.
-@HostSideTestWholeClassStub
+@HostSideTestWholeClassKeep
public class UnsupportedClass {
public UnsupportedClass(int value) {
throw new RuntimeException("This class is not supported");
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotationsTest.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotationsTest.java
new file mode 100644
index 0000000..1ae0493
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotationsTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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 com.android.hoststubgen.test.tinyframework;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class TinyFrameworkAnnotationsTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void testSimple() {
+ TinyFrameworkAnnotations tfc = new TinyFrameworkAnnotations();
+ assertThat(tfc.addOne(1)).isEqualTo(2);
+ assertThat(tfc.keep).isEqualTo(1);
+ }
+
+ @Test
+ public void testRemove() {
+ TinyFrameworkAnnotations tfc = new TinyFrameworkAnnotations();
+ assertThrows(NoSuchMethodError.class, () -> tfc.toBeRemoved("abc"));
+ assertThrows(NoSuchFieldError.class, () -> tfc.remove = 1);
+ }
+
+ @Test
+ public void testSubstitute() {
+ TinyFrameworkAnnotations tfc = new TinyFrameworkAnnotations();
+ assertThat(tfc.addTwo(1)).isEqualTo(3);
+ }
+
+ @Test
+ public void testSubstituteNative() {
+ TinyFrameworkAnnotations tfc = new TinyFrameworkAnnotations();
+ assertThat(tfc.nativeAddThree(1)).isEqualTo(4);
+ }
+
+ @Test
+ public void testUnsupportedMethod() {
+ TinyFrameworkAnnotations tfc = new TinyFrameworkAnnotations();
+
+ thrown.expect(RuntimeException.class);
+ thrown.expectMessage("not yet supported");
+ tfc.unsupportedMethod();
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkBenchmark.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkBenchmark.java
deleted file mode 100644
index d57735b..0000000
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkBenchmark.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 com.android.hoststubgen.test.tinyframework;
-
-import org.junit.Test;
-
-import java.text.DecimalFormat;
-
-/**
- * Contains simple micro-benchmarks.
- */
-@LargeTest
-public class TinyFrameworkBenchmark {
- private static final int MINIMAL_ITERATION = 1000;
- private static final int MEASURE_SECONDS = 1;
-
- private static final DecimalFormat sFormatter = new DecimalFormat("#,###");
-
- private void doBenchmark(String name, Runnable r) {
- // Worm up
- for (int i = 0; i < MINIMAL_ITERATION; i++) {
- r.run();
- }
-
- // Start measuring.
- final long start = System.nanoTime();
- final long end = start + MEASURE_SECONDS * 1_000_000_000L;
-
- double iteration = 0;
- while (System.nanoTime() <= end) {
- for (int i = 0; i < MINIMAL_ITERATION; i++) {
- r.run();
- }
- iteration += MINIMAL_ITERATION;
- }
-
- final long realEnd = System.nanoTime();
-
- System.out.println(String.format("%s\t%s", name,
- sFormatter.format((((double) realEnd - start)) / iteration)));
- }
-
- /**
- * Micro-benchmark for a method without a non-stub caller check.
- */
- @Test
- public void benchNoCallerCheck() {
- doBenchmark("No caller check", TinyFrameworkCallerCheck::getOne_noCheck);
- }
-
- /**
- * Micro-benchmark for a method with a non-stub caller check.
- */
- @Test
- public void benchWithCallerCheck() {
- doBenchmark("With caller check", TinyFrameworkCallerCheck::getOne_withCheck);
- }
-}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java
index bf0f654..68673dc 100644
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java
@@ -17,10 +17,9 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
import com.android.hoststubgen.test.tinyframework.R.Nested;
-import com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses.SubClass;
import org.junit.Rule;
import org.junit.Test;
@@ -41,16 +40,26 @@
assertThat(tfc.stub).isEqualTo(1);
}
-// @Test
-// public void testDoesntCompile() {
-// TinyFrameworkClass tfc = new TinyFrameworkClass();
-//
-// tfc.addOneInner(1); // Shouldn't compile.
-// tfc.toBeRemoved("abc"); // Shouldn't compile.
-// tfc.unsupportedMethod(); // Shouldn't compile.
-// int a = tfc.keep; // Shouldn't compile
-// int b = tfc.remove; // Shouldn't compile
-// }
+ @Test
+ public void testRemove() {
+ TinyFrameworkForTextPolicy tfc = new TinyFrameworkForTextPolicy();
+ assertThrows(NoSuchMethodError.class, () -> tfc.toBeRemoved("abc"));
+ assertThrows(NoSuchFieldError.class, () -> tfc.remove = 1);
+ }
+
+ @Test
+ public void testIgnore() {
+ TinyFrameworkForTextPolicy tfc = new TinyFrameworkForTextPolicy();
+ tfc.toBeIgnoredV();
+ assertThat(tfc.toBeIgnoredZ()).isEqualTo(false);
+ assertThat(tfc.toBeIgnoredB()).isEqualTo(0);
+ assertThat(tfc.toBeIgnoredC()).isEqualTo(0);
+ assertThat(tfc.toBeIgnoredS()).isEqualTo(0);
+ assertThat(tfc.toBeIgnoredI()).isEqualTo(0);
+ assertThat(tfc.toBeIgnoredF()).isEqualTo(0);
+ assertThat(tfc.toBeIgnoredD()).isEqualTo(0);
+ assertThat(tfc.toBeIgnoredObj()).isEqualTo(null);
+ }
@Test
public void testSubstitute() {
@@ -65,48 +74,12 @@
}
@Test
- public void testVisibleButUsesUnsupportedMethod() {
+ public void testUnsupportedMethod() {
TinyFrameworkForTextPolicy tfc = new TinyFrameworkForTextPolicy();
thrown.expect(RuntimeException.class);
thrown.expectMessage("not yet supported");
- tfc.visibleButUsesUnsupportedMethod();
- }
-
- @Test
- public void testNestedClass1() {
- assertThat(new TinyFrameworkNestedClasses().mSupplier.get()).isEqualTo(1);
- }
-
- @Test
- public void testNestedClass2() {
- assertThat(TinyFrameworkNestedClasses.sSupplier.get()).isEqualTo(2);
- }
-
- @Test
- public void testNestedClass3() {
- assertThat(new TinyFrameworkNestedClasses().getSupplier().get()).isEqualTo(3);
- }
-
- @Test
- public void testNestedClass4() {
- assertThat(TinyFrameworkNestedClasses.getSupplier_static().get()).isEqualTo(4);
- }
-
- @Test
- public void testNestedClass5() {
- assertThat((new TinyFrameworkNestedClasses()).new InnerClass().value).isEqualTo(5);
- }
-
- @Test
- public void testNestedClass6() {
- assertThat(new TinyFrameworkNestedClasses.StaticNestedClass().value).isEqualTo(6);
- }
-
- @Test
- public void testNestedClass7() {
- assertThat(TinyFrameworkNestedClasses.StaticNestedClass.getSupplier_static().get())
- .isEqualTo(7);
+ tfc.unsupportedMethod();
}
@Test
@@ -172,28 +145,28 @@
}
@Test
- public void testSubstituteNativeWithThrow() throws Exception {
- // We can't use TinyFrameworkNative.nativeStillNotSupported() directly in this class,
- // because @Throw implies @Keep (not @Stub), and we currently compile this test
- // against the stub jar (so it won't contain @Throw methods).
- //
- // But the method exists at runtime, so we can use reflections to call it.
- //
- // In the real Ravenwood environment, we don't use HostStubGen's stub jar at all,
- // so it's not a problem.
+ public void testSubstituteNativeWithThrow() {
+ thrown.expect(RuntimeException.class);
+ thrown.expectMessage("not yet supported");
- final var clazz = TinyFrameworkNative.class;
- final var method = clazz.getMethod("nativeStillNotSupported");
+ TinyFrameworkNative.nativeStillNotSupported();
+ }
- try {
- method.invoke(null);
+ @Test
+ public void testSubstituteNativeWithKeep() {
+ // We don't want to complicate the test by setting up JNI,
+ // so to test out whether the native method is preserved, we
+ // check whether calling it will throw UnsatisfiedLinkError,
+ // which would only happen on native methods.
+ thrown.expect(UnsatisfiedLinkError.class);
- fail("java.lang.reflect.InvocationTargetException expected");
+ TinyFrameworkNative.nativeStillKeep();
+ }
- } catch (java.lang.reflect.InvocationTargetException e) {
- var inner = e.getCause();
- assertThat(inner.getMessage()).contains("not yet supported");
- }
+ @Test
+ public void testNotNativeRedirect() {
+ TinyFrameworkNative.notNativeStaticRedirected();
+ new TinyFrameworkNative().notNativeRedirected();
}
@Test
@@ -202,12 +175,6 @@
thrown.expectMessage("Outer exception");
TinyFrameworkExceptionTester.testException();
-
- }
-
- @Test
- public void testMethodCallBeforeSuperCall() {
- assertThat(new SubClass(3).value).isEqualTo(3);
}
@Test
@@ -217,7 +184,7 @@
// Having this line before assertThat() will ensure these class are already loaded.
var classes = new Class[]{
TinyFrameworkClassWithInitializerStub.class,
- TinyFrameworkClassAnnotations.class,
+ TinyFrameworkAnnotations.class,
TinyFrameworkForTextPolicy.class,
};
@@ -339,4 +306,16 @@
public void testTypeRename() {
assertThat(TinyFrameworkRenamedClassCaller.foo(1)).isEqualTo(1);
}
+
+ @Test
+ public void testMethodCallReplaceNonStatic() throws Exception {
+ assertThat(TinyFrameworkMethodCallReplace.nonStaticMethodCallReplaceTester())
+ .isEqualTo(true);
+ }
+
+ @Test
+ public void testMethodCallReplaceStatic() throws Exception {
+ assertThat(TinyFrameworkMethodCallReplace.staticMethodCallReplaceTester())
+ .isEqualTo(3);
+ }
}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotationsTest.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotationsTest.java
new file mode 100644
index 0000000..1816b38
--- /dev/null
+++ b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotationsTest.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2024 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 com.android.hoststubgen.test.tinyframework;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class TinyFrameworkClassWideAnnotationsTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void testSimple() {
+ var tfc = new TinyFrameworkClassWideAnnotations();
+ assertThat(tfc.addOne(1)).isEqualTo(2);
+ assertThat(tfc.keep).isEqualTo(1);
+ }
+
+ @Test
+ public void testRemove() {
+ var tfc = new TinyFrameworkClassWideAnnotations();
+ assertThrows(NoSuchMethodError.class, () -> tfc.toBeRemoved("abc"));
+ assertThrows(NoSuchFieldError.class, () -> tfc.remove = 1);
+ }
+
+ @Test
+ public void testSubstitute() {
+ var tfc = new TinyFrameworkClassWideAnnotations();
+ assertThat(tfc.addTwo(1)).isEqualTo(3);
+ }
+
+ @Test
+ public void testUnsupportedMethod() {
+ var tfc = new TinyFrameworkClassWideAnnotations();
+
+ thrown.expect(RuntimeException.class);
+ thrown.expectMessage("not yet supported");
+ tfc.unsupportedMethod();
+ }
+
+ @Test
+ public void testMethodCallBeforeSuperCall() {
+ assertThat(new TinyFrameworkNestedClasses.SubClass(3).value).isEqualTo(3);
+ }
+
+ @Test
+ public void testNestedClass1() {
+ assertThat(new TinyFrameworkNestedClasses().mSupplier.get()).isEqualTo(1);
+ }
+
+ @Test
+ public void testNestedClass2() {
+ assertThat(TinyFrameworkNestedClasses.sSupplier.get()).isEqualTo(2);
+ }
+
+ @Test
+ public void testNestedClass3() {
+ assertThat(new TinyFrameworkNestedClasses().getSupplier().get()).isEqualTo(3);
+ }
+
+ @Test
+ public void testNestedClass4() {
+ assertThat(TinyFrameworkNestedClasses.getSupplier_static().get()).isEqualTo(4);
+ }
+
+ @Test
+ public void testNestedClass5() {
+ assertThat((new TinyFrameworkNestedClasses()).new InnerClass().value).isEqualTo(5);
+ }
+
+ @Test
+ public void testNestedClass6() {
+ assertThat(new TinyFrameworkNestedClasses.StaticNestedClass().value).isEqualTo(6);
+ }
+
+ @Test
+ public void testNestedClass7() {
+ assertThat(TinyFrameworkNestedClasses.StaticNestedClass.getSupplier_static().get())
+ .isEqualTo(7);
+ }
+
+ @Test
+ public void testNestedClass8() {
+ assertThat(new TinyFrameworkNestedClasses.StaticNestedClass.Double$NestedClass().value)
+ .isEqualTo(8);
+ }
+
+ @Test
+ public void testIgnoreAnnotation() {
+ // The actual method will throw, but because of @Ignore, it'll return 0.
+ assertThat(new TinyFrameworkAnnotations().toBeIgnored())
+ .isEqualTo(0);
+ }
+}
diff --git a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithAnnotTest.java b/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithAnnotTest.java
deleted file mode 100644
index 288c716..0000000
--- a/tools/hoststubgen/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithAnnotTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 com.android.hoststubgen.test.tinyframework;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-public class TinyFrameworkClassWithAnnotTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void testSimple() {
- TinyFrameworkClassAnnotations tfc = new TinyFrameworkClassAnnotations();
- assertThat(tfc.addOne(1)).isEqualTo(2);
- assertThat(tfc.stub).isEqualTo(1);
- }
-
-// @Test
-// public void testDoesntCompile() {
-// TinyFrameworkClassWithAnnot tfc = new TinyFrameworkClassWithAnnot();
-//
-// tfc.addOneInner(1); // Shouldn't compile.
-// tfc.toBeRemoved("abc"); // Shouldn't compile.
-// tfc.unsupportedMethod(); // Shouldn't compile.
-// int a = tfc.keep; // Shouldn't compile
-// int b = tfc.remove; // Shouldn't compile
-// }
-
- @Test
- public void testSubstitute() {
- TinyFrameworkClassAnnotations tfc = new TinyFrameworkClassAnnotations();
- assertThat(tfc.addTwo(1)).isEqualTo(3);
- }
-
- @Test
- public void testSubstituteNative() {
- TinyFrameworkClassAnnotations tfc = new TinyFrameworkClassAnnotations();
- assertThat(tfc.nativeAddThree(1)).isEqualTo(4);
- }
-
- @Test
- public void testVisibleButUsesUnsupportedMethod() {
- TinyFrameworkClassAnnotations tfc = new TinyFrameworkClassAnnotations();
-
- thrown.expect(RuntimeException.class);
- thrown.expectMessage("not yet supported");
- tfc.visibleButUsesUnsupportedMethod();
- }
-}
diff --git a/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/asm/AsmUtilsTest.kt b/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/asm/AsmUtilsTest.kt
index 6b46c84..5b2795c 100644
--- a/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/asm/AsmUtilsTest.kt
+++ b/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/asm/AsmUtilsTest.kt
@@ -23,18 +23,6 @@
import org.objectweb.asm.Opcodes.ACC_STATIC
class AsmUtilsTest {
- private fun checkGetDirectOuterClassName(input: String, expected: String?) {
- assertThat(getDirectOuterClassName(input)).isEqualTo(expected)
- }
-
- @Test
- fun testGetDirectOuterClassName() {
- checkGetDirectOuterClassName("a", null)
- checkGetDirectOuterClassName("a\$x", "a")
- checkGetDirectOuterClassName("a.b.c\$x", "a.b.c")
- checkGetDirectOuterClassName("a.b.c\$x\$y", "a.b.c\$x")
- }
-
@Test
fun testVisibility() {
fun test(access: Int, expected: Visibility) {
diff --git a/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/ClassFilterTest.kt b/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/ClassFilterTest.kt
index f651514..d4e75d4 100644
--- a/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/ClassFilterTest.kt
+++ b/tools/hoststubgen/hoststubgen/test/com/android/hoststubgen/utils/ClassFilterTest.kt
@@ -69,6 +69,20 @@
assertThat(f.matches("d/e/f")).isEqualTo(false)
assertThat(f.matches("d/e/f/g")).isEqualTo(true)
assertThat(f.matches("x")).isEqualTo(true)
+
+ assertThat(f.matches("ab/x")).isEqualTo(true)
+ }
+
+ @Test
+ fun testNestedClass() {
+ val f = ClassFilter.buildFromString("a.b.c\nm.n.o\$p\n", false, "X")
+ assertThat(f.matches("a/b/c")).isEqualTo(true)
+ assertThat(f.matches("a/b/c\$d")).isEqualTo(true)
+ assertThat(f.matches("a/b/c\$d\$e")).isEqualTo(true)
+ assertThat(f.matches("m/n/o")).isEqualTo(false)
+ assertThat(f.matches("m/n/o\$p")).isEqualTo(true)
+ assertThat(f.matches("m/n/o\$p\$r")).isEqualTo(true)
+ assertThat(f.matches("m/n/o\$p\$r\$")).isEqualTo(true)
}
@Test
@@ -84,4 +98,18 @@
assertThat(e.message).contains("line 1")
}
}
+
+ @Test
+ fun testSuffix() {
+ val f = ClassFilter.buildFromString("""
+ *.Abc # allow
+ !* # Disallow by default
+ """.trimIndent(), true, "X")
+ assertThat(f.matches("a/b/c")).isEqualTo(false)
+ assertThat(f.matches("a/Abc")).isEqualTo(true)
+ assertThat(f.matches("a/b/c/Abc")).isEqualTo(true)
+ assertThat(f.matches("a/b/c/Abc\$Nested")).isEqualTo(true)
+
+ assertThat(f.matches("a/XyzAbc")).isEqualTo(false)
+ }
}
\ No newline at end of file
diff --git a/tools/hoststubgen/scripts/dump-jar b/tools/hoststubgen/scripts/dump-jar
index fe546fe..8765245 100755
--- a/tools/hoststubgen/scripts/dump-jar
+++ b/tools/hoststubgen/scripts/dump-jar
@@ -26,12 +26,12 @@
Dump a *.class file
- dump-jar [-v] [-s] [-o OUTPUT-FILENAME] JAR-FILE[: filename regex] [...]
+ dump-jar [-v] [-s] [-o OUTPUT-FILENAME] JAR-FILE[: class internal name regex] [...]
Dump a jar file.
If a filename contains a ':', then the following part
- will be used to filter files in the jar file.
+ will be used to filter files in the jar file that matches against class internal names.
For example, "file.jar:/MyClass$" will only dump "MyClass" in file.jar.
@@ -78,16 +78,6 @@
JAVAP_OPTS="-p -c -v"
fi
-
-# Normalize a java class name.
-# Convert '.' to '/'
-# Remove the *.class suffix.
-normalize() {
- local name="$1"
- name="${name%.class}" # Remove the .class suffix.
- echo "$name" | tr '.' '/'
-}
-
# Convert the output for `-s` as needed.
filter_output() {
if (( $simple )) ; then
@@ -124,6 +114,12 @@
fi
}
+# Read jar file names and remove the .class suffix.
+# Also remove non-class files.
+to_internal_names() {
+ sed -ne 's/\.class$//p'
+}
+
for file in "${@}"; do
# *.class?
@@ -136,7 +132,7 @@
# Take the regex. Remove everything up to : in $file
regex=""
if [[ "$file" =~ : ]] ; then
- regex="$(normalize "${file##*:}")"
+ regex="${file##*:}"
fi
# Remove everything after ':', inclusively, in $file.
@@ -151,13 +147,9 @@
echo
fi
- jar tf "$file" | grep '\.class$' | sort | while read -r class ; do
- if normalize "$class" | grep -q -- "$regex" ; then
- echo "## Class: $class"
- javap $dump_code_opt $JAVAP_OPTS -cp $file ${class%.class}
- else
- (( $verbose )) && echo "## Skipping class: $class"
- fi
+ jar tf "$file" | sort | to_internal_names | grep -- "$regex" | while read -r class ; do
+ echo "## Class: $class.class"
+ javap $dump_code_opt $JAVAP_OPTS -cp "$file" "${class}"
done
else