Snap for 5301221 from 31080223d131993dcd8f9d8728956e9bd6c58e7c to qt-release
Change-Id: Iae8f6323fc172a871f3cbe092aff993fb4a98af3
diff --git a/android/prebuilt_etc.go b/android/prebuilt_etc.go
index 33647d7..8af08c1 100644
--- a/android/prebuilt_etc.go
+++ b/android/prebuilt_etc.go
@@ -25,7 +25,7 @@
func init() {
RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
- RegisterModuleType("prebuilt_etc_host", prebuiltEtcHostFactory)
+ RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
PreDepsMutators(func(ctx RegisterMutatorsContext) {
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
@@ -182,7 +182,7 @@
return module
}
-func prebuiltEtcHostFactory() Module {
+func PrebuiltEtcHostFactory() Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module)
// This module is host-only
diff --git a/android/prebuilt_etc_test.go b/android/prebuilt_etc_test.go
index f31fc9e..d0961a7 100644
--- a/android/prebuilt_etc_test.go
+++ b/android/prebuilt_etc_test.go
@@ -28,7 +28,7 @@
defer tearDown(buildDir)
ctx := NewTestArchContext()
ctx.RegisterModuleType("prebuilt_etc", ModuleFactoryAdaptor(PrebuiltEtcFactory))
- ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(prebuiltEtcHostFactory))
+ ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory))
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
})
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index abe7917..1ecda2d 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -189,6 +189,7 @@
"LOCAL_PRIVILEGED_MODULE": "privileged",
"LOCAL_AAPT_INCLUDE_ALL_RESOURCES": "aapt_include_all_resources",
"LOCAL_USE_EMBEDDED_NATIVE_LIBS": "use_embedded_native_libs",
+ "LOCAL_USE_EMBEDDED_DEX": "use_embedded_dex",
"LOCAL_DEX_PREOPT": "dex_preopt.enabled",
"LOCAL_DEX_PREOPT_APP_IMAGE": "dex_preopt.app_image",
diff --git a/java/aar.go b/java/aar.go
index f6a3d3a..7495bda 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -76,6 +76,7 @@
extraAaptPackagesFile android.Path
isLibrary bool
uncompressedJNI bool
+ useEmbeddedDex bool
aaptProperties aaptProperties
}
@@ -182,7 +183,8 @@
manifestFile := proptools.StringDefault(a.aaptProperties.Manifest, "AndroidManifest.xml")
manifestSrcPath := android.PathForModuleSrc(ctx, manifestFile)
- manifestPath := manifestMerger(ctx, manifestSrcPath, sdkContext, staticLibManifests, a.isLibrary, a.uncompressedJNI)
+ manifestPath := manifestMerger(ctx, manifestSrcPath, sdkContext, staticLibManifests, a.isLibrary,
+ a.uncompressedJNI, a.useEmbeddedDex)
linkFlags, linkDeps, resDirs, overlayDirs, rroDirs := a.aapt2Flags(ctx, sdkContext, manifestPath)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 6d4399d..e63fb80 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -44,7 +44,7 @@
"libs")
func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext sdkContext,
- staticLibManifests android.Paths, isLibrary bool, uncompressedJNI bool) android.Path {
+ staticLibManifests android.Paths, isLibrary bool, uncompressedJNI, useEmbeddedDex bool) android.Path {
var args []string
if isLibrary {
@@ -62,6 +62,10 @@
}
}
+ if useEmbeddedDex {
+ args = append(args, "--use-embedded-dex=true")
+ }
+
// Inject minSdkVersion into the manifest
fixedManifest := android.PathForModuleOut(ctx, "manifest_fixer", "AndroidManifest.xml")
ctx.Build(pctx, android.BuildParams{
diff --git a/java/app.go b/java/app.go
index 47f4f0d..9697582 100644
--- a/java/app.go
+++ b/java/app.go
@@ -73,6 +73,10 @@
// sdk_version or min_sdk_version is set to a version that doesn't support it (<23), defaults to false for other
// module types where the native libraries are generally preinstalled outside the APK.
Use_embedded_native_libs *bool
+
+ // Store dex files uncompressed in the APK and set the android:useEmbeddedDex="true" manifest attribute so that
+ // they are used from inside the APK at runtime.
+ Use_embedded_dex *bool
}
type AndroidApp struct {
@@ -141,6 +145,7 @@
func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.aapt.uncompressedJNI = a.shouldUncompressJNI(ctx)
+ a.aapt.useEmbeddedDex = Bool(a.appProperties.Use_embedded_dex)
a.generateAndroidBuildActions(ctx)
}
@@ -157,6 +162,10 @@
// Returns whether this module should have the dex file stored uncompressed in the APK.
func (a *AndroidApp) shouldUncompressDex(ctx android.ModuleContext) bool {
+ if Bool(a.appProperties.Use_embedded_dex) {
+ return true
+ }
+
if ctx.Config().UnbundledBuild() {
return false
}