Merge "uncompressedDex option for android_app_import."
This commit is contained in:
30
java/app.go
30
java/app.go
@@ -188,19 +188,12 @@ func (a *AndroidApp) shouldUncompressDex(ctx android.ModuleContext) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncompress dex in APKs of privileged apps, and modules used by privileged apps.
|
// Uncompress dex in APKs of privileged apps
|
||||||
if ctx.Config().UncompressPrivAppDex() &&
|
if ctx.Config().UncompressPrivAppDex() && Bool(a.appProperties.Privileged) {
|
||||||
(Bool(a.appProperties.Privileged) ||
|
|
||||||
inList(ctx.ModuleName(), ctx.Config().ModulesLoadedByPrivilegedModules())) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncompress if the dex files is preopted on /system.
|
return shouldUncompressDex(ctx, &a.dexpreopter)
|
||||||
if !a.dexpreopter.dexpreoptDisabled(ctx) && (ctx.Host() || !odexOnSystemOther(ctx, a.dexpreopter.installPath)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
||||||
@@ -683,6 +676,20 @@ func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
|
|||||||
rule.Build(pctx, ctx, "uncompress-embedded-jni-libs", "Uncompress embedded JIN libs")
|
rule.Build(pctx, ctx, "uncompress-embedded-jni-libs", "Uncompress embedded JIN libs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns whether this module should have the dex file stored uncompressed in the APK.
|
||||||
|
func (a *AndroidAppImport) shouldUncompressDex(ctx android.ModuleContext) bool {
|
||||||
|
if ctx.Config().UnbundledBuild() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncompress dex in APKs of privileged apps
|
||||||
|
if ctx.Config().UncompressPrivAppDex() && Bool(a.properties.Privileged) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return shouldUncompressDex(ctx, &a.dexpreopter)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
if String(a.properties.Certificate) == "" && !Bool(a.properties.Presigned) {
|
if String(a.properties.Certificate) == "" && !Bool(a.properties.Presigned) {
|
||||||
ctx.PropertyErrorf("certificate", "No certificate specified for prebuilt")
|
ctx.PropertyErrorf("certificate", "No certificate specified for prebuilt")
|
||||||
@@ -705,12 +712,11 @@ func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext
|
|||||||
jnisUncompressed := android.PathForModuleOut(ctx, "jnis-uncompressed", ctx.ModuleName()+".apk")
|
jnisUncompressed := android.PathForModuleOut(ctx, "jnis-uncompressed", ctx.ModuleName()+".apk")
|
||||||
a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed.OutputPath)
|
a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed.OutputPath)
|
||||||
|
|
||||||
// TODO: Uncompress dex if applicable
|
|
||||||
|
|
||||||
installDir := android.PathForModuleInstall(ctx, "app", a.BaseModuleName())
|
installDir := android.PathForModuleInstall(ctx, "app", a.BaseModuleName())
|
||||||
a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk")
|
a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk")
|
||||||
a.dexpreopter.isInstallable = true
|
a.dexpreopter.isInstallable = true
|
||||||
a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned)
|
a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned)
|
||||||
|
a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx)
|
||||||
dexOutput := a.dexpreopter.dexpreopt(ctx, jnisUncompressed)
|
dexOutput := a.dexpreopter.dexpreopt(ctx, jnisUncompressed)
|
||||||
|
|
||||||
// Sign or align the package
|
// Sign or align the package
|
||||||
|
Reference in New Issue
Block a user