Fix presigned apk check for privileged apps

The validation checks that run for presigned apps currently expect that
privileged apps have uncompressed dex files but if
DONT_UNCOMPRESS_PRIV_APPS_DEXS is true (UncompressPrivAppDex false) this
doesn't have to be the case so make the validation consistent with this.
Also make TestAndroidAppImport_Preprocessed verify that extra arguments
to 'check_prebuilt_presigned_apk.py' are correct for both privileged and
non-privileged apps.

Test: m nothing --no-skip-soong-tests
Test: Add presigned, privileged android_app_import module with
compressed dex to PRODUCT_PACKAGES for aosp_cf_x86_64_phone,
lunch aosp_cf_x86_64_phone-trunk_staging-userdebug &&
m DONT_UNCOMPRESS_PRIV_APPS_DEXS=true no longer fails due to validation
error.

Change-Id: I7e22cf525cd9d99d1ecb24e4e2e99c3f9de48146
This commit is contained in:
Rashid Zaman
2024-07-23 17:23:05 -07:00
parent 5800d421c3
commit 3bd28705f4
3 changed files with 75 additions and 24 deletions

View File

@@ -431,6 +431,9 @@ func (a *AndroidAppImport) validatePresignedApk(ctx android.ModuleContext, srcAp
var extraArgs []string
if a.Privileged() {
extraArgs = append(extraArgs, "--privileged")
if ctx.Config().UncompressPrivAppDex() {
extraArgs = append(extraArgs, "--uncompress-priv-app-dex")
}
}
if proptools.Bool(a.properties.Skip_preprocessed_apk_checks) {
extraArgs = append(extraArgs, "--skip-preprocessed-apk-checks")