Mark generated renderscript header files as implicit outputs

If a generated renderscript header is referenced by a cpp file
clang will insert a depsfile dependency on the header.  If the
generator rule does not include the header as an output, ninja
will not consider the cpp file dirty after the generator runs,
and not rebuild it.  On the next build, it will see that the
timestamp of the generated header is new and consider the cpp
file dirty.

Mark the header files as implicit outputs of the generator.

Bug: 75982985
Test: m libstagefright_mediafilter
      touch frameworks/av/media/libstagefright/filters/saturationARGB.rs
      m libstagefright_mediafilter
      m libstagefright_mediafilter

Change-Id: I3ac899322fe9cae2a6e4171092740339ef844494
diff --git a/cc/rs.go b/cc/rs.go
index 68ba54b..7c9f5d3 100644
--- a/cc/rs.go
+++ b/cc/rs.go
@@ -49,6 +49,11 @@
 	return android.PathForModuleGen(ctx, "rs", "ScriptC_"+fileName+".cpp")
 }
 
+func rsGeneratedHFile(ctx android.ModuleContext, rsFile android.Path) android.WritablePath {
+	fileName := strings.TrimSuffix(rsFile.Base(), rsFile.Ext())
+	return android.PathForModuleGen(ctx, "rs", "ScriptC_"+fileName+".h")
+}
+
 func rsGeneratedDepFile(ctx android.ModuleContext, rsFile android.Path) android.WritablePath {
 	fileName := strings.TrimSuffix(rsFile.Base(), rsFile.Ext())
 	return android.PathForModuleGen(ctx, "rs", fileName+".d")
@@ -56,18 +61,20 @@
 
 func rsGenerateCpp(ctx android.ModuleContext, rsFiles android.Paths, rsFlags string) android.Paths {
 	stampFile := android.PathForModuleGen(ctx, "rs", "rs.stamp")
-	depFiles := make(android.WritablePaths, len(rsFiles))
-	cppFiles := make(android.WritablePaths, len(rsFiles))
-	for i, rsFile := range rsFiles {
-		depFiles[i] = rsGeneratedDepFile(ctx, rsFile)
-		cppFiles[i] = rsGeneratedCppFile(ctx, rsFile)
+	depFiles := make(android.WritablePaths, 0, len(rsFiles))
+	genFiles := make(android.WritablePaths, 0, 2*len(rsFiles))
+	for _, rsFile := range rsFiles {
+		depFiles = append(depFiles, rsGeneratedDepFile(ctx, rsFile))
+		genFiles = append(genFiles,
+			rsGeneratedCppFile(ctx, rsFile),
+			rsGeneratedHFile(ctx, rsFile))
 	}
 
 	ctx.Build(pctx, android.BuildParams{
 		Rule:            rsCpp,
 		Description:     "llvm-rs-cc",
 		Output:          stampFile,
-		ImplicitOutputs: cppFiles,
+		ImplicitOutputs: genFiles,
 		Inputs:          rsFiles,
 		Args: map[string]string{
 			"rsFlags":  rsFlags,