Separate the collation of mutators from registration

This separates the collation of mutators from the registration of them
to allow the test infrastructure to sort the mutator order to match
that used at runtime.

Bug: 181953909
Test: m nothing
Change-Id: I01a073289d44417f327b0815c09eb1c033d464f2
diff --git a/android/mutator.go b/android/mutator.go
index 8bfb24e..9552aa1 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -69,7 +69,14 @@
 	mctx.mutators.registerAll(ctx)
 }
 
-func registerMutators(ctx *Context, preArch, preDeps, postDeps, finalDeps []RegisterMutatorFunc) {
+// collateGloballyRegisteredMutators constructs the list of mutators that have been registered
+// with the InitRegistrationContext and will be used at runtime.
+func collateGloballyRegisteredMutators() sortableComponents {
+	return collateRegisteredMutators(preArch, preDeps, postDeps, finalDeps)
+}
+
+// collateRegisteredMutators constructs a single list of mutators from the separate lists.
+func collateRegisteredMutators(preArch, preDeps, postDeps, finalDeps []RegisterMutatorFunc) sortableComponents {
 	mctx := &registerMutatorsContext{}
 
 	register := func(funcs []RegisterMutatorFunc) {
@@ -89,7 +96,7 @@
 	mctx.finalPhase = true
 	register(finalDeps)
 
-	mctx.mutators.registerAll(ctx)
+	return mctx.mutators
 }
 
 type registerMutatorsContext struct {