Install appSet using InstallFileWithExtraFilesZip

This fixes a bug that only the primary output of an appSet is installed
when the appSet is part of a flattened APEX.

Bug: 247072627
Test: m GoogleExtServices on a device using flattened APEX.
system/apex/com.android.extservices.gms/priv-app/GoogleExtServices@TM
has these apks:

GoogleExtServices.apk  GoogleExtServices-arm64_v8a.apk
GoogleExtServices-hdpi.apk  GoogleExtServices-ldpi.apk
GoogleExtServices-mdpi.apk  GoogleExtServices-tvdpi.apk
GoogleExtServices-xhdpi.apk  GoogleExtServices-xxhdpi.apk
GoogleExtServices-xxxhdpi.apk

(before the fix, there only was GoogleExtServices.apk)

Change-Id: Icbc4dd002f856a3f751badec781ad132c423ac9b
This commit is contained in:
Jiyong Park
2022-10-19 18:18:56 +09:00
parent bdb7495fe5
commit f648d53154

View File

@@ -922,10 +922,16 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
installedSymlinks = append(installedSymlinks,
ctx.InstallAbsoluteSymlink(installDir, fi.stem(), pathOnDevice))
} else {
target := ctx.InstallFile(installDir, fi.stem(), fi.builtFile)
for _, sym := range fi.symlinks {
installedSymlinks = append(installedSymlinks,
ctx.InstallSymlink(installDir, sym, target))
if fi.class == appSet {
as := fi.module.(*java.AndroidAppSet)
ctx.InstallFileWithExtraFilesZip(installDir, as.BaseModuleName()+".apk",
as.OutputFile(), as.PackedAdditionalOutputs())
} else {
target := ctx.InstallFile(installDir, fi.stem(), fi.builtFile)
for _, sym := range fi.symlinks {
installedSymlinks = append(installedSymlinks,
ctx.InstallSymlink(installDir, sym, target))
}
}
}
}