diff --git a/cc/androidmk.go b/cc/androidmk.go index ff88091d5..c9cd01c79 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -217,6 +217,9 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true") fmt.Fprintln(w, "LOCAL_VNDK_DEPEND_ON_CORE_VARIANT := true") } + if library.checkSameCoreVariant { + fmt.Fprintln(w, "LOCAL_CHECK_SAME_VNDK_VARIANTS := true") + } }) if library.shared() && !library.buildStubs() { diff --git a/cc/library.go b/cc/library.go index ae95bc5c6..f29c4d0ce 100644 --- a/cc/library.go +++ b/cc/library.go @@ -385,7 +385,8 @@ type libraryDecorator struct { // If useCoreVariant is true, the vendor variant of a VNDK library is // not installed. - useCoreVariant bool + useCoreVariant bool + checkSameCoreVariant bool // Decorated interafaces *baseCompiler @@ -1096,8 +1097,11 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) { if ctx.isVndkSp() { library.baseInstaller.subDir = "vndk-sp" } else if ctx.isVndk() { - if ctx.DeviceConfig().VndkUseCoreVariant() && !ctx.mustUseVendorVariant() { - library.useCoreVariant = true + if !ctx.mustUseVendorVariant() { + library.checkSameCoreVariant = true + if ctx.DeviceConfig().VndkUseCoreVariant() { + library.useCoreVariant = true + } } library.baseInstaller.subDir = "vndk" }