diff options
| -rw-r--r-- | apex/allowed_deps.txt | 5 | ||||
| -rw-r--r-- | apex/prebuilt.go | 59 | ||||
| -rw-r--r-- | cc/cc.go | 45 | ||||
| -rw-r--r-- | cc/cc_test.go | 117 | ||||
| -rw-r--r-- | cc/config/global.go | 4 | ||||
| -rw-r--r-- | cc/config/vndk.go | 6 | ||||
| -rw-r--r-- | cc/makevars.go | 10 | ||||
| -rw-r--r-- | cc/vndk.go | 279 | ||||
| -rw-r--r-- | java/hiddenapi_singleton.go | 4 | ||||
| -rw-r--r-- | rust/config/global.go | 2 | ||||
| -rwxr-xr-x | scripts/build-mainline-modules.sh | 1 |
11 files changed, 269 insertions, 263 deletions
diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt index 57b18de15..786496f4d 100644 --- a/apex/allowed_deps.txt +++ b/apex/allowed_deps.txt @@ -76,6 +76,7 @@ androidx.cursoradapter_cursoradapter(minSdkVersion:14) androidx.customview_customview(minSdkVersion:14) androidx.documentfile_documentfile(minSdkVersion:14) androidx.drawerlayout_drawerlayout(minSdkVersion:14) +androidx.dynamicanimation_dynamicanimation(minSdkVersion:14) androidx.fragment_fragment(minSdkVersion:14) androidx.fragment_fragment-ktx(minSdkVersion:14) androidx.interpolator_interpolator(minSdkVersion:14) @@ -129,6 +130,7 @@ bcm_object(minSdkVersion:29) bionic_libc_platform_headers(minSdkVersion:29) boringssl_self_test(minSdkVersion:29) bouncycastle_ike_digests(minSdkVersion:current) +bpf_syscall_wrappers(minSdkVersion:30) brotli-java(minSdkVersion:current) captiveportal-lib(minSdkVersion:29) car-ui-lib(minSdkVersion:28) @@ -486,6 +488,8 @@ neuralnetworks_utils_hal_1_2(minSdkVersion:30) neuralnetworks_utils_hal_1_3(minSdkVersion:30) neuralnetworks_utils_hal_common(minSdkVersion:30) neuralnetworks_utils_hal_service(minSdkVersion:30) +note_memtag_heap_async(minSdkVersion:16) +note_memtag_heap_sync(minSdkVersion:16) PermissionController(minSdkVersion:28) permissioncontroller-statsd(minSdkVersion:current) philox_random(minSdkVersion:(no version)) @@ -511,6 +515,7 @@ prebuilt_androidx.cursoradapter_cursoradapter-nodeps(minSdkVersion:(no version)) prebuilt_androidx.customview_customview-nodeps(minSdkVersion:(no version)) prebuilt_androidx.documentfile_documentfile-nodeps(minSdkVersion:(no version)) prebuilt_androidx.drawerlayout_drawerlayout-nodeps(minSdkVersion:(no version)) +prebuilt_androidx.dynamicanimation_dynamicanimation-nodeps(minSdkVersion:(no version)) prebuilt_androidx.fragment_fragment-ktx-nodeps(minSdkVersion:(no version)) prebuilt_androidx.fragment_fragment-nodeps(minSdkVersion:(no version)) prebuilt_androidx.interpolator_interpolator-nodeps(minSdkVersion:(no version)) diff --git a/apex/prebuilt.go b/apex/prebuilt.go index 7931e9e25..50e892e8b 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -107,7 +107,7 @@ type Prebuilt struct { compatSymlinks []string } -type PrebuiltProperties struct { +type ApexFileProperties struct { // the path to the prebuilt .apex file to import. Source string `blueprint:"mutated"` @@ -126,6 +126,38 @@ type PrebuiltProperties struct { Src *string } } +} + +func (p *ApexFileProperties) selectSource(ctx android.BottomUpMutatorContext) error { + // This is called before prebuilt_select and prebuilt_postdeps mutators + // The mutators requires that src to be set correctly for each arch so that + // arch variants are disabled when src is not provided for the arch. + if len(ctx.MultiTargets()) != 1 { + return fmt.Errorf("compile_multilib shouldn't be \"both\" for prebuilt_apex") + } + var src string + switch ctx.MultiTargets()[0].Arch.ArchType { + case android.Arm: + src = String(p.Arch.Arm.Src) + case android.Arm64: + src = String(p.Arch.Arm64.Src) + case android.X86: + src = String(p.Arch.X86.Src) + case android.X86_64: + src = String(p.Arch.X86_64.Src) + default: + return fmt.Errorf("prebuilt_apex does not support %q", ctx.MultiTargets()[0].Arch.String()) + } + if src == "" { + src = String(p.Src) + } + p.Source = src + + return nil +} + +type PrebuiltProperties struct { + ApexFileProperties Installable *bool // Optional name for the installed apex. If unspecified, name of the @@ -175,31 +207,10 @@ func PrebuiltFactory() android.Module { } func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) { - // This is called before prebuilt_select and prebuilt_postdeps mutators - // The mutators requires that src to be set correctly for each arch so that - // arch variants are disabled when src is not provided for the arch. - if len(ctx.MultiTargets()) != 1 { - ctx.ModuleErrorf("compile_multilib shouldn't be \"both\" for prebuilt_apex") - return - } - var src string - switch ctx.MultiTargets()[0].Arch.ArchType { - case android.Arm: - src = String(p.properties.Arch.Arm.Src) - case android.Arm64: - src = String(p.properties.Arch.Arm64.Src) - case android.X86: - src = String(p.properties.Arch.X86.Src) - case android.X86_64: - src = String(p.properties.Arch.X86_64.Src) - default: - ctx.ModuleErrorf("prebuilt_apex does not support %q", ctx.MultiTargets()[0].Arch.String()) + if err := p.properties.selectSource(ctx); err != nil { + ctx.ModuleErrorf("%s", err) return } - if src == "" { - src = String(p.properties.Src) - } - p.properties.Source = src } func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -408,9 +408,22 @@ type VendorProperties struct { // IsLLNDK is set to true for the vendor variant of a cc_library module that has LLNDK stubs. IsLLNDK bool `blueprint:"mutated"` - // IsLLNDKPrivate is set to true for the vendor variant of a cc_library module that has LLNDK - // stubs and also sets llndk.private: true. - IsLLNDKPrivate bool `blueprint:"mutated"` + // IsVNDKUsingCoreVariant is true for VNDK modules if the global VndkUseCoreVariant option is + // set and the module is not listed in VndkMustUseVendorVariantList. + IsVNDKUsingCoreVariant bool `blueprint:"mutated"` + + // IsVNDKCore is set if a VNDK module does not set the vndk.support_system_process property. + IsVNDKCore bool `blueprint:"mutated"` + + // IsVNDKSP is set if a VNDK module sets the vndk.support_system_process property. + IsVNDKSP bool `blueprint:"mutated"` + + // IsVNDKPrivate is set if a VNDK module sets the vndk.private property or an LLNDK + // module sets the llndk.private property. + IsVNDKPrivate bool `blueprint:"mutated"` + + // IsVNDKProduct is set if a VNDK module sets the product_available property. + IsVNDKProduct bool `blueprint:"mutated"` } // ModuleContextIntf is an interface (on a module context helper) consisting of functions related @@ -1070,7 +1083,7 @@ func (c *Module) IsLlndk() bool { // IsLlndkPublic returns true only for LLNDK (public) libs. func (c *Module) IsLlndkPublic() bool { - return c.VendorProperties.IsLLNDK && !c.VendorProperties.IsLLNDKPrivate + return c.VendorProperties.IsLLNDK && !c.VendorProperties.IsVNDKPrivate } // isImplementationForLLNDKPublic returns true for any variant of a cc_library that has LLNDK stubs @@ -2323,10 +2336,18 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) { return false } + // These dependencies are not excercised at runtime. Tracking these will give us + // false negative, so skip. depTag := ctx.OtherModuleDependencyTag(child) if IsHeaderDepTag(depTag) { return false } + if depTag == staticVariantTag { + return false + } + if depTag == stubImplDepTag { + return false + } // Even if target lib has no vendor variant, keep checking dependency // graph in case it depends on vendor_available or product_available @@ -2335,22 +2356,24 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) { return true } - if to.isVndkSp() || to.IsLlndk() || Bool(to.VendorProperties.Double_loadable) { - return false + // The happy path. Keep tracking dependencies until we hit a non double-loadable + // one. + if Bool(to.VendorProperties.Double_loadable) { + return true } - var stringPath []string - for _, m := range ctx.GetWalkPath() { - stringPath = append(stringPath, m.Name()) + if to.isVndkSp() || to.IsLlndk() { + return false } + ctx.ModuleErrorf("links a library %q which is not LL-NDK, "+ "VNDK-SP, or explicitly marked as 'double_loadable:true'. "+ - "(dependency: %s)", ctx.OtherModuleName(to), strings.Join(stringPath, " -> ")) + "Dependency list: %s", ctx.OtherModuleName(to), ctx.GetPathString(false)) return false } if module, ok := ctx.Module().(*Module); ok { if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() { - if lib.hasLLNDKStubs() || Bool(module.VendorProperties.Double_loadable) { + if lib.hasLLNDKStubs() { ctx.WalkDeps(check) } } diff --git a/cc/cc_test.go b/cc/cc_test.go index 3399e9367..f4228391d 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -316,16 +316,8 @@ func checkVndkOutput(t *testing.T, ctx *android.TestContext, output string, expe func checkVndkLibrariesOutput(t *testing.T, ctx *android.TestContext, module string, expected []string) { t.Helper() - vndkLibraries := ctx.ModuleForTests(module, "") - - var output string - if module != "vndkcorevariant.libraries.txt" { - output = insertVndkVersion(module, "VER") - } else { - output = module - } - - checkWriteFileOutput(t, vndkLibraries.Output(output), expected) + got := ctx.ModuleForTests(module, "").Module().(*vndkLibrariesTxt).fileNames + assertArrayString(t, got, expected) } func TestVndk(t *testing.T) { @@ -2030,85 +2022,50 @@ func TestDoubleLoadableDepError(t *testing.T) { } `) - // Check whether an error is emitted when a double_loadable lib depends on a non-double_loadable vendor_available lib. + // Check whether an error is emitted when a LLNDK depends on a non-double_loadable indirectly. testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", ` cc_library { - name: "libdoubleloadable", - vendor_available: true, - double_loadable: true, - shared_libs: ["libnondoubleloadable"], + name: "libllndk", + shared_libs: ["libcoreonly"], + llndk_stubs: "libllndk.llndk", } - cc_library { - name: "libnondoubleloadable", - vendor_available: true, + llndk_library { + name: "libllndk.llndk", + symbol_file: "", } - `) - // Check whether an error is emitted when a double_loadable lib depends on a non-double_loadable VNDK lib. - testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", ` cc_library { - name: "libdoubleloadable", - vendor_available: true, - double_loadable: true, - shared_libs: ["libnondoubleloadable"], + name: "libcoreonly", + shared_libs: ["libvendoravailable"], } + // indirect dependency of LLNDK cc_library { - name: "libnondoubleloadable", + name: "libvendoravailable", vendor_available: true, - product_available: true, - vndk: { - enabled: true, - }, } `) - // Check whether an error is emitted when a double_loadable VNDK depends on a non-double_loadable VNDK private lib. - testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", ` + // The error is not from 'client' but from 'libllndk' + testCcError(t, "module \"libllndk\".* links a library \"libnondoubleloadable\".*double_loadable", ` cc_library { - name: "libdoubleloadable", + name: "client", vendor_available: true, - product_available: true, - vndk: { - enabled: true, - }, double_loadable: true, - shared_libs: ["libnondoubleloadable"], - } - - cc_library { - name: "libnondoubleloadable", - vendor_available: true, - product_available: true, - vndk: { - enabled: true, - private: true, - }, + shared_libs: ["libllndk"], } - `) - - // Check whether an error is emitted when a LLNDK depends on a non-double_loadable indirectly. - testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", ` cc_library { name: "libllndk", - shared_libs: ["libcoreonly"], + shared_libs: ["libnondoubleloadable"], llndk_stubs: "libllndk.llndk", } - llndk_library { name: "libllndk.llndk", symbol_file: "", } - cc_library { - name: "libcoreonly", - shared_libs: ["libvendoravailable"], - } - - // indirect dependency of LLNDK - cc_library { - name: "libvendoravailable", + name: "libnondoubleloadable", vendor_available: true, } `) @@ -3171,7 +3128,25 @@ func TestMakeLinkType(t *testing.T) { name: "libllndkprivate.llndk", private: true, symbol_file: "", - }` + } + + llndk_libraries_txt { + name: "llndk.libraries.txt", + } + vndkcore_libraries_txt { + name: "vndkcore.libraries.txt", + } + vndksp_libraries_txt { + name: "vndksp.libraries.txt", + } + vndkprivate_libraries_txt { + name: "vndkprivate.libraries.txt", + } + vndkcorevariant_libraries_txt { + name: "vndkcorevariant.libraries.txt", + insert_vndk_version: false, + } + ` config := TestConfig(buildDir, android.Android, nil, bp, nil) config.TestProductVariables.DeviceVndkVersion = StringPtr("current") @@ -3179,14 +3154,14 @@ func TestMakeLinkType(t *testing.T) { // native:vndk ctx := testCcWithConfig(t, config) - assertMapKeys(t, vndkCoreLibraries(config), - []string{"libvndk", "libvndkprivate"}) - assertMapKeys(t, vndkSpLibraries(config), - []string{"libc++", "libvndksp"}) - assertMapKeys(t, llndkLibraries(config), - []string{"libc", "libdl", "libft2", "libllndk", "libllndkprivate", "libm"}) - assertMapKeys(t, vndkPrivateLibraries(config), - []string{"libft2", "libllndkprivate", "libvndkprivate"}) + checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", + []string{"libvndk.so", "libvndkprivate.so"}) + checkVndkLibrariesOutput(t, ctx, "vndksp.libraries.txt", + []string{"libc++.so", "libvndksp.so"}) + checkVndkLibrariesOutput(t, ctx, "llndk.libraries.txt", + []string{"libc.so", "libdl.so", "libft2.so", "libllndk.so", "libllndkprivate.so", "libm.so"}) + checkVndkLibrariesOutput(t, ctx, "vndkprivate.libraries.txt", + []string{"libft2.so", "libllndkprivate.so", "libvndkprivate.so"}) vendorVariant27 := "android_vendor.27_arm64_armv8-a_shared" diff --git a/cc/config/global.go b/cc/config/global.go index fa8e0fba2..d47e0ce5a 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -215,10 +215,6 @@ func init() { "frameworks/native/opengl/include", "frameworks/av/include", }) - // This is used by non-NDK modules to get jni.h. export_include_dirs doesn't help - // with this, since there is no associated library. - pctx.PrefixedExistentPathsForSourcesVariable("CommonNativehelperInclude", "-I", - []string{"libnativehelper/include_jni"}) pctx.SourcePathVariable("ClangDefaultBase", ClangDefaultBase) pctx.VariableFunc("ClangBase", func(ctx android.PackageVarContext) string { diff --git a/cc/config/vndk.go b/cc/config/vndk.go index 0aa68666f..286bb53db 100644 --- a/cc/config/vndk.go +++ b/cc/config/vndk.go @@ -20,6 +20,8 @@ package config var VndkMustUseVendorVariantList = []string{ "android.hardware.authsecret-unstable-ndk_platform", "android.hardware.automotive.occupant_awareness-ndk_platform", + "android.hardware.health.storage-ndk_platform", + "android.hardware.health.storage-unstable-ndk_platform", "android.hardware.light-ndk_platform", "android.hardware.identity-ndk_platform", "android.hardware.nfc@1.2", @@ -28,6 +30,10 @@ var VndkMustUseVendorVariantList = []string{ "android.hardware.power-ndk_platform", "android.hardware.rebootescrow-ndk_platform", "android.hardware.security.keymint-unstable-ndk_platform", + "android.hardware.security.secureclock-ndk_platform", + "android.hardware.security.secureclock-unstable-ndk_platform", + "android.hardware.security.sharedsecret-ndk_platform", + "android.hardware.security.sharedsecret-unstable-ndk_platform", "android.hardware.vibrator-ndk_platform", "android.system.keystore2-unstable-ndk_platform", "libbinder", diff --git a/cc/makevars.go b/cc/makevars.go index 8301c6b38..48d563606 100644 --- a/cc/makevars.go +++ b/cc/makevars.go @@ -154,16 +154,6 @@ func makeVarsProvider(ctx android.MakeVarsContext) { ctx.Strict("SOONG_STRIP_PATH", "${stripPath}") ctx.Strict("XZ", "${xzCmd}") - nativeHelperIncludeFlags, err := ctx.Eval("${config.CommonNativehelperInclude}") - if err != nil { - panic(err) - } - nativeHelperIncludes, nativeHelperSystemIncludes := splitSystemIncludes(ctx, nativeHelperIncludeFlags) - if len(nativeHelperSystemIncludes) > 0 { - panic("native helper may not have any system includes") - } - ctx.Strict("JNI_H_INCLUDE", strings.Join(nativeHelperIncludes, " ")) - includeFlags, err := ctx.Eval("${config.CommonGlobalIncludes}") if err != nil { panic(err) diff --git a/cc/vndk.go b/cc/vndk.go index daae1f7bd..ff38db5e8 100644 --- a/cc/vndk.go +++ b/cc/vndk.go @@ -21,7 +21,6 @@ import ( "path/filepath" "sort" "strings" - "sync" "android/soong/android" "android/soong/cc/config" @@ -231,52 +230,59 @@ func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error { return nil } +type moduleListerFunc func(ctx android.SingletonContext) (moduleNames, fileNames []string) + var ( - vndkCoreLibrariesKey = android.NewOnceKey("vndkCoreLibraries") - vndkSpLibrariesKey = android.NewOnceKey("vndkSpLibraries") - llndkLibrariesKey = android.NewOnceKey("llndkLibraries") - vndkPrivateLibrariesKey = android.NewOnceKey("vndkPrivateLibraries") - vndkProductLibrariesKey = android.NewOnceKey("vndkProductLibraries") - vndkUsingCoreVariantLibrariesKey = android.NewOnceKey("vndkUsingCoreVariantLibraries") - vndkMustUseVendorVariantListKey = android.NewOnceKey("vndkMustUseVendorVariantListKey") - vndkLibrariesLock sync.Mutex + llndkLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsLLNDK && !isVestigialLLNDKModule(m) }) + llndkLibrariesWithoutHWASAN = vndkModuleListRemover(llndkLibraries, "libclang_rt.hwasan-") + vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP }) + vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore }) + vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate && !isVestigialLLNDKModule(m) }) + vndkProductLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKProduct }) + vndkUsingCoreVariantLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKUsingCoreVariant }) ) -func vndkCoreLibraries(config android.Config) map[string]string { - return config.Once(vndkCoreLibrariesKey, func() interface{} { - return make(map[string]string) - }).(map[string]string) -} - -func vndkSpLibraries(config android.Config) map[string]string { - return config.Once(vndkSpLibrariesKey, func() interface{} { - return make(map[string]string) - }).(map[string]string) -} - -func llndkLibraries(config android.Config) map[string]string { - return config.Once(llndkLibrariesKey, func() interface{} { - return make(map[string]string) - }).(map[string]string) -} - -func vndkPrivateLibraries(config android.Config) map[string]string { - return config.Once(vndkPrivateLibrariesKey, func() interface{} { - return make(map[string]string) - }).(map[string]string) +// vndkModuleLister takes a predicate that operates on a Module and returns a moduleListerFunc +// that produces a list of module names and output file names for which the predicate returns true. +func vndkModuleLister(predicate func(*Module) bool) moduleListerFunc { + return func(ctx android.SingletonContext) (moduleNames, fileNames []string) { + ctx.VisitAllModules(func(m android.Module) { + if c, ok := m.(*Module); ok && predicate(c) { + filename, err := getVndkFileName(c) + if err != nil { + ctx.ModuleErrorf(m, "%s", err) + } + moduleNames = append(moduleNames, ctx.ModuleName(m)) + fileNames = append(fileNames, filename) + } + }) + moduleNames = android.SortedUniqueStrings(moduleNames) + fileNames = android.SortedUniqueStrings(fileNames) + return + } } -func vndkProductLibraries(config android.Config) map[string]string { - return config.Once(vndkProductLibrariesKey, func() interface{} { - return make(map[string]string) - }).(map[string]string) +// vndkModuleListRemover takes a moduleListerFunc and a prefix and returns a moduleListerFunc +// that returns the same lists as the input moduleListerFunc, but with modules with the +// given prefix removed. +func vndkModuleListRemover(lister moduleListerFunc, prefix string) moduleListerFunc { + return func(ctx android.SingletonContext) (moduleNames, fileNames []string) { + moduleNames, fileNames = lister(ctx) + filter := func(in []string) []string { + out := make([]string, 0, len(in)) + for _, lib := range in { + if strings.HasPrefix(lib, prefix) { + continue + } + out = append(out, lib) + } + return out + } + return filter(moduleNames), filter(fileNames) + } } -func vndkUsingCoreVariantLibraries(config android.Config) map[string]string { - return config.Once(vndkUsingCoreVariantLibrariesKey, func() interface{} { - return make(map[string]string) - }).(map[string]string) -} +var vndkMustUseVendorVariantListKey = android.NewOnceKey("vndkMustUseVendorVariantListKey") func vndkMustUseVendorVariantList(cfg android.Config) []string { return cfg.Once(vndkMustUseVendorVariantListKey, func() interface{} { @@ -294,17 +300,10 @@ func setVndkMustUseVendorVariantListForTest(config android.Config, mustUseVendor func processLlndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { lib := m.linker.(*llndkStubDecorator) - name := m.ImplementationModuleName(mctx) - filename := name + ".so" - - vndkLibrariesLock.Lock() - defer vndkLibrariesLock.Unlock() - llndkLibraries(mctx.Config())[name] = filename m.VendorProperties.IsLLNDK = true if Bool(lib.Properties.Private) { - vndkPrivateLibraries(mctx.Config())[name] = filename - m.VendorProperties.IsLLNDKPrivate = true + m.VendorProperties.IsVNDKPrivate = true } } @@ -316,10 +315,6 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { } name := m.BaseModuleName() - filename, err := getVndkFileName(m) - if err != nil { - panic(err) - } if lib := m.library; lib != nil && lib.hasStubsVariants() && name != "libz" { // b/155456180 libz is the ONLY exception here. We don't want to make @@ -331,26 +326,23 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { mctx.PropertyErrorf("vndk.enabled", "This library provides stubs. Shouldn't be VNDK. Consider making it as LLNDK") } - vndkLibrariesLock.Lock() - defer vndkLibrariesLock.Unlock() - if inList(name, vndkMustUseVendorVariantList(mctx.Config())) { m.Properties.MustUseVendorVariant = true } if mctx.DeviceConfig().VndkUseCoreVariant() && !m.Properties.MustUseVendorVariant { - vndkUsingCoreVariantLibraries(mctx.Config())[name] = filename + m.VendorProperties.IsVNDKUsingCoreVariant = true } if m.vndkdep.isVndkSp() { - vndkSpLibraries(mctx.Config())[name] = filename + m.VendorProperties.IsVNDKSP = true } else { - vndkCoreLibraries(mctx.Config())[name] = filename + m.VendorProperties.IsVNDKCore = true } if m.IsVndkPrivate() { - vndkPrivateLibraries(mctx.Config())[name] = filename + m.VendorProperties.IsVNDKPrivate = true } if Bool(m.VendorProperties.Product_available) { - vndkProductLibraries(mctx.Config())[name] = filename + m.VendorProperties.IsVNDKProduct = true } } @@ -424,7 +416,7 @@ func VndkMutator(mctx android.BottomUpMutatorContext) { flagExporter.Properties = llndkLib.(*llndkStubDecorator).flagExporter.Properties m.VendorProperties.IsLLNDK = llndk.VendorProperties.IsLLNDK - m.VendorProperties.IsLLNDKPrivate = llndk.VendorProperties.IsLLNDKPrivate + m.VendorProperties.IsVNDKPrivate = llndk.VendorProperties.IsVNDKPrivate } } @@ -454,21 +446,29 @@ func init() { } func RegisterVndkLibraryTxtTypes(ctx android.RegistrationContext) { - ctx.RegisterModuleType("llndk_libraries_txt", VndkLibrariesTxtFactory(libclangRTRemover(llndkLibraries))) - ctx.RegisterModuleType("vndksp_libraries_txt", VndkLibrariesTxtFactory(vndkSpLibraries)) - ctx.RegisterModuleType("vndkcore_libraries_txt", VndkLibrariesTxtFactory(vndkCoreLibraries)) - ctx.RegisterModuleType("vndkprivate_libraries_txt", VndkLibrariesTxtFactory(vndkPrivateLibraries)) - ctx.RegisterModuleType("vndkproduct_libraries_txt", VndkLibrariesTxtFactory(vndkProductLibraries)) - ctx.RegisterModuleType("vndkcorevariant_libraries_txt", VndkLibrariesTxtFactory(vndkUsingCoreVariantLibraries)) + // Make uses LLNDK_LIBRARIES to determine which libraries to install. + // HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN. + // Therefore, by removing the library here, we cause it to only be installed if libc + // depends on it. + ctx.RegisterSingletonModuleType("llndk_libraries_txt", llndkLibrariesTxtFactory) + ctx.RegisterSingletonModuleType("vndksp_libraries_txt", vndkSPLibrariesTxtFactory) + ctx.RegisterSingletonModuleType("vndkcore_libraries_txt", vndkCoreLibrariesTxtFactory) + ctx.RegisterSingletonModuleType("vndkprivate_libraries_txt", vndkPrivateLibrariesTxtFactory) + ctx.RegisterSingletonModuleType("vndkproduct_libraries_txt", vndkProductLibrariesTxtFactory) + ctx.RegisterSingletonModuleType("vndkcorevariant_libraries_txt", vndkUsingCoreVariantLibrariesTxtFactory) } type vndkLibrariesTxt struct { - android.ModuleBase + android.SingletonModuleBase + + lister moduleListerFunc + makeVarName string - lister func(android.Config) map[string]string properties VndkLibrariesTxtProperties - outputFile android.OutputPath + outputFile android.OutputPath + moduleNames []string + fileNames []string } type VndkLibrariesTxtProperties struct { @@ -478,25 +478,56 @@ type VndkLibrariesTxtProperties struct { var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{} var _ android.OutputFileProducer = &vndkLibrariesTxt{} -// vndk_libraries_txt is a special kind of module type in that it name is one of -// - llndk.libraries.txt -// - vndkcore.libraries.txt -// - vndksp.libraries.txt -// - vndkprivate.libraries.txt -// - vndkproduct.libraries.txt -// - vndkcorevariant.libraries.txt -// A module behaves like a prebuilt_etc but its content is generated by soong. -// By being a soong module, these files can be referenced by other soong modules. +// llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries +// generated by Soong but can be referenced by other modules. // For example, apex_vndk can depend on these files as prebuilt. -func VndkLibrariesTxtFactory(lister func(android.Config) map[string]string) android.ModuleFactory { - return func() android.Module { - m := &vndkLibrariesTxt{ - lister: lister, - } - m.AddProperties(&m.properties) - android.InitAndroidModule(m) - return m +func llndkLibrariesTxtFactory() android.SingletonModule { + return newVndkLibrariesTxt(llndkLibrariesWithoutHWASAN, "LLNDK_LIBRARIES") +} + +// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries +// generated by Soong but can be referenced by other modules. +// For example, apex_vndk can depend on these files as prebuilt. +func vndkSPLibrariesTxtFactory() android.SingletonModule { + return newVndkLibrariesTxt(vndkSPLibraries, "VNDK_SAMEPROCESS_LIBRARIES") +} + +// vndkcore_libraries_txt is a singleton module whose content is a list of VNDK core libraries +// generated by Soong but can be referenced by other modules. +// For example, apex_vndk can depend on these files as prebuilt. +func vndkCoreLibrariesTxtFactory() android.SingletonModule { + return newVndkLibrariesTxt(vndkCoreLibraries, "VNDK_CORE_LIBRARIES") +} + +// vndkprivate_libraries_txt is a singleton module whose content is a list of VNDK private libraries +// generated by Soong but can be referenced by other modules. +// For example, apex_vndk can depend on these files as prebuilt. +func vndkPrivateLibrariesTxtFactory() android.SingletonModule { + return newVndkLibrariesTxt(vndkPrivateLibraries, "VNDK_PRIVATE_LIBRARIES") +} + +// vndkproduct_libraries_txt is a singleton module whose content is a list of VNDK product libraries +// generated by Soong but can be referenced by other modules. +// For example, apex_vndk can depend on these files as prebuilt. +func vndkProductLibrariesTxtFactory() android.SingletonModule { + return newVndkLibrariesTxt(vndkProductLibraries, "VNDK_PRODUCT_LIBRARIES") +} + +// vndkcorevariant_libraries_txt is a singleton module whose content is a list of VNDK libraries +// that are using the core variant, generated by Soong but can be referenced by other modules. +// For example, apex_vndk can depend on these files as prebuilt. +func vndkUsingCoreVariantLibrariesTxtFactory() android.SingletonModule { + return newVndkLibrariesTxt(vndkUsingCoreVariantLibraries, "VNDK_USING_CORE_VARIANT_LIBRARIES") +} + +func newVndkLibrariesTxt(lister moduleListerFunc, makeVarName string) android.SingletonModule { + m := &vndkLibrariesTxt{ + lister: lister, + makeVarName: makeVarName, } + m.AddProperties(&m.properties) + android.InitAndroidModule(m) + return m } func insertVndkVersion(filename string, vndkVersion string) string { @@ -506,23 +537,7 @@ func insertVndkVersion(filename string, vndkVersion string) string { return filename } -func libclangRTRemover(lister func(android.Config) map[string]string) func(android.Config) map[string]string { - return func(config android.Config) map[string]string { - libs := lister(config) - filteredLibs := make(map[string]string, len(libs)) - for lib, v := range libs { - if strings.HasPrefix(lib, "libclang_rt.hwasan-") { - continue - } - filteredLibs[lib] = v - } - return filteredLibs - } -} - func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) { - list := android.SortedStringMapValues(txt.lister(ctx.Config())) - var filename string if BoolDefault(txt.properties.Insert_vndk_version, true) { filename = insertVndkVersion(txt.Name(), ctx.DeviceConfig().PlatformVndkVersion()) @@ -531,12 +546,16 @@ func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleConte } txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath - android.WriteFileRule(ctx, txt.outputFile, strings.Join(list, "\n")) installPath := android.PathForModuleInstall(ctx, "etc") ctx.InstallFile(installPath, filename, txt.outputFile) } +func (txt *vndkLibrariesTxt) GenerateSingletonBuildActions(ctx android.SingletonContext) { + txt.moduleNames, txt.fileNames = txt.lister(ctx) + android.WriteFileRule(ctx, txt.outputFile, strings.Join(txt.fileNames, "\n")) +} + func (txt *vndkLibrariesTxt) AndroidMkEntries() []android.AndroidMkEntries { return []android.AndroidMkEntries{android.AndroidMkEntries{ Class: "ETC", @@ -549,6 +568,11 @@ func (txt *vndkLibrariesTxt) AndroidMkEntries() []android.AndroidMkEntries { }} } +func (txt *vndkLibrariesTxt) MakeVars(ctx android.MakeVarsContext) { + ctx.Strict(txt.makeVarName, strings.Join(txt.moduleNames, " ")) + +} + // PrebuiltEtcModule interface func (txt *vndkLibrariesTxt) OutputFile() android.OutputPath { return txt.outputFile @@ -829,33 +853,27 @@ func getVndkFileName(m *Module) (string, error) { if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok { return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil } + if library, ok := m.linker.(*llndkStubDecorator); ok { + return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil + } return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker) } func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.SingletonContext) { - llndk := android.SortedStringMapValues(llndkLibraries(ctx.Config())) - vndkcore := android.SortedStringMapValues(vndkCoreLibraries(ctx.Config())) - vndksp := android.SortedStringMapValues(vndkSpLibraries(ctx.Config())) - vndkprivate := android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config())) - vndkproduct := android.SortedStringMapValues(vndkProductLibraries(ctx.Config())) - // Build list of vndk libs as merged & tagged & filter-out(libclang_rt): // Since each target have different set of libclang_rt.* files, // keep the common set of files in vndk.libraries.txt + _, llndk := vndkModuleListRemover(llndkLibraries, "libclang_rt.")(ctx) + _, vndkcore := vndkModuleListRemover(vndkCoreLibraries, "libclang_rt.")(ctx) + _, vndksp := vndkSPLibraries(ctx) + _, vndkprivate := vndkPrivateLibraries(ctx) + _, vndkproduct := vndkModuleListRemover(vndkProductLibraries, "libclang_rt.")(ctx) var merged []string - filterOutLibClangRt := func(libList []string) (filtered []string) { - for _, lib := range libList { - if !strings.HasPrefix(lib, "libclang_rt.") { - filtered = append(filtered, lib) - } - } - return - } - merged = append(merged, addPrefix(filterOutLibClangRt(llndk), "LLNDK: ")...) + merged = append(merged, addPrefix(llndk, "LLNDK: ")...) merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...) - merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...) + merged = append(merged, addPrefix(vndkcore, "VNDK-core: ")...) merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...) - merged = append(merged, addPrefix(filterOutLibClangRt(vndkproduct), "VNDK-product: ")...) + merged = append(merged, addPrefix(vndkproduct, "VNDK-product: ")...) c.vndkLibrariesFile = android.PathForOutput(ctx, "vndk", "vndk.libraries.txt") android.WriteFileRule(ctx, c.vndkLibrariesFile, strings.Join(merged, "\n")) } @@ -877,25 +895,6 @@ func (c *vndkSnapshotSingleton) MakeVars(ctx android.MakeVarsContext) { ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES", strings.Join(android.SortedStringKeys(movedToApexLlndkLibraries), " ")) - // Make uses LLNDK_LIBRARIES to determine which libraries to install. - // HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN. - // Therefore, by removing the library here, we cause it to only be installed if libc - // depends on it. - installedLlndkLibraries := []string{} - for lib := range llndkLibraries(ctx.Config()) { - if strings.HasPrefix(lib, "libclang_rt.hwasan-") { - continue - } - installedLlndkLibraries = append(installedLlndkLibraries, lib) - } - sort.Strings(installedLlndkLibraries) - ctx.Strict("LLNDK_LIBRARIES", strings.Join(installedLlndkLibraries, " ")) - - ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkCoreLibraries(ctx.Config())), " ")) - ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(android.SortedStringKeys(vndkSpLibraries(ctx.Config())), " ")) - ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkPrivateLibraries(ctx.Config())), " ")) - ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(android.SortedStringKeys(vndkUsingCoreVariantLibraries(ctx.Config())), " ")) - ctx.Strict("VNDK_LIBRARIES_FILE", c.vndkLibrariesFile.String()) ctx.Strict("SOONG_VNDK_SNAPSHOT_ZIP", c.vndkSnapshotZipFile.String()) } diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go index 419dc3424..d3025247b 100644 --- a/java/hiddenapi_singleton.go +++ b/java/hiddenapi_singleton.go @@ -251,6 +251,8 @@ func flagsRule(ctx android.SingletonContext) android.Path { FlagWithInput("--unsupported ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-unsupported.txt")). FlagWithInput("--unsupported ", combinedRemovedApis).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "removed"). + FlagWithInput("--max-target-r ", + android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-r-loprio.txt")).FlagWithArg("--tag ", "lo-prio"). FlagWithInput("--max-target-q ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-q.txt")). FlagWithInput("--max-target-p ", @@ -259,8 +261,6 @@ func flagsRule(ctx android.SingletonContext) android.Path { ctx, "frameworks/base/config/hiddenapi-max-target-o.txt")).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "lo-prio"). FlagWithInput("--blocked ", android.PathForSource(ctx, "frameworks/base/config/hiddenapi-force-blocked.txt")). - FlagWithInput("--blocked ", - android.PathForSource(ctx, "frameworks/base/config/hiddenapi-temp-blocklist.txt")).FlagWithArg("--tag ", "lo-prio"). FlagWithInput("--unsupported ", android.PathForSource( ctx, "frameworks/base/config/hiddenapi-unsupported-packages.txt")).Flag("--packages "). FlagWithOutput("--output ", tempPath) diff --git a/rust/config/global.go b/rust/config/global.go index b7fff4a32..08ec87777 100644 --- a/rust/config/global.go +++ b/rust/config/global.go @@ -24,7 +24,7 @@ import ( var pctx = android.NewPackageContext("android/soong/rust/config") var ( - RustDefaultVersion = "1.48.0" + RustDefaultVersion = "1.49.0" RustDefaultBase = "prebuilts/rust/" DefaultEdition = "2018" Stdlibs = []string{ diff --git a/scripts/build-mainline-modules.sh b/scripts/build-mainline-modules.sh index 6db870f5a..ea62af4a2 100755 --- a/scripts/build-mainline-modules.sh +++ b/scripts/build-mainline-modules.sh @@ -26,6 +26,7 @@ MODULES_SDK_AND_EXPORTS=( platform-mainline-test-exports runtime-module-host-exports runtime-module-sdk + tzdata-module-test-exports ) # List of libraries installed on the platform that are needed for ART chroot |