diff options
| author | 2021-04-14 21:35:24 +0100 | |
|---|---|---|
| committer | 2021-04-14 21:35:24 +0100 | |
| commit | bc03588bec3a217f63543a20a5fb620293b0eddb (patch) | |
| tree | 3254918322bff508c787c31184e7ca98c443da74 | |
| parent | 05b999ecb29bda5cd48c3db51441197424886461 (diff) | |
Generate hashtree for compressed apexes
Bug: 184615428
Test: flashed build on device, checked compressed apex has hashtree
Change-Id: I83828f581e84504c47047e7692817da5c44a6ec1
| -rw-r--r-- | apex/builder.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apex/builder.go b/apex/builder.go index 2ce055cfe..e59dc96e3 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -517,6 +517,9 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { outHostBinDir := android.PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "bin").String() prebuiltSdkToolsBinDir := filepath.Join("prebuilts", "sdk", "tools", runtime.GOOS, "bin") + // Figure out if need to compress apex. + compressionEnabled := ctx.Config().CompressedApex() && proptools.BoolDefault(a.properties.Compressible, false) && !a.testApex + if apexType == imageApex { //////////////////////////////////////////////////////////////////////////////////// // Step 2: create canned_fs_config which encodes filemode,uid,gid of each files @@ -631,7 +634,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { ctx.PropertyErrorf("test_only_no_hashtree", "not available") return } - if moduleMinSdkVersion.GreaterThan(android.SdkVersion_Android10) || a.testOnlyShouldSkipHashtreeGeneration() { + if (moduleMinSdkVersion.GreaterThan(android.SdkVersion_Android10) || a.testOnlyShouldSkipHashtreeGeneration()) && !compressionEnabled { // Apexes which are supposed to be installed in builtin dirs(/system, etc) // don't need hashtree for activation. Therefore, by removing hashtree from // apex bundle (filesystem image in it, to be specific), we can save storage. @@ -780,12 +783,11 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { }) a.outputFile = signedOutputFile - // Process APEX compression if enabled or forced if ctx.ModuleDir() != "system/apex/apexd/apexd_testdata" && a.testOnlyShouldForceCompression() { ctx.PropertyErrorf("test_only_force_compression", "not available") return } - compressionEnabled := ctx.Config().CompressedApex() && proptools.BoolDefault(a.properties.Compressible, false) && !a.testApex + if apexType == imageApex && (compressionEnabled || a.testOnlyShouldForceCompression()) { a.isCompressed = true unsignedCompressedOutputFile := android.PathForModuleOut(ctx, a.Name()+".capex.unsigned") |