From 7fd531f5d1a92a473ebd6bf3c06d4351c743d569 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Wed, 5 Jun 2024 19:27:18 +0000 Subject: Identify profile providing apexes using ApexInfo `com.android.art` and its overrides include a `etc/boot-image.prof` which is used on device for profile guided dexopt. ``` $ deapexer list /com.android.art.apex | grep boot-image $ deapexer list /com.google.android.art.apex | grep boot-image ``` To identify that we should include a boot-image.prof in the override apexes, we currently look at ApexInfo.InApexVariants in the context of art's bootclasspath fragment module. InApexVariants are colated based on the min_sdk_version of the top-level apex. At ToT, we have a single variant of `art-bootlcasspath-fragment` for aosp art apex, google art apex and google go art apex. When google go art apex overrides the min_sdk_version, ApexInfo is cleaved, and two distinct variants of art-bootclasspath-fragment are created. The one corresponding to go art apex does not know we should include boot-image.prof To fix this, use AllApexInfoProvider instead. If any of the apexInfos corresponds to com.android.art, include etc/boot-image.prof Test: Added a unit test Test: With https://b.corp.google.com/issues/345173231#comment2 reverted, m com.google.android.go.art && deapexer list # verified that boot-image.prof exists Bug: 345173231 Bug: 295311875 Change-Id: I5a0e8f74725388f05343c64f268260b1eb139ae5 --- java/bootclasspath_fragment.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'java/bootclasspath_fragment.go') diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 4d3d794d8..16209b72e 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -524,10 +524,16 @@ func (b *BootclasspathFragmentModule) getProfileProviderApex(ctx android.BaseMod } // Bootclasspath fragment modules that are for the platform do not produce boot related files. - apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) - for _, apex := range apexInfo.InApexVariants { - if isProfileProviderApex(ctx, apex) { - return apex + apexInfos, _ := android.ModuleProvider(ctx, android.AllApexInfoProvider) + if apexInfos == nil { + return "" + } + + for _, apexInfo := range apexInfos.ApexInfos { + for _, apex := range apexInfo.InApexVariants { + if isProfileProviderApex(ctx, apex) { + return apex + } } } -- cgit v1.2.3-59-g8ed1b