aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-12-13 22:46:28 -0800
committerColin Cross <ccross@android.com>2017-12-14 11:25:45 -0800
commit16056060d5e10fca2b3852022433cca488ff2d47 (patch)
treed43a43d0365085252006be66abd10d989d7f0beb
parent7079856c627369e90fb505d4eb1edd4d56b49dc3 (diff)
downloadbuild_soong-16056060d5e10fca2b3852022433cca488ff2d47.tar.gz
build_soong-16056060d5e10fca2b3852022433cca488ff2d47.tar.bz2
build_soong-16056060d5e10fca2b3852022433cca488ff2d47.zip
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
-rw-r--r--androidmk/cmd/androidmk/android.go1
-rw-r--r--java/androidmk.go3
-rw-r--r--java/app.go7
3 files changed, 11 insertions, 0 deletions
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 4022a5e3..12546215 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -153,6 +153,7 @@ func init() {
"LOCAL_PROPRIETARY_MODULE": "proprietary",
"LOCAL_VENDOR_MODULE": "vendor",
"LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
+ "LOCAL_PRIVILEGED_MODULE": "privileged",
"LOCAL_DEX_PREOPT": "dex_preopt.enabled",
"LOCAL_DEX_PREOPT_APP_IMAGE": "dex_preopt.app_image",
diff --git a/java/androidmk.go b/java/androidmk.go
index 32ee7ac9..11151145 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -177,6 +177,9 @@ func (app *AndroidApp) AndroidMk() android.AndroidMkData {
fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", app.manifestPath.String())
+ if Bool(app.appProperties.Privileged) {
+ fmt.Fprintln(w, "LOCAL_PRIVILEGED_MODULE := true")
+ }
},
},
}
diff --git a/java/app.go b/java/app.go
index ed6a9db5..e8dc5353 100644
--- a/java/app.go
+++ b/java/app.go
@@ -61,6 +61,11 @@ type androidAppProperties struct {
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 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
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)
}