diff options
author | 2024-06-18 18:49:48 +0100 | |
---|---|---|
committer | 2024-06-20 15:28:43 +0100 | |
commit | a2c4cd7cbf6ff893c5cf9d2dba97351b17469431 (patch) | |
tree | b26dad6dcb3acaebce35249342500876e14cafff | |
parent | bbaf5cbe395bcf9e2d517daf3cfaa822efd28fd3 (diff) |
Update previous_api for droidstubs and java_api_library
Needed to ensure recently added nullability annotations `@Nullable` and
`@NonNull` are correctly replaced with `@RecentlyNullable` and
`@RecentlyNonNull` respectively.
Bug: 347751326
Test: # Build modules before and after this change and verify that
# public stubs are unchanged but other stubs use the correct
# nullability annotations.
Change-Id: If97859b6207f03c1dcd3a0cc9c44f82147449cad
-rw-r--r-- | api/Android.bp | 1 | ||||
-rw-r--r-- | api/StubLibraries.bp | 28 | ||||
-rw-r--r-- | api/api.go | 2 |
3 files changed, 28 insertions, 3 deletions
diff --git a/api/Android.bp b/api/Android.bp index fd2a6d29c377..cd21d8a3ac42 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -370,7 +370,6 @@ stubs_defaults { high_mem: true, // Lots of sources => high memory use, see b/170701554 installable: false, annotations_enabled: true, - previous_api: ":android.api.public.latest", merge_annotations_dirs: ["metalava-manual"], defaults_visibility: ["//frameworks/base/api"], visibility: [ diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp index 5b7e25bbbb4c..12820f9ff277 100644 --- a/api/StubLibraries.bp +++ b/api/StubLibraries.bp @@ -38,6 +38,9 @@ non_updatable_exportable_droidstubs { "android-non-updatable-stubs-defaults", "module-classpath-stubs-defaults", ], + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.public.latest", check_api: { current: { api_file: ":non-updatable-current.txt", @@ -118,6 +121,9 @@ non_updatable_exportable_droidstubs { "module-classpath-stubs-defaults", ], flags: priv_apps, + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.system.latest", check_api: { current: { api_file: ":non-updatable-system-current.txt", @@ -178,6 +184,9 @@ non_updatable_exportable_droidstubs { "module-classpath-stubs-defaults", ], flags: test + priv_apps_in_stubs, + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.test.latest", check_api: { current: { api_file: ":non-updatable-test-current.txt", @@ -257,6 +266,9 @@ non_updatable_exportable_droidstubs { "module-classpath-stubs-defaults", ], flags: priv_apps_in_stubs + module_libs, + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.module-lib.latest", check_api: { current: { api_file: ":non-updatable-module-lib-current.txt", @@ -571,6 +583,9 @@ java_api_library { ], defaults: ["android-non-updatable_everything_from_text_defaults"], full_api_surface_stub: "android_stubs_current.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.public.latest", } java_api_library { @@ -582,6 +597,9 @@ java_api_library { ], defaults: ["android-non-updatable_everything_from_text_defaults"], full_api_surface_stub: "android_system_stubs_current.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.system.latest", } java_api_library { @@ -594,6 +612,9 @@ java_api_library { ], defaults: ["android-non-updatable_everything_from_text_defaults"], full_api_surface_stub: "android_test_stubs_current.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.test.latest", } java_api_library { @@ -606,6 +627,9 @@ java_api_library { ], defaults: ["android-non-updatable_everything_from_text_defaults"], full_api_surface_stub: "android_module_lib_stubs_current_full.from-text", + // Use full Android API not just the non-updatable API as the latter is incomplete + // and can result in incorrect behavior. + previous_api: ":android.api.combined.module-lib.latest", } // This module generates a stub jar that is a union of the test and module lib @@ -623,6 +647,8 @@ java_api_library { defaults: ["android-non-updatable_everything_from_text_defaults"], full_api_surface_stub: "android_test_module_lib_stubs_current.from-text", + // No need to specify previous_api as this is not used for compiling against. + // This module is only used for hiddenapi, and other modules should not // depend on this module. visibility: ["//visibility:private"], @@ -922,7 +948,7 @@ java_defaults { "i18n.module.public.api.stubs.source.system.api.contribution", "i18n.module.public.api.stubs.source.module_lib.api.contribution", ], - previous_api: ":android.api.public.latest", + previous_api: ":android.api.combined.module-lib.latest", } // Java API library definitions per API surface diff --git a/api/api.go b/api/api.go index 449fac63f90c..d4db49e90a01 100644 --- a/api/api.go +++ b/api/api.go @@ -478,7 +478,7 @@ func createApiContributionDefaults(ctx android.LoadHookContext, modules []string props.Api_contributions = transformArray( modules, "", fmt.Sprintf(".stubs.source%s.api.contribution", apiSuffix)) props.Defaults_visibility = []string{"//visibility:public"} - props.Previous_api = proptools.StringPtr(":android.api.public.latest") + props.Previous_api = proptools.StringPtr(":android.api.combined." + sdkKind.String() + ".latest") ctx.CreateModule(java.DefaultsFactory, &props) } } |