AFDO: Do not mutate on disabled modules
If a module is implicitly disabled due to compile_multilib: "64" on a
32-bit only device, we would insert a dependency to a non-existant AFDO
profile variation.
Test: presubmit
Bug: 350641338
Change-Id: I82851c4bc943405e48f7f35b3484fac2e509bfe5
diff --git a/cc/afdo.go b/cc/afdo.go
index 00b2245..6921edf 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -176,6 +176,9 @@
func (a *afdoTransitionMutator) Mutate(ctx android.BottomUpMutatorContext, variation string) {
if m, ok := ctx.Module().(*Module); ok && m.afdo != nil {
+ if !m.Enabled(ctx) {
+ return
+ }
if variation == "" {
// The empty variation is either a module that has enabled AFDO for itself, or the non-AFDO
// variant of a dependency.