Convert AFDO mutators to TransitionMutator
Convert afdoDepsMutator and afdoMutator to a TransitionMutator as a
step towards variants-on-demand.
This relands Ib05845455ccf43a07b3915a0d7b0a95896062f13 with a fix
to maintain the current behavior of not using AFDO variants for
dependencies of the linker static binary.
Bug: 319288033
Bug: 324141705
Test: afdo_test.go
Change-Id: I76e30021173fc5b7e9e1fa826039776eb3dc7b6e
diff --git a/android/config.go b/android/config.go
index d94a86f..652de58 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1466,18 +1466,18 @@
}
// AfdoProfile returns fully qualified path associated to the given module name
-func (c *deviceConfig) AfdoProfile(name string) (*string, error) {
+func (c *deviceConfig) AfdoProfile(name string) (string, error) {
for _, afdoProfile := range c.config.productVariables.AfdoProfiles {
split := strings.Split(afdoProfile, ":")
if len(split) != 3 {
- return nil, fmt.Errorf("AFDO_PROFILES has invalid value: %s. "+
+ return "", fmt.Errorf("AFDO_PROFILES has invalid value: %s. "+
"The expected format is <module>:<fully-qualified-path-to-fdo_profile>", afdoProfile)
}
if split[0] == name {
- return proptools.StringPtr(strings.Join([]string{split[1], split[2]}, ":")), nil
+ return strings.Join([]string{split[1], split[2]}, ":"), nil
}
}
- return nil, nil
+ return "", nil
}
func (c *deviceConfig) VendorSepolicyDirs() []string {