Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f07059c4 authored by John Wu's avatar John Wu Committed by Android (Google) Code Review
Browse files

Merge changes I75c016b9,I497ac49c into main

* changes:
  [HostStubGen] Allow method policy to override native substitution
  [HostStubGen] Remove stub functionality from code
parents effdff16 98c92c15
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ genrule_defaults {
framework_minus_apex_cmd = "$(location hoststubgen) " +
    "@$(location :ravenwood-standard-options) " +
    "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
    "--out-impl-jar $(location ravenwood.jar) " +
    "--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) "
@@ -183,7 +183,7 @@ java_genrule {
        "--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) " +
+14 −3
Original line number Diff line number Diff line
@@ -60,7 +60,9 @@ public final class RavenwoodEnvironment {
    public static void ensureRavenwoodInitialized() {
    }

    private static native void ensureRavenwoodInitialized$ravenwood();
    private static void ensureRavenwoodInitialized$ravenwood() {
        nativeEnsureRavenwoodInitialized();
    }

    /**
     * USE IT SPARINGLY! Returns true if it's running on Ravenwood, hostside test environment.
@@ -92,7 +94,9 @@ public final class RavenwoodEnvironment {
        throw notSupportedOnDevice();
    }

    private native <T> T fromAddress$ravenwood(long address);
    private <T> T fromAddress$ravenwood(long address) {
        return nativeFromAddress(address);
    }

    /**
     * See {@link Workaround}. It's only usable on Ravenwood.
@@ -114,7 +118,14 @@ public final class RavenwoodEnvironment {
        throw notSupportedOnDevice();
    }

    private native String getRavenwoodRuntimePath$ravenwood();
    private String getRavenwoodRuntimePath$ravenwood() {
        return nativeGetRavenwoodRuntimePath();
    }

    // Private native methods that are actually substituted on Ravenwood
    private native <T> T nativeFromAddress(long address);
    private native String nativeGetRavenwoodRuntimePath();
    private static native void nativeEnsureRavenwoodInitialized();

    /**
     * A set of APIs used to work around missing features on Ravenwood. Ideally, this class should
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class RavenwoodEnvironment_host {
    /**
     * Called from {@link RavenwoodEnvironment#ensureRavenwoodInitialized()}.
     */
    public static void ensureRavenwoodInitialized() {
    public static void nativeEnsureRavenwoodInitialized() {

        // TODO Unify it with the initialization code in RavenwoodAwareTestRunnerHook.

@@ -63,14 +63,14 @@ public class RavenwoodEnvironment_host {
    /**
     * Called from {@link RavenwoodEnvironment#getRavenwoodRuntimePath()}.
     */
    public static String getRavenwoodRuntimePath(RavenwoodEnvironment env) {
    public static String nativeGetRavenwoodRuntimePath(RavenwoodEnvironment env) {
        return RavenwoodCommonUtils.getRavenwoodRuntimePath();
    }

    /**
     * Called from {@link RavenwoodEnvironment#fromAddress(long)}.
     */
    public static <T> T fromAddress(RavenwoodEnvironment env, long address) {
    public static <T> T nativeFromAddress(RavenwoodEnvironment env, long address) {
        return JvmWorkaround.getInstance().fromAddress(address);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ hoststubgen_common_options = "$(location hoststubgen) " +
    // "--policy-override-file $(location framework-policy-override.txt) " +
    "@$(location :hoststubgen-standard-options) " +

    "--out-impl-jar $(location host.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) " +
+0 −2
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import java.lang.annotation.Target;

/**
 * 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)
Loading