Move generation of global hidden API flags to platform_bootclasspath

This change moves the generation of the global hidden API flags from
the singleton to the platform_bootclasspath module. It involves:
1. Moving the ruleToGenerateHiddenApiFlags to hiddenapi_modular.go.
2. Adding HiddenAPIAugmentationProperties to be used by the
   platform_bootclasspath type.
3. Moving the file paths into the platform-bootclasspath module
   definition in frameworks/base/boot/Android.bp.

The flagsRule is kept as a placeholder for now. The emptyFlagsRule is
also kept so that builds continue to work even when the frameworks/base
repository is not present.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Idf4dd414a016831bfe04a01f93234c1c33819881
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 341381a..641e19f 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -18,7 +18,6 @@
 	"fmt"
 
 	"android/soong/android"
-	"android/soong/genrule"
 )
 
 func init() {
@@ -321,109 +320,13 @@
 	return outputPath
 }
 
-// flagsRule creates a rule to build hiddenapi-flags.csv out of flags.csv files generated for boot image modules and
-// the unsupported API.
+// flagsRule is a placeholder that simply returns the location of the file, the generation of the
+// ninja rules is done in generateHiddenAPIBuildActions.
 func flagsRule(ctx android.SingletonContext) android.Path {
-	var flagsCSV android.Paths
-	var combinedRemovedApis android.Path
-
-	ctx.VisitAllModules(func(module android.Module) {
-		if h, ok := module.(hiddenAPIIntf); ok {
-			if csv := h.flagsCSV(); csv != nil {
-				flagsCSV = append(flagsCSV, csv)
-			}
-		} else if g, ok := module.(*genrule.Module); ok {
-			if ctx.ModuleName(module) == "combined-removed-dex" {
-				if len(g.GeneratedSourceFiles()) != 1 || combinedRemovedApis != nil {
-					ctx.Errorf("Expected 1 combined-removed-dex module that generates 1 output file.")
-				}
-				combinedRemovedApis = g.GeneratedSourceFiles()[0]
-			}
-		}
-	})
-
-	if combinedRemovedApis == nil {
-		ctx.Errorf("Failed to find combined-removed-dex.")
-	}
-
 	outputPath := hiddenAPISingletonPaths(ctx).flags
-
-	stubFlags := hiddenAPISingletonPaths(ctx).stubFlags
-
-	pathsForSource := func(paths ...string) android.Paths { return android.PathsForSource(ctx, paths) }
-
-	ruleToGenerateHiddenApiFlags(ctx, outputPath, stubFlags, flagsCSV, hiddenAPIAugmentationInfo{
-		Unsupported:               pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-unsupported.txt"),
-		Removed:                   android.Paths{combinedRemovedApis},
-		Max_target_r_low_priority: pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-max-target-r-loprio.txt"),
-		Max_target_q:              pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-max-target-q.txt"),
-		Max_target_p:              pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-max-target-p.txt"),
-		Max_target_o_low_priority: pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-max-target-o.txt"),
-		Blocked:                   pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-force-blocked.txt"),
-		Unsupported_packages:      pathsForSource("frameworks/base/boot/hiddenapi/hiddenapi-unsupported-packages.txt"),
-	})
-
 	return outputPath
 }
 
-// ruleToGenerateHiddenApiFlags creates a rule to create the monolithic hidden API flags from the
-// flags from all the modules, the stub flags, augmented with some additional configuration files.
-//
-// baseFlagsPath is the path to the flags file containing all the information from the stubs plus
-// an entry for every single member in the dex implementation jars of the individual modules. Every
-// signature in any of the other files MUST be included in this file.
-//
-// moduleSpecificFlagsPaths are the paths to the flags files generated by each module using
-// information from the baseFlagsPath as well as from annotations within the source.
-//
-// augmentationInfo is a struct containing paths to files that augment the information provided by
-// the moduleSpecificFlagsPaths.
-func ruleToGenerateHiddenApiFlags(ctx android.BuilderContext, outputPath android.WritablePath, baseFlagsPath android.Path, moduleSpecificFlagsPaths android.Paths, augmentationInfo hiddenAPIAugmentationInfo) {
-	tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
-	rule := android.NewRuleBuilder(pctx, ctx)
-	command := rule.Command().
-		BuiltTool("generate_hiddenapi_lists").
-		FlagWithInput("--csv ", baseFlagsPath).
-		Inputs(moduleSpecificFlagsPaths).
-		FlagWithOutput("--output ", tempPath)
-
-	for _, path := range augmentationInfo.Unsupported {
-		command.FlagWithInput("--unsupported ", path)
-	}
-
-	for _, path := range augmentationInfo.Removed {
-		command.FlagWithInput("--unsupported ", path).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "removed")
-	}
-
-	for _, path := range augmentationInfo.Max_target_r_low_priority {
-		command.FlagWithInput("--max-target-r ", path).FlagWithArg("--tag ", "lo-prio")
-	}
-
-	for _, path := range augmentationInfo.Max_target_q {
-		command.FlagWithInput("--max-target-q ", path)
-	}
-
-	for _, path := range augmentationInfo.Max_target_p {
-		command.FlagWithInput("--max-target-p ", path)
-	}
-
-	for _, path := range augmentationInfo.Max_target_o_low_priority {
-		command.FlagWithInput("--max-target-o ", path).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "lo-prio")
-	}
-
-	for _, path := range augmentationInfo.Blocked {
-		command.FlagWithInput("--blocked ", path)
-	}
-
-	for _, path := range augmentationInfo.Unsupported_packages {
-		command.FlagWithInput("--unsupported ", path).Flag("--packages ")
-	}
-
-	commitChangeForRestat(rule, tempPath, outputPath)
-
-	rule.Build("hiddenAPIFlagsFile", "hiddenapi flags")
-}
-
 // emptyFlagsRule creates a rule to build an empty hiddenapi-flags.csv, which is needed by master-art-host builds that
 // have a partial manifest without frameworks/base but still need to build a boot image.
 func emptyFlagsRule(ctx android.SingletonContext) android.Path {