diff options
author | 2024-02-12 15:00:15 +0000 | |
---|---|---|
committer | 2024-02-13 02:33:12 +0000 | |
commit | 38c64f62cf1fb6afb02c2cdfe99cc1956977bf08 (patch) | |
tree | 93427fd7574826e53067752f6a1b3500deb87f9a /java/hiddenapi_monolithic.go | |
parent | 1c9213d89fe10be0acf82346eeb3431388d5c7fe (diff) |
Restrict verify_overlaps to pre S modules
The runtime in S and above does not have the same constraints that
require the hiddenapi flags to be generated in a monolithic manner.
This CL restricts the verify_overlaps to pre S modules. This will
filter out hiddenapi signature discrepancies that do not require
any action.
Test: verify_overlaps diff with this change https://diff.googleplex.com/#key=xxB0ky93hZRn
Test: presubmits
Bug: 313672880
Change-Id: Ie626a6779fc924563bec90b6c1ab0c7e8b4b23c2
Diffstat (limited to 'java/hiddenapi_monolithic.go')
-rw-r--r-- | java/hiddenapi_monolithic.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/java/hiddenapi_monolithic.go b/java/hiddenapi_monolithic.go index a61018d84..1e30c5f82 100644 --- a/java/hiddenapi_monolithic.go +++ b/java/hiddenapi_monolithic.go @@ -68,7 +68,7 @@ func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory F case *ClasspathFragmentElement: fragment := e.Module() if info, ok := android.OtherModuleProvider(ctx, fragment, HiddenAPIInfoProvider); ok { - monolithicInfo.append(&info) + monolithicInfo.append(ctx, fragment, &info) } else { ctx.ModuleErrorf("%s does not provide hidden API information", fragment) } @@ -79,14 +79,25 @@ func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory F } // append appends all the files from the supplied info to the corresponding files in this struct. -func (i *MonolithicHiddenAPIInfo) append(other *HiddenAPIInfo) { +func (i *MonolithicHiddenAPIInfo) append(ctx android.ModuleContext, otherModule android.Module, other *HiddenAPIInfo) { i.FlagsFilesByCategory.append(other.FlagFilesByCategory) i.AnnotationFlagsPaths = append(i.AnnotationFlagsPaths, other.AnnotationFlagsPath) i.MetadataPaths = append(i.MetadataPaths, other.MetadataPath) i.IndexPaths = append(i.IndexPaths, other.IndexPath) - i.StubFlagSubsets = append(i.StubFlagSubsets, other.StubFlagSubset()) - i.FlagSubsets = append(i.FlagSubsets, other.FlagSubset()) + apexInfo, ok := android.OtherModuleProvider(ctx, otherModule, android.ApexInfoProvider) + if !ok { + ctx.ModuleErrorf("Could not determine min_version_version of %s\n", otherModule.Name()) + return + } + if apexInfo.MinSdkVersion.LessThanOrEqualTo(android.ApiLevelR) { + // Restrict verify_overlaps to R and older modules. + // The runtime in S does not have the same restriction that + // requires the hiddenapi flags to be generated in a monolithic + // invocation. + i.StubFlagSubsets = append(i.StubFlagSubsets, other.StubFlagSubset()) + i.FlagSubsets = append(i.FlagSubsets, other.FlagSubset()) + } } var MonolithicHiddenAPIInfoProvider = blueprint.NewProvider[MonolithicHiddenAPIInfo]() |