Merge "Reduce WarningAllowedProjects."
diff --git a/Android.bp b/Android.bp
index 4dddb28..6d2b804 100644
--- a/Android.bp
+++ b/Android.bp
@@ -222,6 +222,7 @@
         "java/system_modules.go",
     ],
     testSrcs: [
+        "java/app_test.go",
         "java/java_test.go",
     ],
     pluginFor: ["soong_build"],
diff --git a/android/env.go b/android/env.go
index ec5794e..c03431b 100644
--- a/android/env.go
+++ b/android/env.go
@@ -19,8 +19,6 @@
 	"strings"
 
 	"android/soong/env"
-
-	"github.com/google/blueprint"
 )
 
 // This file supports dependencies on environment variables.  During build manifest generation,
@@ -43,13 +41,13 @@
 	os.Clearenv()
 }
 
-func EnvSingleton() blueprint.Singleton {
+func EnvSingleton() Singleton {
 	return &envSingleton{}
 }
 
 type envSingleton struct{}
 
-func (c *envSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
+func (c *envSingleton) GenerateBuildActions(ctx SingletonContext) {
 	envDeps := ctx.Config().(Config).EnvDeps()
 
 	envFile := PathForOutput(ctx, ".soong.environment")
diff --git a/android/register.go b/android/register.go
index 78ae481..6c88af1 100644
--- a/android/register.go
+++ b/android/register.go
@@ -99,5 +99,5 @@
 
 	registerMutators(ctx.Context, preArch, preDeps, postDeps)
 
-	ctx.RegisterSingletonType("env", EnvSingleton)
+	ctx.RegisterSingletonType("env", SingletonFactoryAdaptor(EnvSingleton))
 }
diff --git a/android/testing.go b/android/testing.go
index 3d5e9d9..03572b3 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -54,7 +54,7 @@
 func (ctx *TestContext) Register() {
 	registerMutators(ctx.Context, ctx.preArch, ctx.preDeps, ctx.postDeps)
 
-	ctx.RegisterSingletonType("env", EnvSingleton)
+	ctx.RegisterSingletonType("env", SingletonFactoryAdaptor(EnvSingleton))
 }
 
 func (ctx *TestContext) ModuleForTests(name, variant string) TestingModule {
diff --git a/java/aapt2.go b/java/aapt2.go
index ce307fe..cebd6d1 100644
--- a/java/aapt2.go
+++ b/java/aapt2.go
@@ -54,7 +54,7 @@
 
 var aapt2CompileRule = pctx.AndroidStaticRule("aapt2Compile",
 	blueprint.RuleParams{
-		Command:     `${config.Aapt2Cmd compile -o $outDir $cFlags --legacy $in`,
+		Command:     `${config.Aapt2Cmd} compile -o $outDir $cFlags --legacy $in`,
 		CommandDeps: []string{"${config.Aapt2Cmd}"},
 	},
 	"outDir", "cFlags")
@@ -90,10 +90,10 @@
 
 var aapt2LinkRule = pctx.AndroidStaticRule("aapt2Link",
 	blueprint.RuleParams{
-		Command: `$aapt2Cmd link -o $out $flags --java $genDir --proguard $proguardOptions $inFlags && ` +
+		Command: `${config.Aapt2Cmd} link -o $out $flags --java $genDir --proguard $proguardOptions $inFlags && ` +
 			`${config.SoongZipCmd} -write_if_changed -jar -o $genJar -C $genDir -D $genDir`,
 		CommandDeps: []string{
-			"$aapt2Cmd",
+			"${config.Aapt2Cmd}",
 			"${config.SoongZipCmd}",
 		},
 		Restat: true,