Merge "Allow flag-guarded Java optimizations for services" am: 4746631ed1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1897075 Change-Id: Ifbc5157860b63ecd48a469393f1eb06f9a3852da
This commit is contained in:
@@ -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
services/proguard.flags
Normal file
11
services/proguard.flags
Normal file
@@ -0,0 +1,11 @@
|
||||
# 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 { *; }
|
||||
Reference in New Issue
Block a user