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
diff --git a/apex/builder.go b/apex/builder.go
index ad8075b..e4c1673 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -922,10 +922,16 @@
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))
+ }
}
}
}