Preserve debug info for unoptimized services.jar
A recent change enabled very basic stripping of services.jar for the
unoptimized path where OPTIMIZE_SYSTEM_JAVA=false, avoiding some
unnecessary bloat from permissions deps. However, by enabling R8
for this path, it implicitly enabled compilation with `--release`,
which strips debug info.
Explicitly set `--debug` for this scenario to ensure debug info is kept.
Also update the associated comments to reflect more recent changes to
this condition.
Test: OPTIMIZE_SYSTEM_JAVA=false m services
Bug: 298311479
Change-Id: If04075c9bb7d4200b26ec8dc622f42500a312f80
diff --git a/services/Android.bp b/services/Android.bp
index 9264172..f237095 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -34,17 +34,18 @@
},
}
-// 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
+// Config to control optimizing and shrinking the services target using R8.
+// Set via `export SYSTEM_OPTIMIZE_JAVA=true|false`, 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"],
+ properties: [
+ "optimize",
+ "dxflags",
+ ],
}
system_optimized_java_defaults {
@@ -75,6 +76,9 @@
// permission subpackage to prune unused jarjar'ed Kotlin dependencies.
proguard_flags_files: ["proguard_permission.flags"],
},
+ // Explicitly configure R8 to preserve debug info, as this path should
+ // really only allow stripping of permission-specific code and deps.
+ dxflags: ["--debug"],
},
},
},