Allow building framework.jar and framework-res.apk
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.
Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
diff --git a/java/app.go b/java/app.go
index bd9ed2a..b66eb4b 100644
--- a/java/app.go
+++ b/java/app.go
@@ -27,6 +27,7 @@
func init() {
android.RegisterPreSingletonType("overlay", OverlaySingletonFactory)
+ android.RegisterModuleType("android_app", AndroidAppFactory)
}
// AAR prebuilts
@@ -76,7 +77,7 @@
if !Bool(a.properties.No_framework_libs) && !Bool(a.properties.No_standard_libs) {
switch String(a.deviceProperties.Sdk_version) { // TODO: Res_sdk_version?
- case "current", "system_current", "":
+ case "current", "system_current", "test_current", "":
ctx.AddDependency(ctx.Module(), frameworkResTag, "framework-res")
default:
// We'll already have a dependency on an sdk prebuilt android.jar
@@ -116,7 +117,13 @@
// a.properties.Proguard.Enabled = true
//}
- a.Module.compile(ctx)
+ if String(a.appProperties.Instrumentation_for) == "" {
+ a.properties.Instrument = true
+ }
+
+ if ctx.ModuleName() != "framework-res" {
+ a.Module.compile(ctx, a.aaptSrcJar)
+ }
certificate := String(a.appProperties.Certificate)
if certificate == "" {
@@ -138,7 +145,12 @@
a.outputFile = packageFile
- ctx.InstallFile(android.PathForModuleInstall(ctx, "app"), ctx.ModuleName()+".apk", a.outputFile)
+ 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 {
+ ctx.InstallFile(android.PathForModuleInstall(ctx, "app"), ctx.ModuleName()+".apk", a.outputFile)
+ }
}
var aaptIgnoreFilenames = []string{