From 280a31aac39697a069f2f2f2ee471ffafb52d2a3 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Sun, 27 Jun 2021 20:28:29 +0100 Subject: Calculate widest stub dex jars per module Previously, the stub dex jars for each HiddenAPIScope was created by merging the stub dex jars provided by each module for that scope. Then the widest stub dex jars were chosen. So, if module A provided public, system and test stub dex jars and module B provided only public then the stub dex jars for each scope would be: * public -> A,B * system -> A * test -> A So, the widest API scope for which there are stub dex jars is "test" and so the widest stub dex jars would just come from module A and not module B. So, when "hiddenapi list" is run for module C which depends on modules A and B it only gets given stub dex jars for module A which means that it cannot resolve all the types that C may use which can lead to incorrect flags being generated. This change does not merge the stub dex jars from each module together and instead keeps them separate by module. The widest stub dex jars list is constructed by asking each module in turn for their widest stub dex jars. e.g. Given the above example we would have: Module A: * public * system * test <- widest Module B: * public <- widest So, the widest stub dex jars will be A's test and B's public stub dex jars. Bug: 179354495 Test: m out/soong/hiddenapi-flags.csv - make sure that this does not change the file. Change-Id: Ib137825ebffe94b2bf220732bae6077f7b7ac6db --- apex/bootclasspath_fragment_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apex/bootclasspath_fragment_test.go') diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index 8554c19c2..4b1600e1c 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -219,7 +219,8 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) { checkAPIScopeStubs := func(message string, info java.HiddenAPIInfo, apiScope *java.HiddenAPIScope, expectedPaths ...string) { t.Helper() - android.AssertPathsRelativeToTopEquals(t, fmt.Sprintf("%s %s", message, apiScope), expectedPaths, info.TransitiveStubDexJarsByScope[apiScope]) + paths := info.TransitiveStubDexJarsByScope.StubDexJarsForScope(apiScope) + android.AssertPathsRelativeToTopEquals(t, fmt.Sprintf("%s %s", message, apiScope), expectedPaths, paths) } // Check stub dex paths exported by art. -- cgit v1.2.3-59-g8ed1b