android_system_image only packages "system" items
android_system_image filers packaging items installed outside "system" partition. Some packaging items install related items to different partitions but putting them altogether to android_system_image doesn't make sense. (android_system_image is suppposed to be "system" partition) To be specific, this filters out "apex" partition items. "apex" partition is used by APEX installation to install APEX contents to paths similar to activated paths on device so that symbol lookup works well with APEX contents. Bug: 225121718 Test: atest MicrodroidHostTestCases Test: debugfs <intermediate>/microdroid.img -R 'ls system' shows no "com.android.runtime" Change-Id: Ibc3d85ead2fda99e231132ce8ab9ccf1cc9317b7
This commit is contained in:
@@ -43,8 +43,14 @@ type filesystem struct {
|
||||
// Function that builds extra files under the root directory and returns the files
|
||||
buildExtraFiles func(ctx android.ModuleContext, root android.OutputPath) android.OutputPaths
|
||||
|
||||
// Function that filters PackagingSpecs returned by PackagingBase.GatherPackagingSpecs()
|
||||
filterPackagingSpecs func(specs map[string]android.PackagingSpec)
|
||||
|
||||
output android.OutputPath
|
||||
installDir android.InstallPath
|
||||
|
||||
// For testing. Keeps the result of CopyDepsToZip()
|
||||
entries []string
|
||||
}
|
||||
|
||||
type symlinkDefinition struct {
|
||||
@@ -226,7 +232,7 @@ func (f *filesystem) buildRootZip(ctx android.ModuleContext) android.OutputPath
|
||||
|
||||
func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) android.OutputPath {
|
||||
depsZipFile := android.PathForModuleOut(ctx, "deps.zip").OutputPath
|
||||
f.CopyDepsToZip(ctx, f.GatherPackagingSpecs(ctx), depsZipFile)
|
||||
f.entries = f.CopyDepsToZip(ctx, f.gatherFilteredPackagingSpecs(ctx), depsZipFile)
|
||||
|
||||
builder := android.NewRuleBuilder(pctx, ctx)
|
||||
depsBase := proptools.StringDefault(f.properties.Base_dir, ".")
|
||||
@@ -345,7 +351,7 @@ func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool)
|
||||
}
|
||||
|
||||
depsZipFile := android.PathForModuleOut(ctx, "deps.zip").OutputPath
|
||||
f.CopyDepsToZip(ctx, f.GatherPackagingSpecs(ctx), depsZipFile)
|
||||
f.entries = f.CopyDepsToZip(ctx, f.gatherFilteredPackagingSpecs(ctx), depsZipFile)
|
||||
|
||||
builder := android.NewRuleBuilder(pctx, ctx)
|
||||
depsBase := proptools.StringDefault(f.properties.Base_dir, ".")
|
||||
@@ -434,3 +440,14 @@ func (f *filesystem) SignedOutputPath() android.Path {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Filter the result of GatherPackagingSpecs to discard items targeting outside "system" partition.
|
||||
// Note that "apex" module installs its contents to "apex"(fake partition) as well
|
||||
// for symbol lookup by imitating "activated" paths.
|
||||
func (f *filesystem) gatherFilteredPackagingSpecs(ctx android.ModuleContext) map[string]android.PackagingSpec {
|
||||
specs := f.PackagingBase.GatherPackagingSpecs(ctx)
|
||||
if f.filterPackagingSpecs != nil {
|
||||
f.filterPackagingSpecs(specs)
|
||||
}
|
||||
return specs
|
||||
}
|
||||
|
Reference in New Issue
Block a user