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

Commit 25110736 authored by John Wu's avatar John Wu
Browse files

[Ravenwood] Apply a common policy across all code

Some policies should apply to all code processed by hoststubgen
universally, e.g. host side JVM workarounds. Update hoststubgen to
accept multiple policy files, and make sure all existing framework jars
have this universal policy applied.

Flag: EXEMPT host test change only
Bug: 292141694
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh
Change-Id: Icc0e775b5ba0dd6a09768be8cda4b03cb33522a5
parent 2abff41f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -11,6 +11,14 @@ package {
    default_team: "trendy_team_framework_backstage_power",
}

filegroup {
    name: "ravenwood-common-policies",
    srcs: [
        "texts/ravenwood-common-policies.txt",
    ],
    visibility: ["//visibility:private"],
}

filegroup {
    name: "ravenwood-services-policies",
    srcs: [
+11 −9
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ genrule_defaults {
    tools: ["hoststubgen"],
    srcs: [
        ":framework-minus-apex-for-host",
        ":ravenwood-common-policies",
        ":ravenwood-framework-policies",
        ":ravenwood-standard-options",
        ":ravenwood-annotation-allowed-classes",
@@ -46,6 +47,7 @@ framework_minus_apex_cmd = "$(location hoststubgen) " +
    "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
    "--out-jar $(location ravenwood.jar) " +
    "--in-jar $(location :framework-minus-apex-for-host) " +
    "--policy-override-file $(location :ravenwood-common-policies) " +
    "--policy-override-file $(location :ravenwood-framework-policies) " +
    "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "

@@ -180,17 +182,18 @@ java_genrule {
        "--debug-log $(location hoststubgen_services.core.log) " +
        "--stats-file $(location hoststubgen_services.core_stats.csv) " +
        "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +

        "--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) " +

        "--out-jar $(location ravenwood.jar) " +
        "--in-jar $(location :services.core-for-host) " +

        "--policy-override-file $(location :ravenwood-common-policies) " +
        "--policy-override-file $(location :ravenwood-services-policies) " +
        "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
    srcs: [
        ":services.core-for-host",
        ":ravenwood-common-policies",
        ":ravenwood-services-policies",
        ":ravenwood-standard-options",
        ":ravenwood-annotation-allowed-classes",
@@ -247,21 +250,20 @@ java_genrule {
        "--debug-log $(location hoststubgen_core-icu4j-for-host.log) " +
        "--stats-file $(location hoststubgen_core-icu4j-for-host_stats.csv) " +
        "--supported-api-list-file $(location hoststubgen_core-icu4j-for-host_apis.csv) " +

        "--out-jar $(location ravenwood.jar) " +

        "--gen-keep-all-file $(location hoststubgen_core-icu4j-for-host_keep_all.txt) " +
        "--gen-input-dump-file $(location hoststubgen_core-icu4j-for-host_dump.txt) " +

        "--out-jar $(location ravenwood.jar) " +
        "--in-jar $(location :core-icu4j-for-host) " +
        "--policy-override-file $(location :icu-ravenwood-policies) " +
        "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",

        "--policy-override-file $(location :ravenwood-common-policies) " +
        "--policy-override-file $(location :icu-ravenwood-policies) ",
    srcs: [
        ":core-icu4j-for-host",

        ":ravenwood-common-policies",
        ":icu-ravenwood-policies",
        ":ravenwood-standard-options",
        ":ravenwood-annotation-allowed-classes",
    ],
    out: [
        "ravenwood.jar",
+20 −0
Original line number Diff line number Diff line
# Ravenwood "policy" that should apply to all code.

# Keep all AIDL interfaces
class :aidl keepclass

# Keep all feature flag implementations
class :feature_flags keepclass

# Keep all sysprops generated code implementations
class :sysprops keepclass

# Keep all resource R classes
class :r keepclass

# 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
+0 −19
Original line number Diff line number Diff line
# Ravenwood "policy" file for framework-minus-apex.

# Keep all AIDL interfaces
class :aidl keepclass

# Keep all feature flag implementations
class :feature_flags keepclass

# 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 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
+0 −6
Original line number Diff line number Diff line
# Ravenwood "policy" file for services.core.

# Keep all AIDL interfaces
class :aidl keepclass

# Keep all feature flag implementations
class :feature_flags keepclass
Loading