From e16abc61f4f1b6a9a54f516c39bec3834db5814c Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Thu, 6 Mar 2025 16:24:22 +0900 Subject: llndk stub of libbinder_ndk reads systemapi annotation LLNDK libraries provide stable APIs to both product and vendor partitions. But we have an exception for libbinder_ndk because of the Treble boundary. libbinder_ndk provides different APIs between product and vendor partitions, because one is in the framework side, and the other is in the vendor side of the Treble boundary. libbinder_ndk used systemapi annotation for the product APIs instead of llndk annotation. Read the APIs with systemapi annotation to generate the product variant of the libbinder_ndk llndk stub library. Bug: 395576642 Test: m libbinder_ndk.product Change-Id: I66a5b023f0c482b4bbf1da281a88073d1ed4620f --- cc/library.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cc') diff --git a/cc/library.go b/cc/library.go index 8a2b6bdbd..b248224bd 100644 --- a/cc/library.go +++ b/cc/library.go @@ -606,10 +606,22 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa panic(err) } + llndkFlag := "--llndk" + if ctx.baseModuleName() == "libbinder_ndk" && ctx.inProduct() { + // This is a special case only for the libbinder_ndk. As the product partition is in the + // framework side along with system and system_ext partitions in Treble, libbinder_ndk + // provides different binder interfaces between product and vendor modules. + // In libbinder_ndk, 'llndk' annotation is for the vendor APIs; while 'systemapi' + // annotation is for the product APIs. + // Use '--systemapi' flag for building the llndk stub of product variant for the + // libbinder_ndk. + llndkFlag = "--systemapi" + } + // This is the vendor variant of an LLNDK library, build the LLNDK stubs. nativeAbiResult := ParseNativeAbiDefinition(ctx, String(library.Properties.Llndk.Symbol_file), - nativeClampedApiLevel(ctx, version), "--llndk") + nativeClampedApiLevel(ctx, version), llndkFlag) objs := CompileStubLibrary(ctx, flags, nativeAbiResult.StubSrc, sharedFlags) if !Bool(library.Properties.Llndk.Unversioned) { library.versionScriptPath = android.OptionalPathForPath( -- cgit v1.2.3-59-g8ed1b