Soong AAR prebuilt support

Add support for android_library_import modules that take an
aar file.

Bug: 73724997
Test: m checkbuild
Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
diff --git a/java/aapt2.go b/java/aapt2.go
index 84e3729..fd7388e 100644
--- a/java/aapt2.go
+++ b/java/aapt2.go
@@ -81,6 +81,8 @@
 			Outputs:     outPaths,
 			Args: map[string]string{
 				"outDir": android.PathForModuleOut(ctx, "aapt2", dir.String()).String(),
+				// Always set --pseudo-localize, it will be stripped out later for release
+				// builds that don't want it.
 				"cFlags": "--pseudo-localize",
 			},
 		})
@@ -92,6 +94,21 @@
 	return ret
 }
 
+func aapt2CompileDirs(ctx android.ModuleContext, flata android.WritablePath, dirs android.Paths, deps android.Paths) {
+	ctx.Build(pctx, android.BuildParams{
+		Rule:        aapt2CompileRule,
+		Description: "aapt2 compile dirs",
+		Implicits:   deps,
+		Output:      flata,
+		Args: map[string]string{
+			"outDir": flata.String(),
+			// Always set --pseudo-localize, it will be stripped out later for release
+			// builds that don't want it.
+			"cFlags": "--pseudo-localize " + android.JoinWithPrefix(dirs.Strings(), "--dir "),
+		},
+	})
+}
+
 var aapt2LinkRule = pctx.AndroidStaticRule("aapt2Link",
 	blueprint.RuleParams{
 		Command: `${config.Aapt2Cmd} link -o $out $flags --java $genDir --proguard $proguardOptions $inFlags && ` +