From 80456fdec4abae6690c633b502e4e518aaec029d Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Wed, 15 Nov 2023 19:22:14 +0000 Subject: [PATCH] Add contribute_to_android_api property in java_sdk_library The default-false bool property `contribute_to_android_api` will be used to signify whether the java_sdk_library module contributes to an api surface (i.e. listed in frameworks-base-api.bootclasspath or not). If the property is set to true, the module's stub jar can be generated from .txt files. Currently, the property is a no-op. The property will be utilized in the child changes. Test: m nothing Bug: 276958307 Change-Id: I617802ec352c7055579ce92ea3de43f10cac1da4 --- java/sdk_library.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/java/sdk_library.go b/java/sdk_library.go index ea451743b..fb2781213 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -624,6 +624,13 @@ type sdkLibraryProperties struct { Legacy_errors_allowed *bool } + // Determines if the module contributes to any api surfaces. + // This property should be set to true only if the module is listed under + // frameworks-base-api.bootclasspath in frameworks/base/api/Android.bp. + // Otherwise, this property should be set to false. + // Defaults to false. + Contribute_to_android_api *bool + // TODO: determines whether to create HTML doc or not // Html_doc *bool } @@ -1966,6 +1973,10 @@ func (module *SdkLibrary) UniqueApexVariations() bool { return module.uniqueApexVariations() } +func (module *SdkLibrary) ContributeToApi() bool { + return proptools.BoolDefault(module.sdkLibraryProperties.Contribute_to_android_api, false) +} + // Creates the xml file that publicizes the runtime library func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) { moduleMinApiLevel := module.Library.MinSdkVersion(mctx)