summaryrefslogtreecommitdiff
path: root/java/hiddenapi_modular.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2023-12-26 19:08:01 +0000
committer Jihoon Kang <jihoonkang@google.com> 2024-01-12 01:03:10 +0000
commitbd093457e2606e9525de0efa98e3c06eafe523af (patch)
tree0974977288681e5c72e9a285c1434890f9cc10aa /java/hiddenapi_modular.go
parent9272dccb1ea96dfbf0f8a0a1488a09ca9af11f15 (diff)
Enable hiddenapi check for exportable stubs
This change modifies the dependencies of the hiddenapi to always depend on the exportable stubs, instead of the currently utilized everything stubs. To support this, the full api surface exportable stubs are defined in a separate change at the `frameworks/base` project. Note that the full api surface exportable stubs are only used for the hiddenapi purpose, and `sdk_version` continues to utilize the currently existing everything stubs. Currently, this feature is hidden behind the build flag "RELEASE_HIDDEN_API_EXPORTABLE_STUBS". This feature will be fully enabled once metalava fully supports handling of the flagged apis. Test: ENABLE_HIDDENAPI_FLAGS=true m Bug: 317426356 Change-Id: I109b7cd27b20ceffcdf1766ab8106b0c276be2b3
Diffstat (limited to 'java/hiddenapi_modular.go')
-rw-r--r--java/hiddenapi_modular.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index a51286064..06e17c902 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -245,12 +245,22 @@ func hiddenAPIComputeMonolithicStubLibModules(config android.Config) map[*Hidden
testStubModules = append(testStubModules, "sdk_test_current_android")
} else {
// Use stub modules built from source
- publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName())
- systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName())
- testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName())
+ if config.ReleaseHiddenApiExportableStubs() {
+ publicStubModules = append(publicStubModules, android.SdkPublic.DefaultExportableJavaLibraryName())
+ systemStubModules = append(systemStubModules, android.SdkSystem.DefaultExportableJavaLibraryName())
+ testStubModules = append(testStubModules, android.SdkTest.DefaultExportableJavaLibraryName())
+ } else {
+ publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName())
+ systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName())
+ testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName())
+ }
}
// We do not have prebuilts of the core platform api yet
- corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
+ if config.ReleaseHiddenApiExportableStubs() {
+ corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs.exportable")
+ } else {
+ corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
+ }
// Allow products to define their own stubs for custom product jars that apps can use.
publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...)
@@ -289,7 +299,12 @@ func hiddenAPIAddStubLibDependencies(ctx android.BottomUpMutatorContext, apiScop
func hiddenAPIRetrieveDexJarBuildPath(ctx android.ModuleContext, module android.Module, kind android.SdkKind) android.Path {
var dexJar OptionalDexJarPath
if sdkLibrary, ok := module.(SdkLibraryDependency); ok {
- dexJar = sdkLibrary.SdkApiStubDexJar(ctx, kind)
+ if ctx.Config().ReleaseHiddenApiExportableStubs() {
+ dexJar = sdkLibrary.SdkApiExportableStubDexJar(ctx, kind)
+ } else {
+ dexJar = sdkLibrary.SdkApiStubDexJar(ctx, kind)
+ }
+
} else if j, ok := module.(UsesLibraryDependency); ok {
dexJar = j.DexJarBuildPath(ctx)
} else {