Add support for no-vendor-variant VNDK
When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed. Since not all VNDK libraries will be
ready for this, we keep a list of library names in cc/vndk.go to
indicate which libraries must have their vendor variants always
installed regardless of whether no-vendor-variant VNDK is enabled.
Also add --remove-build-id option to the strip script to facilitate
the check of functional identity of the two variants.
Bug: 119423884
Test: Add a dummy VNDK library and build with
TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding
build/make change.
Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
diff --git a/cc/androidmk.go b/cc/androidmk.go
index d229d0c..02806f9 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -185,6 +185,12 @@
if library.coverageOutputFile.Valid() {
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
}
+
+ if library.useCoreVariant {
+ fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
+ fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
+ fmt.Fprintln(w, "LOCAL_VNDK_DEPEND_ON_CORE_VARIANT := true")
+ }
})
if library.shared() && !library.buildStubs() {
diff --git a/cc/cc.go b/cc/cc.go
index c036b84..c80d00c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -266,6 +266,7 @@
hasStubsVariants() bool
isStubs() bool
bootstrap() bool
+ mustUseVendorVariant() bool
}
type ModuleContext interface {
@@ -558,6 +559,10 @@
return false
}
+func (c *Module) mustUseVendorVariant() bool {
+ return c.isVndkSp() || inList(c.Name(), config.VndkMustUseVendorVariantList)
+}
+
func (c *Module) getVndkExtendsModuleName() string {
if vndkdep := c.vndkdep; vndkdep != nil {
return vndkdep.getVndkExtendsModuleName()
@@ -709,6 +714,10 @@
return ctx.mod.isVndkExt()
}
+func (ctx *moduleContextImpl) mustUseVendorVariant() bool {
+ return ctx.mod.mustUseVendorVariant()
+}
+
func (ctx *moduleContextImpl) inRecovery() bool {
return ctx.mod.inRecovery()
}
@@ -1769,7 +1778,12 @@
isLLndk := inList(libName, llndkLibraries)
isVendorPublicLib := inList(libName, vendorPublicLibraries)
bothVendorAndCoreVariantsExist := ccDep.hasVendorVariant() || isLLndk
- if c.useVndk() && bothVendorAndCoreVariantsExist {
+
+ if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.isVndk() && !ccDep.mustUseVendorVariant() {
+ // The vendor module is a no-vendor-variant VNDK library. Depend on the
+ // core module instead.
+ return libName
+ } else if c.useVndk() && bothVendorAndCoreVariantsExist {
// The vendor module in Make will have been renamed to not conflict with the core
// module, so update the dependency name here accordingly.
return libName + vendorSuffix
@@ -1908,6 +1922,8 @@
// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
//family, link := getNdkStlFamilyAndLinkType(c)
//return fmt.Sprintf("native:ndk:%s:%s", family, link)
+ } else if inList(c.Name(), vndkUsingCoreVariantLibraries) {
+ return "native:platform_vndk"
} else {
return "native:platform"
}
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
new file mode 100644
index 0000000..542f737
--- /dev/null
+++ b/cc/config/vndk.go
@@ -0,0 +1,157 @@
+// Copyright 2019 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package config
+
+// List of VNDK libraries that have different core variant and vendor variant.
+// For these libraries, the vendor variants must be installed even if the device
+// has VndkUseCoreVariant set.
+var VndkMustUseVendorVariantList = []string{
+ "android.frameworks.sensorservice@1.0",
+ "android.hardware.atrace@1.0",
+ "android.hardware.audio.common@5.0",
+ "android.hardware.audio.effect@2.0",
+ "android.hardware.audio.effect@4.0",
+ "android.hardware.audio.effect@5.0",
+ "android.hardware.audio@2.0",
+ "android.hardware.audio@4.0",
+ "android.hardware.audio@5.0",
+ "android.hardware.automotive.evs@1.0",
+ "android.hardware.automotive.vehicle@2.0",
+ "android.hardware.bluetooth.audio@2.0",
+ "android.hardware.boot@1.0",
+ "android.hardware.broadcastradio@1.0",
+ "android.hardware.broadcastradio@1.1",
+ "android.hardware.broadcastradio@2.0",
+ "android.hardware.camera.device@1.0",
+ "android.hardware.camera.device@3.2",
+ "android.hardware.camera.device@3.3",
+ "android.hardware.camera.device@3.4",
+ "android.hardware.camera.provider@2.4",
+ "android.hardware.cas.native@1.0",
+ "android.hardware.cas@1.0",
+ "android.hardware.configstore@1.0",
+ "android.hardware.configstore@1.1",
+ "android.hardware.contexthub@1.0",
+ "android.hardware.drm@1.0",
+ "android.hardware.drm@1.1",
+ "android.hardware.fastboot@1.0",
+ "android.hardware.gatekeeper@1.0",
+ "android.hardware.gnss@1.0",
+ "android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.bufferqueue@1.0",
+ "android.hardware.graphics.composer@2.1",
+ "android.hardware.graphics.composer@2.2",
+ "android.hardware.health@1.0",
+ "android.hardware.health@2.0",
+ "android.hardware.ir@1.0",
+ "android.hardware.keymaster@3.0",
+ "android.hardware.keymaster@4.0",
+ "android.hardware.light@2.0",
+ "android.hardware.media.bufferpool@1.0",
+ "android.hardware.media.omx@1.0",
+ "android.hardware.memtrack@1.0",
+ "android.hardware.neuralnetworks@1.0",
+ "android.hardware.neuralnetworks@1.1",
+ "android.hardware.neuralnetworks@1.2",
+ "android.hardware.nfc@1.1",
+ "android.hardware.nfc@1.2",
+ "android.hardware.oemlock@1.0",
+ "android.hardware.power.stats@1.0",
+ "android.hardware.power@1.0",
+ "android.hardware.power@1.1",
+ "android.hardware.radio@1.4",
+ "android.hardware.secure_element@1.0",
+ "android.hardware.sensors@1.0",
+ "android.hardware.soundtrigger@2.0",
+ "android.hardware.soundtrigger@2.0-core",
+ "android.hardware.soundtrigger@2.1",
+ "android.hardware.tetheroffload.config@1.0",
+ "android.hardware.tetheroffload.control@1.0",
+ "android.hardware.thermal@1.0",
+ "android.hardware.tv.cec@1.0",
+ "android.hardware.tv.input@1.0",
+ "android.hardware.vibrator@1.0",
+ "android.hardware.vibrator@1.1",
+ "android.hardware.vibrator@1.2",
+ "android.hardware.weaver@1.0",
+ "android.hardware.wifi.hostapd@1.0",
+ "android.hardware.wifi.offload@1.0",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardwareundtrigger@2.0",
+ "android.hardwareundtrigger@2.0-core",
+ "android.hardwareundtrigger@2.1",
+ "android.hidl.allocator@1.0",
+ "android.hidl.token@1.0",
+ "android.hidl.token@1.0-utils",
+ "android.system.net.netd@1.0",
+ "android.system.wifi.keystore@1.0",
+ "libaudioroute",
+ "libaudioutils",
+ "libbinder",
+ "libcamera_metadata",
+ "libcrypto",
+ "libdiskconfig",
+ "libdumpstateutil",
+ "libexpat",
+ "libfmq",
+ "libgui",
+ "libhidlcache",
+ "libmedia_helper",
+ "libmedia_omx",
+ "libmemtrack",
+ "libnetutils",
+ "libpuresoftkeymasterdevice",
+ "libradio_metadata",
+ "libselinux",
+ "libsoftkeymasterdevice",
+ "libsqlite",
+ "libssl",
+ "libstagefright_bufferqueue_helper",
+ "libstagefright_flacdec",
+ "libstagefright_foundation",
+ "libstagefright_omx",
+ "libstagefright_omx_utils",
+ "libstagefright_soft_aacdec",
+ "libstagefright_soft_aacenc",
+ "libstagefright_soft_amrdec",
+ "libstagefright_soft_amrnbenc",
+ "libstagefright_soft_amrwbenc",
+ "libstagefright_soft_avcdec",
+ "libstagefright_soft_avcenc",
+ "libstagefright_soft_flacdec",
+ "libstagefright_soft_flacenc",
+ "libstagefright_soft_g711dec",
+ "libstagefright_soft_gsmdec",
+ "libstagefright_soft_hevcdec",
+ "libstagefright_soft_mp3dec",
+ "libstagefright_soft_mpeg2dec",
+ "libstagefright_soft_mpeg4dec",
+ "libstagefright_soft_mpeg4enc",
+ "libstagefright_soft_opusdec",
+ "libstagefright_soft_rawdec",
+ "libstagefright_soft_vorbisdec",
+ "libstagefright_soft_vpxdec",
+ "libstagefright_soft_vpxenc",
+ "libstagefright_xmlparser",
+ "libsysutils",
+ "libui",
+ "libvorbisidec",
+ "libxml2",
+ "libziparchive",
+}
diff --git a/cc/library.go b/cc/library.go
index 7216832..e5bb347 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -293,6 +293,10 @@
post_install_cmds []string
+ // If useCoreVariant is true, the vendor variant of a VNDK library is
+ // not installed.
+ useCoreVariant bool
+
// Decorated interafaces
*baseCompiler
*baseLinker
@@ -914,6 +918,9 @@
if ctx.isVndkSp() {
library.baseInstaller.subDir = "vndk-sp"
} else if ctx.isVndk() {
+ if ctx.DeviceConfig().VndkUseCoreVariant() && !ctx.mustUseVendorVariant() {
+ library.useCoreVariant = true
+ }
library.baseInstaller.subDir = "vndk"
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 4a9ade2..aa6fdea 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -97,6 +97,7 @@
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(vndkSpLibraries, " "))
ctx.Strict("LLNDK_LIBRARIES", strings.Join(llndkLibraries, " "))
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(vndkPrivateLibraries, " "))
+ ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(vndkUsingCoreVariantLibraries, " "))
// Filter vendor_public_library that are exported to make
exportedVendorPublicLibraries := []string{}
diff --git a/cc/vndk.go b/cc/vndk.go
index 623097d..44a83e7 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -21,6 +21,7 @@
"sync"
"android/soong/android"
+ "android/soong/cc/config"
)
type VndkProperties struct {
@@ -191,11 +192,12 @@
}
var (
- vndkCoreLibraries []string
- vndkSpLibraries []string
- llndkLibraries []string
- vndkPrivateLibraries []string
- vndkLibrariesLock sync.Mutex
+ vndkCoreLibraries []string
+ vndkSpLibraries []string
+ llndkLibraries []string
+ vndkPrivateLibraries []string
+ vndkUsingCoreVariantLibraries []string
+ vndkLibrariesLock sync.Mutex
)
// gather list of vndk-core, vndk-sp, and ll-ndk libs
@@ -223,6 +225,12 @@
if m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
vndkLibrariesLock.Lock()
defer vndkLibrariesLock.Unlock()
+ if mctx.DeviceConfig().VndkUseCoreVariant() && !inList(name, config.VndkMustUseVendorVariantList) {
+ if !inList(name, vndkUsingCoreVariantLibraries) {
+ vndkUsingCoreVariantLibraries = append(vndkUsingCoreVariantLibraries, name)
+ sort.Strings(vndkUsingCoreVariantLibraries)
+ }
+ }
if m.vndkdep.isVndkSp() {
if !inList(name, vndkSpLibraries) {
vndkSpLibraries = append(vndkSpLibraries, name)