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

Commit 4746631e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Allow flag-guarded Java optimizations for services"

parents 93b3eb84 4514bdf1
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -23,6 +23,36 @@ java_defaults {
    },
}

// Opt-in config for optimizing and shrinking the services target using R8.
// Enabled via `export SYSTEM_OPTIMIZE_JAVA=true`, or explicitly in Make via the
// `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA` variable.
// TODO(b/196084106): Enable optimizations by default after stabilizing and
// building out retrace infrastructure.
soong_config_module_type {
    name: "system_optimized_java_defaults",
    module_type: "java_defaults",
    config_namespace: "ANDROID",
    bool_variables: ["SYSTEM_OPTIMIZE_JAVA"],
    properties: ["optimize"],
}

system_optimized_java_defaults {
    name: "services_java_defaults",
    soong_config_variables: {
        SYSTEM_OPTIMIZE_JAVA: {
            optimize: {
                enabled: true,
                optimize: true,
                shrink: true,
                proguard_flags_files: ["proguard.flags"],
            },
            // Note: Optimizations are disabled by default if unspecified in
            // the java_library rule.
            conditions_default: {},
        },
    },
}

filegroup {
    name: "services-main-sources",
    srcs: [
@@ -81,6 +111,7 @@ java_library {
// ============================================================
java_library {
    name: "services",
    defaults: ["services_java_defaults"],
    installable: true,

    dex_preopt: {
+11 −0
Original line number Diff line number Diff line
# TODO(b/196084106): Refine and optimize this configuration. Note that this
# configuration is only used when `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA=true`.
-keep,allowoptimization,allowaccessmodification class ** {
  *;
}

# Various classes subclassed in ethernet-service (avoid marking final).
-keep public class android.net.** { *; }

# Referenced via CarServiceHelperService in car-frameworks-service (avoid removing).
-keep public class com.android.server.utils.Slogf { *; }
 No newline at end of file