Make dex_preopt.enable_prof_rewrite=false an error for optimized apps
If profile guided dexpreopt _and_ optimization/obfuscation is true, then
apps must use the rewritten profile created by r8/d8
Bug: 335418838
Test: m nothing --no-skip-soong-tests
Change-Id: Iac45b614f43e52ac40ad1d13df0338bcafa788c3
diff --git a/java/base.go b/java/base.go
index 056dbd5..b4f800b 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1650,6 +1650,11 @@
classesJar: implementationAndResourcesJar,
jarName: jarName,
}
+ if j.GetProfileGuided() && j.optimizeOrObfuscateEnabled() && !j.EnableProfileRewriting() {
+ ctx.PropertyErrorf("enable_profile_rewriting",
+ "Enable_profile_rewriting must be true when profile_guided dexpreopt and R8 optimization/obfuscation is turned on. The attached profile should be sourced from an unoptimized/unobfuscated APK.",
+ )
+ }
if j.EnableProfileRewriting() {
profile := j.GetProfile()
if profile == "" || !j.GetProfileGuided() {