From 41f637d6533d75823fbaf878eed2b3017cfe1a9a Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 9 Sep 2020 13:18:02 +0900 Subject: [PATCH] Notice files for prebuilt_etc are included in APEX This change fixes a bug that notice files for some module type (e.g. prebuilt_etc) were not included in APEX. This happened because we relied on WalkPayloadDeps which actually doesn't traverse module types that don't implement ApexModule interface. prebuilt_etc is one such module type. Fixing the problem by also iterating the filesInfo array which has info about all modules that are included in the APEX. Bug: 166575301 Test: m com.android.tzdata and inspect the built artifact. NOTICE.html.gz is there. Change-Id: Iceb055b60184aef2a3e65e44680304853eb79a53 --- apex/apex.go | 3 +++ apex/builder.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/apex/apex.go b/apex/apex.go index 62d91da86..c95ee94a7 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1189,6 +1189,8 @@ type apexFile struct { overriddenPackageName string // only for apps isJniLib bool + + noticeFiles android.Paths } func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, androidMkModuleName string, installDir string, class apexFileClass, module android.Module) apexFile { @@ -1204,6 +1206,7 @@ func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, androidM ret.requiredModuleNames = module.RequiredModuleNames() ret.targetRequiredModuleNames = module.TargetRequiredModuleNames() ret.hostRequiredModuleNames = module.HostRequiredModuleNames() + ret.noticeFiles = module.NoticeFiles() } return ret } diff --git a/apex/builder.go b/apex/builder.go index 22cd69bf4..26afb04d2 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -286,6 +286,10 @@ func (a *apexBundle) buildNoticeFiles(ctx android.ModuleContext, apexFileName st return true }) + for _, fi := range a.filesInfo { + noticeFiles = append(noticeFiles, fi.noticeFiles...) + } + if len(noticeFiles) == 0 { return android.NoticeOutputs{} }