Use OutputFilesProvider on aconfig_declarations_group

In the context of incremental soong, the output files
inter-module-communication will be through OutputFilesProvider.
The OutputFileProducer interface will be deprecated.

This CL also removes the unused field "intermediatePath" from
build_flag_declarations and aconfig_declarations

Test: CI
Bug: 339477385
Change-Id: I8417db7ca6ece50b3ecd807fc3b6356aa52b18e0
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index 71a64dd..dac0ae3 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -15,7 +15,6 @@
 package aconfig
 
 import (
-	"fmt"
 	"strings"
 
 	"android/soong/android"
@@ -44,8 +43,6 @@
 		// The flags will only be repackaged if this prop is true.
 		Exportable bool
 	}
-
-	intermediatePath android.WritablePath
 }
 
 func DeclarationsFactory() android.Module {
@@ -86,18 +83,6 @@
 	}
 }
 
-func (module *DeclarationsModule) OutputFiles(tag string) (android.Paths, error) {
-	switch tag {
-	case "":
-		// The default output of this module is the intermediates format, which is
-		// not installable and in a private format that no other rules can handle
-		// correctly.
-		return []android.Path{module.intermediatePath}, nil
-	default:
-		return nil, fmt.Errorf("unsupported aconfig_declarations module reference tag %q", tag)
-	}
-}
-
 func joinAndPrefix(prefix string, values []string) string {
 	var sb strings.Builder
 	for _, v := range values {
@@ -171,5 +156,4 @@
 		IntermediateCacheOutputPath: intermediateCacheFilePath,
 		IntermediateDumpOutputPath:  intermediateDumpFilePath,
 	})
-
 }
diff --git a/aconfig/build_flags/declarations.go b/aconfig/build_flags/declarations.go
index f6a6ee1..e927db2 100644
--- a/aconfig/build_flags/declarations.go
+++ b/aconfig/build_flags/declarations.go
@@ -15,7 +15,6 @@
 package build_flags
 
 import (
-	"fmt"
 	"strings"
 
 	"android/soong/android"
@@ -39,8 +38,6 @@
 		// aconfig files, relative to this Android.bp file
 		Srcs []string `android:"path"`
 	}
-
-	intermediatePath android.WritablePath
 }
 
 func DeclarationsFactory() android.Module {
@@ -53,18 +50,6 @@
 	return module
 }
 
-func (module *DeclarationsModule) OutputFiles(tag string) (android.Paths, error) {
-	switch tag {
-	case "":
-		// The default output of this module is the intermediates format, which is
-		// not installable and in a private format that no other rules can handle
-		// correctly.
-		return []android.Path{module.intermediatePath}, nil
-	default:
-		return nil, fmt.Errorf("unsupported build_flags_declarations module reference tag %q", tag)
-	}
-}
-
 func joinAndPrefix(prefix string, values []string) string {
 	var sb strings.Builder
 	for _, v := range values {
diff --git a/aconfig/codegen/aconfig_declarations_group.go b/aconfig/codegen/aconfig_declarations_group.go
index 1c91bee..33c20cd 100644
--- a/aconfig/codegen/aconfig_declarations_group.go
+++ b/aconfig/codegen/aconfig_declarations_group.go
@@ -15,7 +15,6 @@
 package codegen
 
 import (
-	"fmt"
 	"maps"
 
 	"android/soong/android"
@@ -115,19 +114,9 @@
 		Srcjars:                      adg.javaSrcjars,
 		ModeInfos:                    adg.modeInfos,
 	})
-}
 
-var _ android.OutputFileProducer = (*AconfigDeclarationsGroup)(nil)
-
-func (adg *AconfigDeclarationsGroup) OutputFiles(tag string) (android.Paths, error) {
-	switch tag {
-	case "":
-		return adg.intermediateCacheOutputPaths, nil
-	case ".srcjars":
-		return adg.javaSrcjars, nil
-	default:
-		return nil, fmt.Errorf("unsupported module reference tag %s", tag)
-	}
+	ctx.SetOutputFiles(adg.intermediateCacheOutputPaths, "")
+	ctx.SetOutputFiles(adg.javaSrcjars, ".srcjars")
 }
 
 func (adg *AconfigDeclarationsGroup) Srcjars() android.Paths {