From e1b6914f58d61fb7279d704dbadc1193744315c3 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 26 Sep 2022 14:48:56 +0900 Subject: [PATCH] Use PackedAdditionalOutputs when reading apk_set for canned_fs_config When an app_set module is included in an APEX, we don't use its `builtFile` which is the main APK, , but `PackedAdditionalOutputs()` which is the zip file where all APK files (main + additional) files are packed. We then unzip them into the corresponding directory inside the APEX. However, `buildFile` still has been used when constructing canned_fs_config whose content should match with what are actually included in the APEX. Fixing the bug by using `PackedAdditionalOutputs()` instead. Bug: 236299724 Test: m nothing (apex_test.go amended) Test: follow https://buganizer.corp.google.com/issues/236299724#comment34 * mkdir for-236299724 * cd for-236299724 * repo init -u https://android.googlesource.com/platform/manifest -b * master --partial-clone --clone-filter=blob:none * repo sync -c -j8 * unzip -l ~/Downloads/mainline_t_2022_jun_t1004275.zip | cut -c31- | grep | xargs rm -f * unzip ~/Downloads/mainline_t_2022_jun_t1004275.zip * source build/envsetup.sh * choosecombo 1 aosp_arm64 userdebug * m com.android.extservices.gms Change-Id: If9752c07748300dbb963568de4e879b041b0a206 --- apex/apex_test.go | 5 +++++ apex/builder.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apex/apex_test.go b/apex/apex_test.go index 18052912a..a69faeb58 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -7241,6 +7241,11 @@ func TestAppSetBundle(t *testing.T) { ensureMatches(t, copyCmds[0], "^rm -rf .*/app/AppSet@TEST.BUILD_ID$") ensureMatches(t, copyCmds[1], "^mkdir -p .*/app/AppSet@TEST.BUILD_ID$") ensureMatches(t, copyCmds[2], "^unzip .*-d .*/app/AppSet@TEST.BUILD_ID .*/AppSet.zip$") + + // Ensure that canned_fs_config has an entry for the app set zip file + generateFsRule := mod.Rule("generateFsConfig") + cmd := generateFsRule.RuleParams.Command + ensureContains(t, cmd, "AppSet.zip") } func TestAppSetBundlePrebuilt(t *testing.T) { diff --git a/apex/builder.go b/apex/builder.go index b95b3bdfd..cb09e35ac 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -1087,7 +1087,7 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Outp } } else if f.class == appSet { appSetDirs = append(appSetDirs, f.installDir) - appSetFiles[f.installDir] = f.builtFile + appSetFiles[f.installDir] = f.module.(*java.AndroidAppSet).PackedAdditionalOutputs() } else { readOnlyPaths = append(readOnlyPaths, pathInApex) }