Add privileged app support in Soong

Allow apps to specify that they should be installed in priv-app,
and export the value to Make which normally handles installation.

Test: m checkbuild
Change-Id: I79a05e7bb6ec0df5c31429e2f4592c6fd57dab70
diff --git a/java/app.go b/java/app.go
index ed6a9db..e8dc535 100644
--- a/java/app.go
+++ b/java/app.go
@@ -61,6 +61,11 @@
 	Resource_dirs []string
 
 	Instrumentation_for *string
+
+	// Specifies that this app should be installed to the priv-app directory,
+	// where the system will grant it additional privileges not available to
+	// normal apps.
+	Privileged *bool
 }
 
 type AndroidApp struct {
@@ -152,6 +157,8 @@
 	if ctx.ModuleName() == "framework-res" {
 		// framework-res.apk is installed as system/framework/framework-res.apk
 		ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".apk", a.outputFile)
+	} else if Bool(a.appProperties.Privileged) {
+		ctx.InstallFile(android.PathForModuleInstall(ctx, "priv-app"), ctx.ModuleName()+".apk", a.outputFile)
 	} else {
 		ctx.InstallFile(android.PathForModuleInstall(ctx, "app"), ctx.ModuleName()+".apk", a.outputFile)
 	}