VNDK libs use "unique" APEX variants

In case there are two vendor apexes(one with "use_vndk_as_stable:true",
and the other with "use_vndk_as_stable:false") a VNDK lib used by both
will have "APEX" variant and the former APEX will use "apex" variation.

For example,

 apex1(use_vndk_as_stable) -> foo -> libvndk
 apex2 -> bar -> libvndk

Since foo, bar and libvndk are mutated into two APEX variations("",
"apex10000"), foo will use the apex variation of libvndk.

To fix this, VNDK libs can use "unique" APEX variations. Then, in the
above example, foo will have "myapex1" variation and libvndk will have
two APEX variations("" and "apex2"). So foo will link to ""(non-APEX)
variation as fallback.

Bug: 216847402
Test: m nothing (soong tests)
Change-Id: I116932860ef79e22dc338a58b251e3ca693ab4f3
This commit is contained in:
Jooyung Han
2022-02-04 12:36:33 +09:00
parent c5a967630e
commit 91f9203af4
2 changed files with 101 additions and 17 deletions

View File

@@ -3464,6 +3464,14 @@ func (c *Module) AlwaysRequiresPlatformApexVariant() bool {
return c.IsStubs() || c.Target().NativeBridge == android.NativeBridgeEnabled
}
// Overrides android.ApexModuleBase.UniqueApexVariations
func (c *Module) UniqueApexVariations() bool {
// When a vendor APEX needs a VNDK lib in it (use_vndk_as_stable: false), it should be a unique
// APEX variation. Otherwise, another vendor APEX with use_vndk_as_stable:true may use a wrong
// variation of the VNDK lib because APEX variations are merged/grouped.
return c.UseVndk() && c.IsVndk()
}
var _ snapshot.RelativeInstallPath = (*Module)(nil)
// ConvertWithBp2build converts Module to Bazel for bp2build.