diff options
Diffstat (limited to 'api')
| -rw-r--r-- | api/Android.bp | 287 | ||||
| -rw-r--r-- | api/Android.mk | 2 | ||||
| -rw-r--r-- | api/ApiDocs.bp | 336 | ||||
| -rw-r--r-- | api/OWNERS | 5 | ||||
| -rw-r--r-- | api/StubLibraries.bp | 866 | ||||
| -rw-r--r-- | api/api.go | 300 | ||||
| -rw-r--r-- | api/api_test.go | 277 | ||||
| -rw-r--r-- | api/coverage/tools/Android.bp | 53 | ||||
| -rw-r--r-- | api/coverage/tools/ExtractFlaggedApis.kt | 93 | ||||
| -rw-r--r-- | api/coverage/tools/ExtractFlaggedApisTest.kt | 238 | ||||
| -rw-r--r-- | api/coverage/tools/extract_flagged_apis.proto | 37 | ||||
| -rwxr-xr-x | api/gen_combined_removed_dex.sh | 2 | ||||
| -rw-r--r-- | api/go.mod | 10 | ||||
| -rw-r--r-- | api/go.work | 17 | ||||
| -rw-r--r-- | api/go.work.sum | 66 | ||||
| -rw-r--r-- | api/javadoc-lint-baseline | 60 |
16 files changed, 2092 insertions, 557 deletions
diff --git a/api/Android.bp b/api/Android.bp index c16bce5a1aea..341be3d53844 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -29,9 +29,9 @@ bootstrap_go_package { pkgPath: "android/soong/api", deps: [ "blueprint", + "blueprint-proptools", "soong", "soong-android", - "soong-bp2build", "soong-genrule", "soong-java", ], @@ -62,15 +62,6 @@ metalava_cmd = "$(location metalava)" metalava_cmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " metalava_cmd += " --quiet " -genrule { - name: "current-api-xml", - tools: ["metalava"], - srcs: [":frameworks-base-api-current.txt"], - out: ["current.api"], - cmd: metalava_cmd + "signature-to-jdiff $(in) $(out)", - visibility: ["//visibility:public"], -} - combined_apis { name: "frameworks-base-api", bootclasspath: [ @@ -86,11 +77,16 @@ combined_apis { "framework-devicelock", "framework-graphics", "framework-healthfitness", + "framework-location", "framework-media", "framework-mediaprovider", + "framework-nfc", "framework-ondevicepersonalization", + "framework-pdf", + "framework-pdf-v", "framework-permission", "framework-permission-s", + "framework-profiling", "framework-scheduling", "framework-sdkextensions", "framework-statsd", @@ -100,7 +96,12 @@ combined_apis { "framework-virtualization", "framework-wifi", "i18n.module.public.api", - ], + ] + select(soong_config_variable("ANDROID", "release_crashrecovery_module"), { + "true": [ + "framework-crashrecovery", + ], + default: [], + }), system_server_classpath: [ "service-art", "service-configinfrastructure", @@ -109,7 +110,12 @@ combined_apis { "service-permission", "service-rkp", "service-sdksandbox", - ], + ] + select(soong_config_variable("ANDROID", "release_crashrecovery_module"), { + "true": [ + "service-crashrecovery", + ], + default: [], + }), } genrule { @@ -131,6 +137,7 @@ genrule { genrule { name: "frameworks-base-api-system-current-compat", srcs: [ + ":android.api.public.latest", ":android.api.system.latest", ":android-incompatibilities.api.system.latest", ":frameworks-base-api-current.txt", @@ -139,33 +146,35 @@ genrule { out: ["updated-baseline.txt"], tools: ["metalava"], cmd: metalava_cmd + + "--check-compatibility:api:released $(location :android.api.public.latest) " + "--check-compatibility:api:released $(location :android.api.system.latest) " + - "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + "--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " + "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + + "$(location :frameworks-base-api-current.txt) " + "$(location :frameworks-base-api-system-current.txt)", } genrule { name: "frameworks-base-api-module-lib-current-compat", srcs: [ + ":android.api.public.latest", + ":android.api.system.latest", ":android.api.module-lib.latest", ":android-incompatibilities.api.module-lib.latest", ":frameworks-base-api-current.txt", + ":frameworks-base-api-system-current.txt", ":frameworks-base-api-module-lib-current.txt", ], out: ["updated-baseline.txt"], tools: ["metalava"], cmd: metalava_cmd + + "--check-compatibility:api:released $(location :android.api.public.latest) " + + "--check-compatibility:api:released $(location :android.api.system.latest) " + "--check-compatibility:api:released $(location :android.api.module-lib.latest) " + - // Note: having "public" be the base of module-lib is not perfect -- it should - // ideally be a merged public+system (which metalava is not currently able to generate). - // This "base" will help when migrating from MODULE_LIBS -> public, but not when - // migrating from MODULE_LIBS -> system (where it needs to instead be listed as - // an incompatibility). - "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + "--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " + "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + + "$(location :frameworks-base-api-current.txt) " + + "$(location :frameworks-base-api-system-current.txt) " + "$(location :frameworks-base-api-module-lib-current.txt)", } @@ -175,7 +184,7 @@ genrule { out: ["current.srcjar"], cmd: "$(location merge_zips) $(out) $(in)", srcs: [ - ":api-stubs-docs-non-updatable", + ":api-stubs-docs-non-updatable{.exportable}", ":all-modules-public-stubs-source", ], visibility: ["//visibility:private"], // Used by make module in //development, mind @@ -198,7 +207,7 @@ genrule { name: "sdk-annotations.zip", defaults: ["sdk-annotations-defaults"], srcs: [ - ":android-non-updatable-doc-stubs{.annotations.zip}", + ":android-non-updatable-doc-stubs{.exportable.annotations.zip}", ":all-modules-public-annotations", ], } @@ -207,7 +216,7 @@ genrule { name: "sdk-annotations-system.zip", defaults: ["sdk-annotations-defaults"], srcs: [ - ":android-non-updatable-doc-stubs-system{.annotations.zip}", + ":android-non-updatable-doc-stubs-system{.exportable.annotations.zip}", ":all-modules-system-annotations", ], } @@ -216,7 +225,7 @@ genrule { name: "sdk-annotations-module-lib.zip", defaults: ["sdk-annotations-defaults"], srcs: [ - ":android-non-updatable-doc-stubs-module-lib{.annotations.zip}", + ":android-non-updatable-doc-stubs-module-lib{.exportable.annotations.zip}", ":all-modules-module-lib-annotations", ], } @@ -225,7 +234,7 @@ genrule { name: "sdk-annotations-system-server.zip", defaults: ["sdk-annotations-defaults"], srcs: [ - ":android-non-updatable-doc-stubs-system-server{.annotations.zip}", + ":android-non-updatable-doc-stubs-system-server{.exportable.annotations.zip}", ":all-modules-system-server-annotations", ], } @@ -259,7 +268,237 @@ java_genrule { cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)", } +packages_to_document = [ + "android", + "dalvik", + "java", + "javax", + "junit", + "org.apache.http", + "org.json", + "org.w3c.dom", + "org.xml.sax", + "org.xmlpull", +] + +// These are libs from framework-internal-utils that are required (i.e. being referenced) +// from framework-non-updatable-sources. Add more here when there's a need. +// DO NOT add the entire framework-internal-utils. It might cause unnecessary circular +// dependencies when the list gets bigger. +android_non_updatable_stubs_libs = [ + "android.hardware.cas-V1.2-java", + "android.hardware.health-V1.0-java-constants", + "android.hardware.thermal-V1.0-java-constants", + "android.hardware.thermal-V2.0-java", + "android.hardware.tv.input-V1.0-java-constants", + "android.hardware.usb-V1.0-java-constants", + "android.hardware.usb-V1.1-java-constants", + "android.hardware.usb.gadget-V1.0-java", + "android.hardware.vibrator-V1.3-java", + "framework-protos", +] + +java_defaults { + name: "android-non-updatable-stubs-libs-defaults", + libs: android_non_updatable_stubs_libs, +} + +// Defaults for all stubs that include the non-updatable framework. These defaults do not include +// module symbols, so will not compile correctly on their own. Users must add module APIs to the +// classpath (or sources) somehow. +stubs_defaults { + name: "android-non-updatable-stubs-defaults", + aconfig_declarations: ["framework-minus-apex-aconfig-declarations"], + srcs: [":android-non-updatable-stub-sources"], + sdk_version: "none", + system_modules: "none", + java_version: "1.8", + arg_files: [":frameworks-base-core-AndroidManifest.xml"], + aidl: { + include_dirs: [ + "frameworks/av/aidl", + "frameworks/base/media/aidl", + "frameworks/base/telephony/java", + "frameworks/native/libs/permission/aidl", + "packages/modules/Bluetooth/framework/aidl-export", + "packages/modules/Connectivity/framework/aidl-export", + "packages/modules/Media/apex/aidl/stable", + "hardware/interfaces/biometrics/common/aidl", + "hardware/interfaces/biometrics/fingerprint/aidl", + "hardware/interfaces/common/aidl", + "hardware/interfaces/common/fmq/aidl", + "hardware/interfaces/graphics/common/aidl", + "hardware/interfaces/keymaster/aidl", + "hardware/interfaces/power/aidl", + "system/hardware/interfaces/media/aidl", + ], + }, + // These are libs from framework-internal-utils that are required (i.e. being referenced) + // from framework-non-updatable-sources. Add more here when there's a need. + // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular + // dependencies gets bigger. + libs: android_non_updatable_stubs_libs, + flags: [ + "--error NoSettingsProvider", + "--error UnhiddenSystemApi", + "--error UnflaggedApi", + "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.*", + // Disable CallbackInterface, as Java 8 default interface methods avoid the extensibility + // issue interfaces had previously. + "--hide CallbackInterface", + // Disable HiddenSuperclass, as Metalava handles this fine (it should be hidden by default) + "--hide HiddenSuperclass", + "--manifest $(location :frameworks-base-core-AndroidManifest.xml)", + ], + filter_packages: packages_to_document, + high_mem: true, // Lots of sources => high memory use, see b/170701554 + installable: false, + annotations_enabled: true, + merge_annotations_dirs: ["metalava-manual"], + defaults_visibility: ["//frameworks/base/api"], + visibility: [ + "//frameworks/base/api", + "//frameworks/base/core/api", + ], +} + +soong_config_module_type { + name: "non_updatable_exportable_droidstubs", + module_type: "droidstubs", + config_namespace: "ANDROID", + bool_variables: [ + "release_hidden_api_exportable_stubs", + ], + properties: [ + "dists", + ], +} + +// We resolve dependencies on APIs in modules by depending on a prebuilt of the whole +// platform (sdk_system_current_android). That prebuilt does not include module-lib APIs, +// so use the prebuilt module-lib stubs for modules that export module-lib stubs that the +// non-updatable part depends on. +non_updatable_api_deps_on_modules = [ + "sdk_module-lib_current_framework-tethering", + "sdk_module-lib_current_framework-connectivity-t", + "sdk_system_current_android", +] + +java_defaults { + name: "module-classpath-java-defaults", + libs: non_updatable_api_deps_on_modules, +} + +// Defaults with module APIs in the classpath (mostly from prebuilts). +// Suitable for compiling android-non-updatable. +stubs_defaults { + name: "module-classpath-stubs-defaults", + aidl: { + include_dirs: [ + "packages/modules/Bluetooth/framework/aidl-export", + "packages/modules/Connectivity/framework/aidl-export", + "packages/modules/Media/apex/aidl/stable", + ], + }, + libs: non_updatable_api_deps_on_modules, +} + +// Defaults for the java_sdk_libraries of unbundled jars from framework. +// java_sdk_libraries using these defaults should also add themselves to the +// non_updatable_modules list in frameworks/base/api/api.go +java_defaults { + name: "framework-non-updatable-unbundled-defaults", + defaults: [ + "framework-non-updatable-lint-defaults", + "non-updatable-framework-module-defaults", + ], + public: { + libs: ["android_module_lib_stubs_current"], + }, + system: { + libs: ["android_module_lib_stubs_current"], + }, + module_lib: { + libs: ["android_module_lib_stubs_current"], + }, + test: { + libs: ["android_test_frameworks_core_stubs_current"], + }, + sdk_version: "core_platform", + stub_only_libs: ["framework-protos"], + impl_only_libs: ["framework-minus-apex-headers"], // the framework, including hidden API + impl_library_visibility: ["//frameworks/base"], + defaults_visibility: [ + "//frameworks/base/location", + "//frameworks/base/nfc", + ], + plugins: ["error_prone_android_framework"], + errorprone: { + javacflags: [ + "-Xep:AndroidFrameworkCompatChange:ERROR", + "-Xep:AndroidFrameworkUid:ERROR", + ], + }, + // Include manual annotations in API txt files + merge_annotations_dirs: ["metalava-manual"], +} + build = [ "ApiDocs.bp", "StubLibraries.bp", ] + +genrule_defaults { + name: "flag-api-mapping-generation-defaults", + cmd: "$(location extract-flagged-apis) $(in) $(out)", + tools: ["extract-flagged-apis"], +} + +genrule { + name: "flag-api-mapping-PublicApi", + defaults: ["flag-api-mapping-generation-defaults"], + srcs: [":frameworks-base-api-current.txt"], + out: ["flag_api_map.textproto"], + dist: { + targets: ["droid"], + }, +} + +genrule { + name: "flag-api-mapping-SystemApi", + defaults: ["flag-api-mapping-generation-defaults"], + srcs: [":frameworks-base-api-system-current.txt"], + out: ["system_flag_api_map.textproto"], + dist: { + targets: ["droid"], + }, +} + +genrule { + name: "flag-api-mapping-ModuleLibApi", + defaults: ["flag-api-mapping-generation-defaults"], + srcs: [":frameworks-base-api-module-lib-current.txt"], + out: ["module_lib_flag_api_map.textproto"], + dist: { + targets: ["droid"], + }, +} + +genrule { + name: "flag-api-mapping-SystemServerApi", + defaults: ["flag-api-mapping-generation-defaults"], + srcs: [":frameworks-base-api-system-server-current.txt"], + out: ["system_server_flag_api_map.textproto"], + dist: { + targets: ["droid"], + }, +} + +phony_rule { + name: "checkapi", + phony_deps: [ + "frameworks-base-api-current-compat", + "frameworks-base-api-system-current-compat", + "frameworks-base-api-module-lib-current-compat", + ], +} diff --git a/api/Android.mk b/api/Android.mk deleted file mode 100644 index ce5f995033c5..000000000000 --- a/api/Android.mk +++ /dev/null @@ -1,2 +0,0 @@ -.PHONY: checkapi -checkapi: frameworks-base-api-current-compat frameworks-base-api-system-current-compat frameworks-base-api-module-lib-current-compat diff --git a/api/ApiDocs.bp b/api/ApiDocs.bp index fbcaa52f9bb4..e8fcf4b2b32d 100644 --- a/api/ApiDocs.bp +++ b/api/ApiDocs.bp @@ -20,41 +20,6 @@ // The API doc generation is done by the various droiddoc modules each of which // is for different format. -///////////////////////////////////////////////////////////////////// -// stub source files are generated using metalava -///////////////////////////////////////////////////////////////////// - -framework_docs_only_libs = [ - "voip-common", - "android.test.mock", - "android-support-annotations", - "android-support-compat", - "android-support-core-ui", - "android-support-core-utils", - "android-support-design", - "android-support-dynamic-animation", - "android-support-exifinterface", - "android-support-fragment", - "android-support-media-compat", - "android-support-percent", - "android-support-transition", - "android-support-v7-cardview", - "android-support-v7-gridlayout", - "android-support-v7-mediarouter", - "android-support-v7-palette", - "android-support-v7-preference", - "android-support-v13", - "android-support-v14-preference", - "android-support-v17-leanback", - "android-support-vectordrawable", - "android-support-animatedvectordrawable", - "android-support-v7-appcompat", - "android-support-v7-recyclerview", - "android-support-v8-renderscript", - "android-support-multidex", - "android-support-multidex-instrumentation", -] - // These defaults enable doc-stub generation, api lint database generation and sdk value generation. stubs_defaults { name: "android-non-updatable-doc-stubs-defaults", @@ -65,7 +30,18 @@ stubs_defaults { ":android-test-mock-sources", ":android-test-runner-sources", ], - libs: framework_docs_only_libs, + flags: [ + // These errors are suppressed in the doc stubs as it isn't easy to suppress them. + // They remain unsuppressed/active in the "main" stubs build (the jar stubs). + // These can be removed when either a) all the issues have been fixed or + // b) these reporting of these issues is gated behind api lint being enabled in metalava. + "--hide BroadcastBehavior", + "--hide DeprecationMismatch", + "--hide MissingPermission", + "--hide RequiresPermission", + "--hide SdkConstant", + "--hide Todo", + ], create_doc_stubs: true, write_sdk_values: true, } @@ -87,9 +63,11 @@ stubs_defaults { ":framework-graphics-srcs", ":framework-mediaprovider-sources", ":framework-nearby-sources", + ":framework-nfc-updatable-sources", ":framework-ondevicepersonalization-sources", ":framework-permission-sources", ":framework-permission-s-sources", + ":framework-profiling-sources", ":framework-scheduling-sources", ":framework-sdkextensions-sources", ":framework-statsd-sources", @@ -108,7 +86,6 @@ droidstubs { "android-non-updatable-doc-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args, } droidstubs { @@ -117,8 +94,7 @@ droidstubs { "android-non-updatable-doc-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ", + flags: ["--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)"], } droidstubs { @@ -127,9 +103,10 @@ droidstubs { "android-non-updatable-doc-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) " + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\) ", + flags: [ + "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)", + "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)", + ], generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs. write_sdk_values: false, } @@ -140,10 +117,11 @@ droidstubs { "android-non-updatable-doc-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) " + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\) " + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\) ", + flags: [ + "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)", + "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)", + "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)", + ], generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs. write_sdk_values: false, } @@ -152,7 +130,6 @@ droidstubs { name: "framework-doc-stubs", defaults: ["android-non-updatable-doc-stubs-defaults"], srcs: [":all-modules-public-stubs-source"], - args: metalava_framework_docs_args, api_levels_module: "api_versions_public", aidl: { include_dirs: [ @@ -160,21 +137,13 @@ droidstubs { "packages/modules/Media/apex/aidl/stable", ], }, - extensions_info_file: ":sdk-extensions-info", } droidstubs { name: "framework-doc-system-stubs", defaults: ["framework-doc-stubs-sources-default"], - args: metalava_framework_docs_args + - " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ", - api_levels_annotations_enabled: true, - api_levels_annotations_dirs: [ - "sdk-dir", - "api-versions-jars-dir", - ], - api_levels_sdk_type: "system", - extensions_info_file: ":sdk-extensions-info", + flags: ["--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)"], + api_levels_module: "api_versions_system", } ///////////////////////////////////////////////////////////////////// @@ -182,20 +151,11 @@ droidstubs { // using droiddoc ///////////////////////////////////////////////////////////////////// -framework_docs_only_args = " -android -manifest $(location :frameworks-base-core-AndroidManifest.xml) " + - "-metalavaApiSince " + - "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " + - "-overview $(location :frameworks-base-java-overview) " + - // Federate Support Library references against local API file. - "-federate SupportLib https://developer.android.com " + - "-federationapi SupportLib $(location :current-support-api) " + - // Federate Support Library references against local API file. - "-federate AndroidX https://developer.android.com " + - "-federationapi AndroidX $(location :current-androidx-api) " - doc_defaults { name: "framework-docs-default", - libs: framework_docs_only_libs + [ + sdk_version: "none", + system_modules: "none", + libs: [ "stub-annotations", "unsupportedappusage", ], @@ -209,6 +169,30 @@ doc_defaults { custom_template: "droiddoc-templates-sdk", resourcesdir: "docs/html/reference/images/", resourcesoutdir: "reference/android/images/", + lint_baseline: "javadoc-lint-baseline", + flags: [ + "-android", + "-manifest $(location :frameworks-base-core-AndroidManifest.xml)", + "-metalavaApiSince", + "-werror", + "-lerror", + "-overview $(location :frameworks-base-java-overview)", + // Federate Support Library references against local API file. + "-federate SupportLib https://developer.android.com", + "-federationapi SupportLib $(location :current-support-api)", + // Federate Support Library references against local API file. + "-federate AndroidX https://developer.android.com", + "-federationapi AndroidX $(location :current-androidx-api)", + // doclava contains checks for a few issues that are have been migrated to metalava. + // disable them in doclava, to avoid mistriggering or double triggering. + "-hide 101", // TODO: turn Lint 101 back into an error again + "-hide 111", // HIDDEN_SUPERCLASS + "-hide 113", // DEPRECATION_MISMATCH + "-hide 125", // REQUIRES_PERMISSION + "-hide 126", // BROADCAST_BEHAVIOR + "-hide 127", // SDK_CONSTANT + "-hide 128", // TODO + ], hdf: [ "dac true", "sdk.codename O", @@ -233,32 +217,21 @@ doc_defaults { }, } -doc_defaults { - name: "framework-dokka-docs-default", -} - -droiddoc { - name: "doc-comment-check-docs", - defaults: ["framework-docs-default"], - srcs: [ - ":framework-doc-stubs", - ], - args: framework_docs_only_args + " -referenceonly -parsecomments", - installable: false, -} - droiddoc { name: "offline-sdk-docs", defaults: ["framework-docs-default"], srcs: [ - ":framework-doc-stubs", + ":framework-doc-stubs{.exportable}", ], hdf: [ "android.whichdoc offline", ], compat_config: ":global-compat-config", proofread_file: "offline-sdk-docs-proofread.txt", - args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"", + flags: [ + "-offlinemode", + "-title \"Android SDK\"", + ], static_doc_index_redirect: "docs/docs-preview-index.html", } @@ -269,13 +242,17 @@ droiddoc { name: "offline-sdk-referenceonly-docs", defaults: ["framework-docs-default"], srcs: [ - ":framework-doc-stubs", + ":framework-doc-stubs{.exportable}", ], hdf: [ "android.whichdoc offline", ], proofread_file: "offline-sdk-referenceonly-docs-proofread.txt", - args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly", + flags: [ + "-offlinemode", + "-title \"Android SDK\"", + "-referenceonly", + ], static_doc_index_redirect: "docs/docs-documentation-redirect.html", static_doc_properties: "docs/source.properties", } @@ -293,113 +270,63 @@ droiddoc { "android.whichdoc offline", ], proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt", - args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" + - " -offlinemode -title \"Android System SDK\" -referenceonly", + flags: [ + "-hide 101", + "-hide 104", + "-hide 108", + "-offlinemode", + "-title \"Android System SDK\"", + "-referenceonly", + ], static_doc_index_redirect: "docs/docs-documentation-redirect.html", static_doc_properties: "docs/source.properties", } droiddoc { - name: "online-sdk-docs", - defaults: ["framework-docs-default"], - srcs: [ - ":framework-doc-stubs", - ], - hdf: [ - "android.whichdoc online", - "android.hasSamples true", - ], - proofread_file: "online-sdk-docs-proofread.txt", - args: framework_docs_only_args + - " -toroot / -samplegroup Admin " + - " -samplegroup Background " + - " -samplegroup Connectivity " + - " -samplegroup Content " + - " -samplegroup Input " + - " -samplegroup Media " + - " -samplegroup Notification " + - " -samplegroup RenderScript " + - " -samplegroup Security " + - " -samplegroup Sensors " + - " -samplegroup System " + - " -samplegroup Testing " + - " -samplegroup UI " + - " -samplegroup Views " + - " -samplegroup Wearable -samplesdir development/samples/browseable ", -} - -droiddoc { - name: "online-system-api-sdk-docs", - defaults: ["framework-docs-default"], - srcs: [ - ":framework-doc-system-stubs", - ], - hdf: [ - "android.whichdoc online", - "android.hasSamples true", - ], - proofread_file: "online-system-api-sdk-docs-proofread.txt", - args: framework_docs_only_args + - " -referenceonly " + - " -title \"Android SDK - Including system APIs.\" " + - " -hide 101 " + - " -hide 104 " + - " -hide 108 " + - " -toroot / -samplegroup Admin " + - " -samplegroup Background " + - " -samplegroup Connectivity " + - " -samplegroup Content " + - " -samplegroup Input " + - " -samplegroup Media " + - " -samplegroup Notification " + - " -samplegroup RenderScript " + - " -samplegroup Security " + - " -samplegroup Sensors " + - " -samplegroup System " + - " -samplegroup Testing " + - " -samplegroup UI " + - " -samplegroup Views " + - " -samplegroup Wearable -samplesdir development/samples/browseable ", - installable: false, -} - -droiddoc { name: "ds-docs-java", defaults: ["framework-docs-default"], srcs: [ - ":framework-doc-stubs", + ":framework-doc-stubs{.exportable}", ], hdf: [ "android.whichdoc online", "android.hasSamples true", ], proofread_file: "ds-docs-proofread.txt", - args: framework_docs_only_args + - " -toroot / -yamlV2 -samplegroup Admin " + - " -samplegroup Background " + - " -samplegroup Connectivity " + - " -samplegroup Content " + - " -samplegroup Input " + - " -samplegroup Media " + - " -samplegroup Notification " + - " -samplegroup RenderScript " + - " -samplegroup Security " + - " -samplegroup Sensors " + - " -samplegroup System " + - " -samplegroup Testing " + - " -samplegroup UI " + - " -samplegroup Views " + - " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ", + flags: [ + " -toroot /", + "-yamlV2", + "-samplegroup Admin", + "-samplegroup Background", + "-samplegroup Connectivity", + "-samplegroup Content", + "-samplegroup Input", + "-samplegroup Media", + "-samplegroup Notification", + "-samplegroup RenderScript", + "-samplegroup Security", + "-samplegroup Sensors", + "-samplegroup System", + "-samplegroup Testing", + "-samplegroup UI", + "-samplegroup Views", + "-samplegroup Wearable", + "-devsite", + "-samplesdir", + "development/samples/browseable", + ], } droiddoc { name: "ds-docs-kt", - defaults: ["framework-dokka-docs-default"], srcs: [ - ":framework-doc-stubs", + ":framework-doc-stubs{.exportable}", ], - args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " + + flags: [ + "-noJdkLink", + "-links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list", "-noStdlibLink", + ], proofread_file: "ds-dokka-proofread.txt", dokka_enabled: true, } @@ -447,70 +374,31 @@ droiddoc { name: "ds-static-docs", defaults: ["framework-docs-default"], srcs: [ - ":framework-doc-stubs", + ":framework-doc-stubs{.exportable}", ], hdf: [ "android.whichdoc online", ], - args: framework_docs_only_args + - " -staticonly " + - " -toroot / " + - " -devsite " + - " -ignoreJdLinks ", -} - -droiddoc { - name: "ds-ref-navtree-docs", - defaults: ["framework-docs-default"], - srcs: [ - ":framework-doc-stubs", - ], - hdf: [ - "android.whichdoc online", + flags: [ + "-staticonly", + "-toroot /", + "-devsite", + "-ignoreJdLinks", ], - args: framework_docs_only_args + - " -toroot / " + - " -atLinksNavtree " + - " -navtreeonly ", } droiddoc { - name: "online-sdk-dev-docs", + name: "ds-ref-navtree-docs", defaults: ["framework-docs-default"], srcs: [ - ":framework-doc-stubs", + ":framework-doc-stubs{.exportable}", ], hdf: [ "android.whichdoc online", - "android.hasSamples true", ], - proofread_file: "online-sdk-dev-docs-proofread.txt", - args: framework_docs_only_args + - " -toroot / -samplegroup Admin " + - " -samplegroup Background " + - " -samplegroup Connectivity " + - " -samplegroup Content " + - " -samplegroup Input " + - " -samplegroup Media " + - " -samplegroup Notification " + - " -samplegroup RenderScript " + - " -samplegroup Security " + - " -samplegroup Sensors " + - " -samplegroup System " + - " -samplegroup Testing " + - " -samplegroup UI " + - " -samplegroup Views " + - " -samplegroup Wearable -samplesdir development/samples/browseable ", -} - -droiddoc { - name: "hidden-docs", - defaults: ["framework-docs-default"], - srcs: [ - ":framework-doc-stubs", + flags: [ + "-toroot /", + "-atLinksNavtree", + "-navtreeonly", ], - proofread_file: "hidden-docs-proofread.txt", - args: framework_docs_only_args + - " -referenceonly " + - " -title \"Android SDK - Including hidden APIs.\"", } diff --git a/api/OWNERS b/api/OWNERS index bf6216c168e8..965093c9ab38 100644 --- a/api/OWNERS +++ b/api/OWNERS @@ -3,7 +3,10 @@ hansson@google.com # Modularization team file:platform/packages/modules/common:/OWNERS +# Soong plugin owned by Soong team. +per-file *.go,go.mod,go.work,go.work.sum = file:platform/build/soong:/OWNERS + per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION} # For metalava team to disable lint checks in platform -per-file Android.bp = aurimas@google.com,emberrose@google.com,sjgilbert@google.com +per-file Android.bp = aurimas@google.com,emberrose@google.com diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp index f08745b5cd2c..b3a674fbd70e 100644 --- a/api/StubLibraries.bp +++ b/api/StubLibraries.bp @@ -27,104 +27,166 @@ // These modules provide source files for the stub libraries ///////////////////////////////////////////////////////////////////// -droidstubs { +soong_config_module_type_import { + from: "frameworks/base/api/Android.bp", + module_types: ["non_updatable_exportable_droidstubs"], +} + +non_updatable_exportable_droidstubs { name: "api-stubs-docs-non-updatable", defaults: [ "android-non-updatable-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args, + // 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", removed_api_file: ":non-updatable-removed.txt", }, last_released: { - api_file: ":android-non-updatable.api.public.latest", - removed_api_file: ":android-non-updatable-removed.api.public.latest", + api_file: ":android-non-updatable.api.combined.public.latest", + removed_api_file: ":android-non-updatable-removed.api.combined.public.latest", baseline_file: ":android-non-updatable-incompatibilities.api.public.latest", }, api_lint: { enabled: true, - new_since: ":android.api.public.latest", + new_since: ":android.api.combined.public.latest", + baseline_file: ":non-updatable-lint-baseline.txt", }, }, - dists: [ - { - targets: ["sdk"], - dir: "apistubs/android/public/api", - dest: "android-non-updatable.txt", - tag: ".api.txt", + soong_config_variables: { + release_hidden_api_exportable_stubs: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/public/api", + dest: "android-non-updatable.txt", + tag: ".exportable.api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/public/api", + dest: "android-non-updatable-removed.txt", + tag: ".exportable.removed-api.txt", + }, + ], + conditions_default: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/public/api", + dest: "android-non-updatable.txt", + tag: ".api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/public/api", + dest: "android-non-updatable-removed.txt", + tag: ".removed-api.txt", + }, + ], + }, }, - { - targets: ["sdk"], - dir: "apistubs/android/public/api", - dest: "android-non-updatable-removed.txt", - tag: ".removed-api.txt", - }, - ], + }, + api_surface: "public", } -priv_apps = " --show-annotation android.annotation.SystemApi\\(" + - "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + - "\\)" +priv_apps = [ + "--show-annotation android.annotation.SystemApi\\(" + + "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + + "\\)", +] -priv_apps_in_stubs = " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" + - "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + - "\\)" +priv_apps_in_stubs = [ + "--show-for-stub-purposes-annotation android.annotation.SystemApi\\(" + + "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + + "\\)", +] -test = " --show-annotation android.annotation.TestApi" +test = ["--show-annotation android.annotation.TestApi"] -module_libs = " --show-annotation android.annotation.SystemApi\\(" + - "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + - "\\)" +module_libs = [ + "--show-annotation android.annotation.SystemApi\\(" + + "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + + "\\)", +] -droidstubs { +non_updatable_exportable_droidstubs { name: "system-api-stubs-docs-non-updatable", defaults: [ "android-non-updatable-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args + priv_apps, + 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", removed_api_file: ":non-updatable-system-removed.txt", }, last_released: { - api_file: ":android-non-updatable.api.system.latest", - removed_api_file: ":android-non-updatable-removed.api.system.latest", + api_file: ":android-non-updatable.api.combined.system.latest", + removed_api_file: ":android-non-updatable-removed.api.combined.system.latest", baseline_file: ":android-non-updatable-incompatibilities.api.system.latest", }, api_lint: { enabled: true, - new_since: ":android.api.system.latest", + new_since: ":android.api.combined.system.latest", baseline_file: ":non-updatable-system-lint-baseline.txt", }, }, - dists: [ - { - targets: ["sdk"], - dir: "apistubs/android/system/api", - dest: "android-non-updatable.txt", - tag: ".api.txt", - }, - { - targets: ["sdk"], - dir: "apistubs/android/system/api", - dest: "android-non-updatable-removed.txt", - tag: ".removed-api.txt", + soong_config_variables: { + release_hidden_api_exportable_stubs: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/system/api", + dest: "android-non-updatable.txt", + tag: ".exportable.api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/system/api", + dest: "android-non-updatable-removed.txt", + tag: ".exportable.removed-api.txt", + }, + ], + conditions_default: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/system/api", + dest: "android-non-updatable.txt", + tag: ".api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/system/api", + dest: "android-non-updatable-removed.txt", + tag: ".removed-api.txt", + }, + ], + }, }, - ], + }, + api_surface: "system", } -droidstubs { +non_updatable_exportable_droidstubs { name: "test-api-stubs-docs-non-updatable", defaults: [ "android-non-updatable-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args + test + priv_apps_in_stubs, + 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", @@ -132,74 +194,132 @@ droidstubs { }, api_lint: { enabled: true, + new_since: ":android.api.combined.test.latest", baseline_file: ":non-updatable-test-lint-baseline.txt", }, }, - dists: [ - { - targets: ["sdk"], - dir: "apistubs/android/test/api", - dest: "android.txt", - tag: ".api.txt", - }, - { - targets: ["sdk"], - dir: "apistubs/android/test/api", - dest: "removed.txt", - tag: ".removed-api.txt", - }, - { - targets: ["sdk"], - dir: "apistubs/android/test/api", - dest: "android-non-updatable.txt", - tag: ".api.txt", - }, - { - targets: ["sdk"], - dir: "apistubs/android/test/api", - dest: "android-non-updatable-removed.txt", - tag: ".removed-api.txt", + soong_config_variables: { + release_hidden_api_exportable_stubs: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "android.txt", + tag: ".exportable.api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "removed.txt", + tag: ".exportable.removed-api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "android-non-updatable.txt", + tag: ".exportable.api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "android-non-updatable-removed.txt", + tag: ".exportable.removed-api.txt", + }, + ], + conditions_default: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "android.txt", + tag: ".api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "removed.txt", + tag: ".removed-api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "android-non-updatable.txt", + tag: ".api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/test/api", + dest: "android-non-updatable-removed.txt", + tag: ".removed-api.txt", + }, + ], + }, }, - ], + }, + api_surface: "test", } -droidstubs { +non_updatable_exportable_droidstubs { name: "module-lib-api-stubs-docs-non-updatable", defaults: [ "android-non-updatable-stubs-defaults", "module-classpath-stubs-defaults", ], - args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs, + 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", removed_api_file: ":non-updatable-module-lib-removed.txt", }, last_released: { - api_file: ":android-non-updatable.api.module-lib.latest", - removed_api_file: ":android-non-updatable-removed.api.module-lib.latest", + api_file: ":android-non-updatable.api.combined.module-lib.latest", + removed_api_file: ":android-non-updatable-removed.api.combined.module-lib.latest", baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest", }, api_lint: { enabled: true, - new_since: ":android.api.module-lib.latest", + new_since: ":android.api.combined.module-lib.latest", baseline_file: ":non-updatable-module-lib-lint-baseline.txt", }, }, - dists: [ - { - targets: ["sdk"], - dir: "apistubs/android/module-lib/api", - dest: "android-non-updatable.txt", - tag: ".api.txt", + soong_config_variables: { + release_hidden_api_exportable_stubs: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/module-lib/api", + dest: "android-non-updatable.txt", + tag: ".exportable.api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/module-lib/api", + dest: "android-non-updatable-removed.txt", + tag: ".exportable.removed-api.txt", + }, + ], + conditions_default: { + dists: [ + { + targets: ["sdk"], + dir: "apistubs/android/module-lib/api", + dest: "android-non-updatable.txt", + tag: ".api.txt", + }, + { + targets: ["sdk"], + dir: "apistubs/android/module-lib/api", + dest: "android-non-updatable-removed.txt", + tag: ".removed-api.txt", + }, + ], + }, }, - { - targets: ["sdk"], - dir: "apistubs/android/module-lib/api", - dest: "android-non-updatable-removed.txt", - tag: ".removed-api.txt", - }, - ], + }, + api_surface: "module-lib", } ///////////////////////////////////////////////////////////////////// @@ -213,76 +333,336 @@ java_defaults { system_modules: "none", java_version: "1.8", compile_dex: true, - defaults_visibility: ["//visibility:private"], visibility: ["//visibility:public"], + is_stubs_module: true, } java_defaults { - name: "android-non-updatable_defaults_stubs_current", - libs: ["stub-annotations"], - static_libs: ["framework-res-package-jar"], // Export package of framework-res + name: "android-non-updatable_defaults", sdk_version: "none", system_modules: "none", java_version: "1.8", compile_dex: true, + is_stubs_module: true, +} + +java_defaults { + name: "android-non-updatable_from_source_defaults", + libs: ["stub-annotations"], + static_libs: ["framework-res-package-jar"], // Export package of framework-res +} + +java_defaults { + name: "android-non-updatable_exportable_from_source_defaults", dist: { targets: ["sdk"], tag: ".jar", dest: "android-non-updatable.jar", }, - defaults_visibility: ["//visibility:private"], - visibility: ["//visibility:private"], } java_library { name: "android-non-updatable.stubs", - defaults: ["android-non-updatable_defaults_stubs_current"], + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.from-source", + ], + product_variables: { + build_from_text_stub: { + static_libs: [ + "android-non-updatable.stubs.from-text", + ], + exclude_static_libs: [ + "android-non-updatable.stubs.from-source", + ], + }, + }, +} + +java_library { + name: "android-non-updatable.stubs.exportable", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.exportable.from-source", + ], +} + +java_library { + name: "android-non-updatable.stubs.system", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.system.from-source", + ], + product_variables: { + build_from_text_stub: { + static_libs: [ + "android-non-updatable.stubs.system.from-text", + ], + exclude_static_libs: [ + "android-non-updatable.stubs.system.from-source", + ], + }, + }, +} + +java_library { + name: "android-non-updatable.stubs.exportable.system", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.exportable.system.from-source", + ], +} + +java_library { + name: "android-non-updatable.stubs.module_lib", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.module_lib.from-source", + ], + product_variables: { + build_from_text_stub: { + static_libs: [ + "android-non-updatable.stubs.module_lib.from-text", + ], + exclude_static_libs: [ + "android-non-updatable.stubs.module_lib.from-source", + ], + }, + }, +} + +java_library { + name: "android-non-updatable.stubs.exportable.module_lib", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.exportable.module_lib.from-source", + ], +} + +java_library { + name: "android-non-updatable.stubs.test", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.test.from-source", + ], + product_variables: { + build_from_text_stub: { + static_libs: [ + "android-non-updatable.stubs.test.from-text", + ], + exclude_static_libs: [ + "android-non-updatable.stubs.test.from-source", + ], + }, + }, +} + +java_library { + name: "android-non-updatable.stubs.exportable.test", + defaults: ["android-non-updatable_defaults"], + static_libs: [ + "android-non-updatable.stubs.exportable.test.from-source", + ], +} + +java_library { + name: "android-non-updatable.stubs.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + ], srcs: [":api-stubs-docs-non-updatable"], libs: ["all-modules-public-stubs"], +} + +java_library { + name: "android-non-updatable.stubs.exportable.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + "android-non-updatable_exportable_from_source_defaults", + ], + srcs: [":api-stubs-docs-non-updatable{.exportable}"], + libs: ["all-modules-public-stubs"], dist: { dir: "apistubs/android/public", }, } java_library { - name: "android-non-updatable.stubs.system", - defaults: ["android-non-updatable_defaults_stubs_current"], + name: "android-non-updatable.stubs.system.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + ], srcs: [":system-api-stubs-docs-non-updatable"], libs: ["all-modules-system-stubs"], +} + +java_library { + name: "android-non-updatable.stubs.exportable.system.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + "android-non-updatable_exportable_from_source_defaults", + ], + srcs: [":system-api-stubs-docs-non-updatable{.exportable}"], + libs: ["all-modules-system-stubs"], dist: { dir: "apistubs/android/system", }, } java_library { - name: "android-non-updatable.stubs.module_lib", - defaults: ["android-non-updatable_defaults_stubs_current"], + name: "android-non-updatable.stubs.module_lib.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + ], srcs: [":module-lib-api-stubs-docs-non-updatable"], - libs: [ - "sdk_module-lib_current_framework-tethering", - "sdk_module-lib_current_framework-connectivity-t", - "sdk_public_current_framework-bluetooth", - // NOTE: The below can be removed once the prebuilt stub contains bluetooth. - "sdk_system_current_android", - // NOTE: The below can be removed once the prebuilt stub contains IKE. - "sdk_system_current_android.net.ipsec.ike", + libs: non_updatable_api_deps_on_modules, +} + +java_library { + name: "android-non-updatable.stubs.exportable.module_lib.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + "android-non-updatable_exportable_from_source_defaults", ], + srcs: [":module-lib-api-stubs-docs-non-updatable{.exportable}"], + libs: non_updatable_api_deps_on_modules, dist: { dir: "apistubs/android/module-lib", }, } java_library { - name: "android-non-updatable.stubs.test", - defaults: ["android-non-updatable_defaults_stubs_current"], + name: "android-non-updatable.stubs.test.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + ], srcs: [":test-api-stubs-docs-non-updatable"], libs: ["all-modules-system-stubs"], +} + +java_library { + name: "android-non-updatable.stubs.exportable.test.from-source", + defaults: [ + "android-non-updatable_defaults", + "android-non-updatable_from_source_defaults", + "android-non-updatable_exportable_from_source_defaults", + ], + srcs: [":test-api-stubs-docs-non-updatable{.exportable}"], + libs: ["all-modules-system-stubs"], dist: { dir: "apistubs/android/test", }, } java_defaults { + name: "android-non-updatable_from_text_defaults", + defaults: ["android-non-updatable-stubs-libs-defaults"], + static_libs: ["framework-res-package-jar"], + libs: ["stub-annotations"], + sdk_version: "none", + system_modules: "none", + previous_api: ":android.api.public.latest", +} + +java_defaults { + name: "android-non-updatable_everything_from_text_defaults", + defaults: [ + "android-non-updatable_from_text_defaults", + ], + stubs_type: "everything", +} + +java_api_library { + name: "android-non-updatable.stubs.from-text", + api_surface: "public", + api_contributions: [ + "api-stubs-docs-non-updatable.api.contribution", + ], + defaults: ["android-non-updatable_everything_from_text_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", + libs: ["all-modules-public-stubs"], +} + +java_api_library { + name: "android-non-updatable.stubs.system.from-text", + api_surface: "system", + api_contributions: [ + "api-stubs-docs-non-updatable.api.contribution", + "system-api-stubs-docs-non-updatable.api.contribution", + ], + defaults: ["android-non-updatable_everything_from_text_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.system.latest", + libs: ["all-modules-system-stubs"], +} + +java_api_library { + name: "android-non-updatable.stubs.test.from-text", + api_surface: "test", + api_contributions: [ + "api-stubs-docs-non-updatable.api.contribution", + "system-api-stubs-docs-non-updatable.api.contribution", + "test-api-stubs-docs-non-updatable.api.contribution", + ], + defaults: ["android-non-updatable_everything_from_text_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.test.latest", + libs: ["all-modules-system-stubs"], +} + +java_api_library { + name: "android-non-updatable.stubs.module_lib.from-text", + api_surface: "module_lib", + api_contributions: [ + "api-stubs-docs-non-updatable.api.contribution", + "system-api-stubs-docs-non-updatable.api.contribution", + "module-lib-api-stubs-docs-non-updatable.api.contribution", + ], + defaults: [ + "module-classpath-java-defaults", + "android-non-updatable_everything_from_text_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.module-lib.latest", +} + +// This module generates a stub jar that is a union of the test and module lib +// non-updatable api contributions. Modules should not depend on the stub jar +// generated from this module, as this module is strictly used for hiddenapi only. +java_api_library { + name: "android-non-updatable.stubs.test_module_lib", + api_surface: "module_lib", + api_contributions: [ + "api-stubs-docs-non-updatable.api.contribution", + "system-api-stubs-docs-non-updatable.api.contribution", + "test-api-stubs-docs-non-updatable.api.contribution", + "module-lib-api-stubs-docs-non-updatable.api.contribution", + ], + defaults: [ + "module-classpath-java-defaults", + "android-non-updatable_everything_from_text_defaults", + ], + + // 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"], + libs: ["all-modules-system-stubs"], +} + +java_defaults { name: "android_stubs_dists_default", dist: { targets: ["sdk"], @@ -303,6 +683,16 @@ java_library { } java_library { + name: "android_stubs_current_exportable", + static_libs: [ + "all-modules-public-stubs-exportable", + "android-non-updatable.stubs.exportable", + "private-stub-annotations-jar", + ], + defaults: ["android.jar_defaults"], +} + +java_library { name: "android_system_stubs_current", static_libs: [ "all-modules-system-stubs", @@ -311,6 +701,19 @@ java_library { ], defaults: [ "android.jar_defaults", + ], + visibility: ["//frameworks/base/services"], +} + +java_library { + name: "android_system_stubs_current_exportable", + static_libs: [ + "all-modules-system-stubs-exportable", + "android-non-updatable.stubs.exportable.system", + "private-stub-annotations-jar", + ], + defaults: [ + "android.jar_defaults", "android_stubs_dists_default", ], dist: { @@ -339,6 +742,23 @@ java_library { ], defaults: [ "android.jar_defaults", + ], + visibility: ["//frameworks/base/services"], +} + +java_library { + name: "android_test_stubs_current_exportable", + static_libs: [ + // Updatable modules do not have test APIs, but we want to include their SystemApis, like we + // include the SystemApi of framework-non-updatable-sources. + "all-updatable-modules-system-stubs-exportable", + // Non-updatable modules on the other hand can have test APIs, so include their test-stubs. + "all-non-updatable-modules-test-stubs-exportable", + "android-non-updatable.stubs.exportable.test", + "private-stub-annotations-jar", + ], + defaults: [ + "android.jar_defaults", "android_stubs_dists_default", ], dist: { @@ -346,17 +766,43 @@ java_library { }, } +// This module does not need to be copied to dist +java_library { + name: "android_test_frameworks_core_stubs_current", + static_libs: [ + "all-updatable-modules-system-stubs", + "android-non-updatable.stubs.test", + ], + defaults: [ + "android.jar_defaults", + ], + visibility: ["//frameworks/base/services"], +} + java_library { name: "android_module_lib_stubs_current", defaults: [ "android.jar_defaults", - "android_stubs_dists_default", ], static_libs: [ "android-non-updatable.stubs.module_lib", "art.module.public.api.stubs.module_lib", "i18n.module.public.api.stubs", ], + visibility: ["//frameworks/base/services"], +} + +java_library { + name: "android_module_lib_stubs_current_exportable", + defaults: [ + "android.jar_defaults", + "android_stubs_dists_default", + ], + static_libs: [ + "android-non-updatable.stubs.exportable.module_lib", + "art.module.public.api.stubs.exportable.module_lib", + "i18n.module.public.api.stubs.exportable", + ], dist: { dir: "apistubs/android/module-lib", }, @@ -366,13 +812,26 @@ java_library { name: "android_system_server_stubs_current", defaults: [ "android.jar_defaults", - "android_stubs_dists_default", ], srcs: [":services-non-updatable-stubs"], installable: false, static_libs: [ "android_module_lib_stubs_current", ], + visibility: ["//frameworks/base/services"], +} + +java_library { + name: "android_system_server_stubs_current_exportable", + defaults: [ + "android.jar_defaults", + "android_stubs_dists_default", + ], + srcs: [":services-non-updatable-stubs{.exportable}"], + installable: false, + static_libs: [ + "android_module_lib_stubs_current_exportable", + ], dist: { dir: "apistubs/android/system-server", }, @@ -398,11 +857,11 @@ java_library { // with its own package-private android.annotation.Nullable. "private-stub-annotations-jar", ], + is_stubs_module: true, } java_genrule { name: "android_stubs_private_hjar", - visibility: ["//visibility:private"], srcs: [":android_stubs_private_jar{.hjar}"], out: ["android_stubs_private.jar"], cmd: "cp $(in) $(out)", @@ -411,30 +870,37 @@ java_genrule { java_library { name: "android_stubs_private", defaults: ["android_stubs_dists_default"], - visibility: ["//visibility:private"], sdk_version: "none", system_modules: "none", static_libs: ["android_stubs_private_hjar"], dist: { + // Add to private_api_stubs dist target for easier packaging by scripts. This module is + // useful for creating a platform SDK, which can be packaged in ANDROID_HOME and used from + // Gradle, allowing for development of platform apps that make use of hidden APIs. + targets: ["private_api_stubs"], dir: "apistubs/android/private", }, } java_genrule { name: "android_stubs_private_framework_aidl", - visibility: ["//visibility:private"], tools: ["sdkparcelables"], srcs: [":android_stubs_private"], out: ["framework.aidl"], cmd: "rm -f $(genDir)/framework.aidl.merged && " + "for i in $(in); do " + " rm -f $(genDir)/framework.aidl.tmp && " + - " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " + + " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp --guarantee_stable && " + " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " + "done && " + "sort -u $(genDir)/framework.aidl.merged > $(out)", dist: { - targets: ["sdk"], + targets: [ + "sdk", + // Add to private_api_stubs dist target for easier packaging by scripts. + // See explanation in the "android_stubs_private" module above. + "private_api_stubs", + ], dir: "apistubs/android/private", }, } @@ -447,7 +913,7 @@ java_genrule { java_library { name: "android_stubs_current_with_test_libs", static_libs: [ - "android_stubs_current", + "android_stubs_current_exportable", "android.test.base.stubs", "android.test.mock.stubs", "android.test.runner.stubs", @@ -462,7 +928,7 @@ java_library { java_library { name: "android_system_stubs_current_with_test_libs", static_libs: [ - "android_system_stubs_current", + "android_system_stubs_current_exportable", "android.test.base.stubs.system", "android.test.mock.stubs.system", "android.test.runner.stubs.system", @@ -477,7 +943,7 @@ java_library { java_library { name: "android_module_stubs_current_with_test_libs", static_libs: [ - "android_module_lib_stubs_current", + "android_module_lib_stubs_current_exportable", "android.test.base.stubs", "android.test.mock.stubs", "android.test.runner.stubs", @@ -492,7 +958,7 @@ java_library { java_library { name: "android_system_server_stubs_current_with_test_libs", static_libs: [ - "android_system_server_stubs_current", + "android_system_server_stubs_current_exportable", "android.test.base.stubs.system", "android.test.mock.stubs.system", "android.test.runner.stubs.system", @@ -504,69 +970,151 @@ java_library { ], } -droidstubs { - name: "api_versions_public", - srcs: [":android_stubs_current_with_test_libs{.jar}"], +// Defaults for `droidstubs` modules that generate `api-versions.xml` files for +// the various API surfaces. +stubs_defaults { + name: "api_versions_base_defaults", + defaults_visibility: ["//visibility:private"], generate_stubs: false, api_levels_annotations_enabled: true, api_levels_annotations_dirs: [ "sdk-dir", "api-versions-jars-dir", ], - api_levels_sdk_type: "public", +} + +// Defaults for `droidstubs` modules that generate complete `api-versions.xml` +// files, i.e. include SDK extensions. +stubs_defaults { + name: "api_versions_complete_defaults", + defaults_visibility: ["//visibility:private"], + defaults: ["api_versions_base_defaults"], extensions_info_file: ":sdk-extensions-info", +} + +// Produces an `api-versions.xml` file that includes up-to-date information +// about all the public APIs, both updatable and non-updatable and historic +// information about all previous dessert and SDK extension releases. +droidstubs { + name: "api_versions_public", + defaults: ["api_versions_complete_defaults"], + srcs: [":android_stubs_current_with_test_libs{.jar}"], + api_levels_sdk_type: "public", visibility: ["//frameworks/base"], } +// Produces an `api-versions.xml` file that includes up-to-date information +// about all the system APIs, both updatable and non-updatable and historic +// information about all previous dessert and SDK extension releases. droidstubs { name: "api_versions_system", + defaults: ["api_versions_complete_defaults"], srcs: [":android_system_stubs_current_with_test_libs{.jar}"], - generate_stubs: false, - api_levels_annotations_enabled: true, - api_levels_annotations_dirs: [ - "sdk-dir", - "api-versions-jars-dir", - ], api_levels_sdk_type: "system", - extensions_info_file: ":sdk-extensions-info", + dists: [ + // Make the api-versions.xml file for the system API available in the + // sdk build target. + { + targets: ["sdk"], + dest: "api-versions_system.xml", + tag: ".api_versions.xml", + }, + ], } -// This module can be built with: -// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml -droidstubs { - name: "api_versions_module_lib", - srcs: [":android_module_stubs_current_with_test_libs{.jar}"], - generate_stubs: false, - api_levels_annotations_enabled: true, +// Defaults for `droidstubs` modules that generate `api-versions.xml` files that +// only include non-updatable code, i.e. for platform API only, not SDK +// extensions. +stubs_defaults { + name: "api_versions_non_updatable_defaults", + defaults_visibility: ["//visibility:private"], + defaults: ["api_versions_base_defaults"], // this only has the non-updatable portions of the module lib sdk, // which can reference classes from updatable apexes, so remove references to them // from this api_versions file. flags: ["--remove-missing-class-references-in-api-levels"], - api_levels_annotations_dirs: [ - "sdk-dir", - "api-versions-jars-dir", - ], - api_levels_sdk_type: "module-lib", // extensions_info_file is purposefully omitted, because this module should just be // the non-updatable portions of the sdk, and extension sdks are updatable. } +// Produces an `api-versions.xml` file that includes up-to-date information +// about only the non-updatable module-lib APIs and historic information about +// all previous dessert and SDK extension releases. That historic information +// may include information about APIs that were previously not-updatable which +// have since become updatable. +droidstubs { + name: "api_versions_module_lib", + defaults: ["api_versions_non_updatable_defaults"], + srcs: [":android_module_stubs_current_with_test_libs{.jar}"], + api_levels_sdk_type: "module-lib", +} + +// Create a single jar containing the whole module-lib API surface. +// This is needed because Metalava only consumes the first jar file it is given +// and ignores the rest. +java_library { + name: "android_module_stubs_complete_current_with_test_libs", + static_libs: [ + "android_module_stubs_current_with_test_libs", + "framework-updatable-stubs-module_libs_api-exportable", + ], + defaults: ["android.jar_defaults"], + visibility: [ + "//visibility:override", + "//visibility:private", + ], +} + +// Produces an `api-versions.xml` file that includes up-to-date information +// about all the module-lib APIs, both updatable and non-updatable and historic +// information about all previous dessert and SDK extension releases. +droidstubs { + name: "api_versions_module_lib_complete", + defaults: ["api_versions_complete_defaults"], + srcs: [":android_module_stubs_complete_current_with_test_libs{.jar}"], + api_levels_sdk_type: "module-lib", +} + +// Produces an `api-versions.xml` file that includes up-to-date information +// about only the non-updatable system-server APIs and historic information +// about all previous dessert and SDK extension releases. That historic +// information may include information about APIs that were previously +// not-updatable which have since become updatable. droidstubs { name: "api_versions_system_server", + defaults: ["api_versions_non_updatable_defaults"], srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"], - generate_stubs: false, - api_levels_annotations_enabled: true, - // this only has the non-updatable portions of the system server sdk, - // which can reference classes from updatable apexes, so remove references to them - // from this api_versions file. - flags: ["--remove-missing-class-references-in-api-levels"], - api_levels_annotations_dirs: [ - "sdk-dir", - "api-versions-jars-dir", + api_levels_sdk_type: "system-server", +} + +// Create a single jar containing the whole system-server API surface. +// This is needed because Metalava only consumes the first jar file it is given +// and ignores the rest. +java_library { + name: "android_system_server_stubs_complete_current_with_test_libs", + static_libs: [ + "android_system_server_stubs_current_with_test_libs", + // system-server extends module-lib but libraries which only service-* + // libraries provided system-server APIs, so include module-lib APIs for + // the others, e.g. framework-* libraries. + "framework-updatable-stubs-module_libs_api-exportable", + "framework-updatable-stubs-system_server_api-exportable", + ], + defaults: ["android.jar_defaults"], + visibility: [ + "//visibility:override", + "//visibility:private", ], +} + +// Produces an `api-versions.xml` file that includes up-to-date information +// about all the system-server APIs, both updatable and non-updatable and +// historic information about all previous dessert and SDK extension releases. +droidstubs { + name: "api_versions_system_server_complete", + defaults: ["api_versions_complete_defaults"], + srcs: [":android_system_server_stubs_complete_current_with_test_libs{.jar}"], api_levels_sdk_type: "system-server", - // extensions_info_file is purposefully omitted, because this module should just be - // the non-updatable portions of the sdk, and extension sdks are updatable. } ///////////////////////////////////////////////////////////////////// @@ -585,8 +1133,7 @@ droidstubs { merge_annotations_dirs: [ "metalava-manual", ], - args: priv_apps, - visibility: ["//visibility:private"], + flags: priv_apps, } java_library { @@ -597,4 +1144,5 @@ java_library { ":hwbinder-stubs-docs", ], visibility: ["//visibility:public"], + is_stubs_module: true, } diff --git a/api/api.go b/api/api.go index 09c238336a39..5b7f534443fb 100644 --- a/api/api.go +++ b/api/api.go @@ -20,7 +20,6 @@ import ( "github.com/google/blueprint/proptools" "android/soong/android" - "android/soong/bazel" "android/soong/genrule" "android/soong/java" ) @@ -29,6 +28,7 @@ const art = "art.module.public.api" const conscrypt = "conscrypt.module.public.api" const i18n = "i18n.module.public.api" const virtualization = "framework-virtualization" +const location = "framework-location" var core_libraries_modules = []string{art, conscrypt, i18n} @@ -40,7 +40,7 @@ var core_libraries_modules = []string{art, conscrypt, i18n} // APIs. // In addition, the modules in this list are allowed to contribute to test APIs // stubs. -var non_updatable_modules = []string{virtualization} +var non_updatable_modules = []string{virtualization, location} // The intention behind this soong plugin is to generate a number of "merged" // API-related modules that would otherwise require a large amount of very @@ -52,16 +52,15 @@ var non_updatable_modules = []string{virtualization} // The properties of the combined_apis module type. type CombinedApisProperties struct { // Module libraries in the bootclasspath - Bootclasspath []string + Bootclasspath proptools.Configurable[[]string] // Module libraries on the bootclasspath if include_nonpublic_framework_api is true. Conditional_bootclasspath []string // Module libraries in system server - System_server_classpath []string + System_server_classpath proptools.Configurable[[]string] } type CombinedApis struct { android.ModuleBase - android.BazelModuleBase properties CombinedApisProperties } @@ -76,7 +75,53 @@ func registerBuildComponents(ctx android.RegistrationContext) { var PrepareForCombinedApisTest = android.FixtureRegisterWithContext(registerBuildComponents) +func (a *CombinedApis) bootclasspath(ctx android.ConfigAndErrorContext) []string { + return a.properties.Bootclasspath.GetOrDefault(a.ConfigurableEvaluator(ctx), nil) +} + +func (a *CombinedApis) systemServerClasspath(ctx android.ConfigAndErrorContext) []string { + return a.properties.System_server_classpath.GetOrDefault(a.ConfigurableEvaluator(ctx), nil) +} + +func (a *CombinedApis) apiFingerprintStubDeps(ctx android.BottomUpMutatorContext) []string { + ret := []string{} + ret = append( + ret, + transformArray(a.bootclasspath(ctx), "", ".stubs")..., + ) + ret = append( + ret, + transformArray(a.bootclasspath(ctx), "", ".stubs.system")..., + ) + ret = append( + ret, + transformArray(a.bootclasspath(ctx), "", ".stubs.module_lib")..., + ) + ret = append( + ret, + transformArray(a.systemServerClasspath(ctx), "", ".stubs.system_server")..., + ) + return ret +} + +func (a *CombinedApis) DepsMutator(ctx android.BottomUpMutatorContext) { + ctx.AddDependency(ctx.Module(), nil, a.apiFingerprintStubDeps(ctx)...) +} + func (a *CombinedApis) GenerateAndroidBuildActions(ctx android.ModuleContext) { + ctx.WalkDeps(func(child, parent android.Module) bool { + if _, ok := child.(java.AndroidLibraryDependency); ok && child.Name() != "framework-res" { + // Stubs of BCP and SSCP libraries should not have any dependencies on apps + // This check ensures that we do not run into circular dependencies when UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true + ctx.ModuleErrorf( + "Module %s is not a valid dependency of the stub library %s\n."+ + "If this dependency has been added via `libs` of java_sdk_library, please move it to `impl_only_libs`\n", + child.Name(), parent.Name()) + return false // error detected + } + return true + }) + } type genruleProps struct { @@ -90,10 +135,12 @@ type genruleProps struct { } type libraryProps struct { - Name *string - Sdk_version *string - Static_libs []string - Visibility []string + Name *string + Sdk_version *string + Static_libs []string + Visibility []string + Defaults []string + Is_stubs_module *bool } type fgProps struct { @@ -102,17 +149,12 @@ type fgProps struct { Visibility []string } -type Bazel_module struct { - Bp2build_available *bool -} -type bazelProperties struct { - *Bazel_module -} - -var bp2buildNotAvailable = bazelProperties{ - &Bazel_module{ - Bp2build_available: proptools.BoolPtr(false), - }, +type defaultsProps struct { + Name *string + Api_surface *string + Api_contributions []string + Defaults_visibility []string + Previous_api *string } // Struct to pass parameters for the various merged [current|removed].txt file modules we create. @@ -131,66 +173,70 @@ type MergedTxtDefinition struct { Scope string } -func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { +func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition, stubsTypeSuffix string, doDist bool) { metalavaCmd := "$(location metalava)" // Silence reflection warnings. See b/168689341 metalavaCmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " - metalavaCmd += " --quiet --no-banner --format=v2 " + metalavaCmd += " --quiet merge-signatures --format=v2 " filename := txt.TxtFilename if txt.Scope != "public" { filename = txt.Scope + "-" + filename } + moduleName := ctx.ModuleName() + stubsTypeSuffix + filename + props := genruleProps{} - props.Name = proptools.StringPtr(ctx.ModuleName() + "-" + filename) + props.Name = proptools.StringPtr(moduleName) props.Tools = []string{"metalava"} props.Out = []string{filename} - props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --api $(out)") + props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...) - props.Dists = []android.Dist{ - { - Targets: []string{"droidcore"}, - Dir: proptools.StringPtr("api"), - Dest: proptools.StringPtr(filename), - }, - { - Targets: []string{"api_txt", "sdk"}, - Dir: proptools.StringPtr("apistubs/android/" + txt.Scope + "/api"), - Dest: proptools.StringPtr(txt.DistFilename), - }, + if doDist { + props.Dists = []android.Dist{ + { + Targets: []string{"droidcore"}, + Dir: proptools.StringPtr("api"), + Dest: proptools.StringPtr(filename), + }, + { + Targets: []string{"api_txt", "sdk"}, + Dir: proptools.StringPtr("apistubs/android/" + txt.Scope + "/api"), + Dest: proptools.StringPtr(txt.DistFilename), + }, + } } props.Visibility = []string{"//visibility:public"} - ctx.CreateModule(genrule.GenRuleFactory, &props, &bp2buildNotAvailable) + ctx.CreateModule(genrule.GenRuleFactory, &props) } func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) { - for _, i := range []struct{ + for _, i := range []struct { name string tag string modules []string }{ { - name: "all-modules-public-annotations", - tag: "{.public.annotations.zip}", + name: "all-modules-public-annotations", + tag: "{.public.annotations.zip}", modules: modules, }, { - name: "all-modules-system-annotations", - tag: "{.system.annotations.zip}", + name: "all-modules-system-annotations", + tag: "{.system.annotations.zip}", modules: modules, }, { - name: "all-modules-module-lib-annotations", - tag: "{.module-lib.annotations.zip}", + name: "all-modules-module-lib-annotations", + tag: "{.module-lib.annotations.zip}", modules: modules, }, { - name: "all-modules-system-server-annotations", - tag: "{.system-server.annotations.zip}", + name: "all-modules-system-server-annotations", + tag: "{.system-server.annotations.zip}", modules: system_server_modules, }, } { props := fgProps{} props.Name = proptools.StringPtr(i.name) props.Srcs = createSrcs(i.modules, i.tag) - ctx.CreateModule(android.FileGroupFactory, &props, &bp2buildNotAvailable) + ctx.CreateModule(android.FileGroupFactory, &props) } } @@ -200,6 +246,17 @@ func createMergedPublicStubs(ctx android.LoadHookContext, modules []string) { props.Static_libs = transformArray(modules, "", ".stubs") props.Sdk_version = proptools.StringPtr("module_current") props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) + ctx.CreateModule(java.LibraryFactory, &props) +} + +func createMergedPublicExportableStubs(ctx android.LoadHookContext, modules []string) { + props := libraryProps{} + props.Name = proptools.StringPtr("all-modules-public-stubs-exportable") + props.Static_libs = transformArray(modules, "", ".stubs.exportable") + props.Sdk_version = proptools.StringPtr("module_current") + props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) ctx.CreateModule(java.LibraryFactory, &props) } @@ -212,6 +269,7 @@ func createMergedSystemStubs(ctx android.LoadHookContext, modules []string) { props.Static_libs = transformArray(updatable_modules, "", ".stubs.system") props.Sdk_version = proptools.StringPtr("module_current") props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) ctx.CreateModule(java.LibraryFactory, &props) } // Now merge all-updatable-modules-system-stubs and stubs from non-updatable modules @@ -223,6 +281,33 @@ func createMergedSystemStubs(ctx android.LoadHookContext, modules []string) { props.Static_libs = append(props.Static_libs, "all-updatable-modules-system-stubs") props.Sdk_version = proptools.StringPtr("module_current") props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) + ctx.CreateModule(java.LibraryFactory, &props) + } +} + +func createMergedSystemExportableStubs(ctx android.LoadHookContext, modules []string) { + // First create the all-updatable-modules-system-stubs + { + updatable_modules := removeAll(modules, non_updatable_modules) + props := libraryProps{} + props.Name = proptools.StringPtr("all-updatable-modules-system-stubs-exportable") + props.Static_libs = transformArray(updatable_modules, "", ".stubs.exportable.system") + props.Sdk_version = proptools.StringPtr("module_current") + props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) + ctx.CreateModule(java.LibraryFactory, &props) + } + // Now merge all-updatable-modules-system-stubs and stubs from non-updatable modules + // into all-modules-system-stubs. + { + props := libraryProps{} + props.Name = proptools.StringPtr("all-modules-system-stubs-exportable") + props.Static_libs = transformArray(non_updatable_modules, "", ".stubs.exportable.system") + props.Static_libs = append(props.Static_libs, "all-updatable-modules-system-stubs-exportable") + props.Sdk_version = proptools.StringPtr("module_current") + props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) ctx.CreateModule(java.LibraryFactory, &props) } } @@ -233,6 +318,17 @@ func createMergedTestStubsForNonUpdatableModules(ctx android.LoadHookContext) { props.Static_libs = transformArray(non_updatable_modules, "", ".stubs.test") props.Sdk_version = proptools.StringPtr("module_current") props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) + ctx.CreateModule(java.LibraryFactory, &props) +} + +func createMergedTestExportableStubsForNonUpdatableModules(ctx android.LoadHookContext) { + props := libraryProps{} + props.Name = proptools.StringPtr("all-non-updatable-modules-test-stubs-exportable") + props.Static_libs = transformArray(non_updatable_modules, "", ".stubs.exportable.test") + props.Sdk_version = proptools.StringPtr("module_current") + props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) ctx.CreateModule(java.LibraryFactory, &props) } @@ -266,14 +362,51 @@ func createMergedFrameworkImpl(ctx android.LoadHookContext, modules []string) { } } +func createMergedFrameworkModuleLibExportableStubs(ctx android.LoadHookContext, modules []string) { + // The user of this module compiles against the "core" SDK and against non-updatable modules, + // so remove to avoid dupes. + modules = removeAll(modules, core_libraries_modules) + modules = removeAll(modules, non_updatable_modules) + props := libraryProps{} + props.Name = proptools.StringPtr("framework-updatable-stubs-module_libs_api-exportable") + props.Static_libs = transformArray(modules, "", ".stubs.exportable.module_lib") + props.Sdk_version = proptools.StringPtr("module_current") + props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) + ctx.CreateModule(java.LibraryFactory, &props) +} + func createMergedFrameworkModuleLibStubs(ctx android.LoadHookContext, modules []string) { - // The user of this module compiles against the "core" SDK, so remove core libraries to avoid dupes. + // The user of this module compiles against the "core" SDK and against non-updatable modules, + // so remove to avoid dupes. modules = removeAll(modules, core_libraries_modules) + modules = removeAll(modules, non_updatable_modules) props := libraryProps{} props.Name = proptools.StringPtr("framework-updatable-stubs-module_libs_api") props.Static_libs = transformArray(modules, "", ".stubs.module_lib") props.Sdk_version = proptools.StringPtr("module_current") props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) + ctx.CreateModule(java.LibraryFactory, &props) +} + +func createMergedFrameworkSystemServerExportableStubs(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string) { + // The user of this module compiles against the "core" SDK and against non-updatable bootclasspathModules, + // so remove to avoid dupes. + bootclasspathModules := removeAll(bootclasspath, core_libraries_modules) + bootclasspathModules = removeAll(bootclasspath, non_updatable_modules) + modules := append( + // Include all the module-lib APIs from the bootclasspath libraries. + transformArray(bootclasspathModules, "", ".stubs.exportable.module_lib"), + // Then add all the system-server APIs from the service-* libraries. + transformArray(system_server_classpath, "", ".stubs.exportable.system_server")..., + ) + props := libraryProps{} + props.Name = proptools.StringPtr("framework-updatable-stubs-system_server_api-exportable") + props.Static_libs = modules + props.Sdk_version = proptools.StringPtr("system_server_current") + props.Visibility = []string{"//frameworks/base"} + props.Is_stubs_module = proptools.BoolPtr(true) ctx.CreateModule(java.LibraryFactory, &props) } @@ -282,10 +415,10 @@ func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules []str props.Name = proptools.StringPtr("all-modules-public-stubs-source") props.Srcs = createSrcs(modules, "{.public.stubs.source}") props.Visibility = []string{"//frameworks/base"} - ctx.CreateModule(android.FileGroupFactory, &props, &bp2buildNotAvailable) + ctx.CreateModule(android.FileGroupFactory, &props) } -func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string) { +func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string, baseTxtModulePrefix, stubsTypeSuffix string, doDist bool) { var textFiles []MergedTxtDefinition tagSuffix := []string{".api.txt}", ".removed-api.txt}"} @@ -294,7 +427,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-" + f, + BaseTxt: ":" + baseTxtModulePrefix + f, Modules: bootclasspath, ModuleTag: "{.public" + tagSuffix[i], Scope: "public", @@ -302,7 +435,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-system-" + f, + BaseTxt: ":" + baseTxtModulePrefix + "system-" + f, Modules: bootclasspath, ModuleTag: "{.system" + tagSuffix[i], Scope: "system", @@ -310,7 +443,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-module-lib-" + f, + BaseTxt: ":" + baseTxtModulePrefix + "module-lib-" + f, Modules: bootclasspath, ModuleTag: "{.module-lib" + tagSuffix[i], Scope: "module-lib", @@ -318,25 +451,26 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-system-server-" + f, + BaseTxt: ":" + baseTxtModulePrefix + "system-server-" + f, Modules: system_server_classpath, ModuleTag: "{.system-server" + tagSuffix[i], Scope: "system-server", }) } for _, txt := range textFiles { - createMergedTxt(ctx, txt) + createMergedTxt(ctx, txt, stubsTypeSuffix, doDist) } } func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { - bootclasspath := a.properties.Bootclasspath - system_server_classpath := a.properties.System_server_classpath + bootclasspath := a.bootclasspath(ctx) + system_server_classpath := a.systemServerClasspath(ctx) if ctx.Config().VendorConfig("ANDROID").Bool("include_nonpublic_framework_api") { bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) sort.Strings(bootclasspath) } - createMergedTxts(ctx, bootclasspath, system_server_classpath) + createMergedTxts(ctx, bootclasspath, system_server_classpath, "non-updatable-", "-", false) + createMergedTxts(ctx, bootclasspath, system_server_classpath, "non-updatable-exportable-", "-exportable-", true) createMergedPublicStubs(ctx, bootclasspath) createMergedSystemStubs(ctx, bootclasspath) @@ -344,6 +478,12 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { createMergedFrameworkModuleLibStubs(ctx, bootclasspath) createMergedFrameworkImpl(ctx, bootclasspath) + createMergedPublicExportableStubs(ctx, bootclasspath) + createMergedSystemExportableStubs(ctx, bootclasspath) + createMergedTestExportableStubsForNonUpdatableModules(ctx) + createMergedFrameworkModuleLibExportableStubs(ctx, bootclasspath) + createMergedFrameworkSystemServerExportableStubs(ctx, bootclasspath, system_server_classpath) + createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath) createPublicStubsSourceFilegroup(ctx, bootclasspath) @@ -354,55 +494,9 @@ func combinedApisModuleFactory() android.Module { module.AddProperties(&module.properties) android.InitAndroidModule(module) android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.createInternalModules(ctx) }) - android.InitBazelModule(module) return module } -type bazelCombinedApisAttributes struct { - Scope bazel.StringAttribute - Base bazel.LabelAttribute - Deps bazel.LabelListAttribute -} - -// combined_apis bp2build converter -func (a *CombinedApis) ConvertWithBp2build(ctx android.TopDownMutatorContext) { - basePrefix := "non-updatable" - scopeToSuffix := map[string]string{ - "public": "-current.txt", - "system": "-system-current.txt", - "module-lib": "-module-lib-current.txt", - "system-server": "-system-server-current.txt", - } - - for scopeName, suffix := range scopeToSuffix{ - name := a.Name() + suffix - - var scope bazel.StringAttribute - scope.SetValue(scopeName) - - var base bazel.LabelAttribute - base.SetValue(android.BazelLabelForModuleDepSingle(ctx, basePrefix+suffix)) - - var deps bazel.LabelListAttribute - classpath := a.properties.Bootclasspath - if scopeName == "system-server" { - classpath = a.properties.System_server_classpath - } - deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, classpath)) - - attrs := bazelCombinedApisAttributes{ - Scope: scope, - Base: base, - Deps: deps, - } - props := bazel.BazelTargetModuleProperties{ - Rule_class: "merged_txts", - Bzl_load_location: "//build/bazel/rules/java:merged_txts.bzl", - } - ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, &attrs) - } -} - // Various utility methods below. // Creates an array of ":<m><tag>" for each m in <modules>. diff --git a/api/api_test.go b/api/api_test.go index 15b695ca0d36..fb26f821eec1 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -1,4 +1,4 @@ -// Copyright (C) 2023 The Android Open Source Project +// Copyright (C) 2024 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,54 +15,245 @@ package api import ( + "android/soong/android" + "android/soong/java" + "fmt" "testing" - "android/soong/android" - "android/soong/bp2build" + "github.com/google/blueprint/proptools" ) -func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) { - t.Helper() - (&tc).ModuleTypeUnderTest = "combined_apis" - (&tc).ModuleTypeUnderTestFactory = combinedApisModuleFactory - bp2build.RunBp2BuildTestCase(t, registrationCtxFunc, tc) -} +var prepareForTestWithCombinedApis = android.GroupFixturePreparers( + android.FixtureRegisterWithContext(registerBuildComponents), + java.PrepareForTestWithJavaBuildComponents, + android.FixtureAddTextFile("a/Android.bp", gatherRequiredDepsForTest()), + java.PrepareForTestWithJavaSdkLibraryFiles, + android.FixtureMergeMockFs(android.MockFS{ + "a/api/current.txt": nil, + "a/api/removed.txt": nil, + "a/api/system-current.txt": nil, + "a/api/system-removed.txt": nil, + "a/api/test-current.txt": nil, + "a/api/test-removed.txt": nil, + "a/api/module-lib-current.txt": nil, + "a/api/module-lib-removed.txt": nil, + }), + android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { + variables.Allow_missing_dependencies = proptools.BoolPtr(true) + }), +) -func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { - t.Helper() - runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) {}) -} +func gatherRequiredDepsForTest() string { + var bp string + + extraLibraryModules := []string{ + "stable.core.platform.api.stubs", + "core-lambda-stubs", + "core.current.stubs", + "ext", + "framework", + "android_stubs_current", + "android_system_stubs_current", + "android_test_stubs_current", + "android_test_frameworks_core_stubs_current", + "android_module_lib_stubs_current", + "android_system_server_stubs_current", + "android_stubs_current.from-text", + "android_system_stubs_current.from-text", + "android_test_stubs_current.from-text", + "android_test_frameworks_core_stubs_current.from-text", + "android_module_lib_stubs_current.from-text", + "android_system_server_stubs_current.from-text", + "android_stubs_current.from-source", + "android_system_stubs_current.from-source", + "android_test_stubs_current.from-source", + "android_test_frameworks_core_stubs_current.from-source", + "android_module_lib_stubs_current.from-source", + "android_system_server_stubs_current.from-source", + "android_stubs_current_exportable.from-source", + "android_system_stubs_current_exportable.from-source", + "android_test_stubs_current_exportable.from-source", + "android_module_lib_stubs_current_exportable.from-source", + "android_system_server_stubs_current_exportable.from-source", + "stub-annotations", + } + + extraSdkLibraryModules := []string{ + "framework-virtualization", + "framework-location", + } + + extraSystemModules := []string{ + "core-public-stubs-system-modules", + "core-module-lib-stubs-system-modules", + "stable-core-platform-api-stubs-system-modules", + } + + extraFilegroupModules := []string{ + "non-updatable-current.txt", + "non-updatable-removed.txt", + "non-updatable-system-current.txt", + "non-updatable-system-removed.txt", + "non-updatable-test-current.txt", + "non-updatable-test-removed.txt", + "non-updatable-module-lib-current.txt", + "non-updatable-module-lib-removed.txt", + "non-updatable-system-server-current.txt", + "non-updatable-system-server-removed.txt", + "non-updatable-exportable-current.txt", + "non-updatable-exportable-removed.txt", + "non-updatable-exportable-system-current.txt", + "non-updatable-exportable-system-removed.txt", + "non-updatable-exportable-test-current.txt", + "non-updatable-exportable-test-removed.txt", + "non-updatable-exportable-module-lib-current.txt", + "non-updatable-exportable-module-lib-removed.txt", + "non-updatable-exportable-system-server-current.txt", + "non-updatable-exportable-system-server-removed.txt", + } + + for _, extra := range extraLibraryModules { + bp += fmt.Sprintf(` + java_library { + name: "%s", + srcs: ["a.java"], + sdk_version: "none", + system_modules: "stable-core-platform-api-stubs-system-modules", + compile_dex: true, + } + `, extra) + } + + for _, extra := range extraSdkLibraryModules { + bp += fmt.Sprintf(` + java_sdk_library { + name: "%s", + srcs: ["a.java"], + public: { + enabled: true, + }, + system: { + enabled: true, + }, + test: { + enabled: true, + }, + module_lib: { + enabled: true, + }, + api_packages: [ + "foo", + ], + sdk_version: "core_current", + compile_dex: true, + annotations_enabled: true, + } + `, extra) + } + + for _, extra := range extraFilegroupModules { + bp += fmt.Sprintf(` + filegroup { + name: "%[1]s", + } + `, extra) + } + + for _, extra := range extraSystemModules { + bp += fmt.Sprintf(` + java_system_modules { + name: "%[1]s", + libs: ["%[1]s-lib"], + } + java_library { + name: "%[1]s-lib", + sdk_version: "none", + system_modules: "none", + } + `, extra) + } -func TestCombinedApisGeneral(t *testing.T) { - runCombinedApisTestCase(t, bp2build.Bp2buildTestCase{ - Description: "combined_apis, general case", - Blueprint: `combined_apis { - name: "foo", - bootclasspath: ["bcp"], - system_server_classpath: ["ssc"], + bp += fmt.Sprintf(` + java_defaults { + name: "android.jar_defaults", + } + `) + + return bp } -`, - ExpectedBazelTargets: []string{ - bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ - "scope": `"public"`, - "base": `":non-updatable-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, - }), - bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-system-current.txt", bp2build.AttrNameToString{ - "scope": `"system"`, - "base": `":non-updatable-system-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, - }), - bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-module-lib-current.txt", bp2build.AttrNameToString{ - "scope": `"module-lib"`, - "base": `":non-updatable-module-lib-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, - }), - bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-system-server-current.txt", bp2build.AttrNameToString{ - "scope": `"system-server"`, - "base": `":non-updatable-system-server-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":ssc__BP2BUILD__MISSING__DEP"]`, - }), + +func TestCombinedApisDefaults(t *testing.T) { + + result := android.GroupFixturePreparers( + prepareForTestWithCombinedApis, + java.FixtureWithLastReleaseApis( + "framework-location", "framework-virtualization", "framework-foo", "framework-bar"), + android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { + variables.VendorVars = map[string]map[string]string{ + "boolean_var": { + "for_testing": "true", + }, + } + }), + ).RunTestWithBp(t, ` + java_sdk_library { + name: "framework-foo", + srcs: ["a.java"], + public: { + enabled: true, + }, + system: { + enabled: true, + }, + test: { + enabled: true, + }, + module_lib: { + enabled: true, }, - }) + api_packages: [ + "foo", + ], + sdk_version: "core_current", + annotations_enabled: true, + } + java_sdk_library { + name: "framework-bar", + srcs: ["a.java"], + public: { + enabled: true, + }, + system: { + enabled: true, + }, + test: { + enabled: true, + }, + module_lib: { + enabled: true, + }, + api_packages: [ + "foo", + ], + sdk_version: "core_current", + annotations_enabled: true, + } + + combined_apis { + name: "foo", + bootclasspath: [ + "framework-bar", + ] + select(boolean_var_for_testing(), { + true: [ + "framework-foo", + ], + default: [], + }), + } + `) + + subModuleDependsOnSelectAppendedModule := java.CheckModuleHasDependency(t, + result.TestContext, "foo-current.txt", "", "framework-foo") + android.AssertBoolEquals(t, "Submodule expected to depend on the select-appended module", + true, subModuleDependsOnSelectAppendedModule) } diff --git a/api/coverage/tools/Android.bp b/api/coverage/tools/Android.bp new file mode 100644 index 000000000000..caaca99bdc45 --- /dev/null +++ b/api/coverage/tools/Android.bp @@ -0,0 +1,53 @@ +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +java_binary_host { + name: "extract-flagged-apis", + srcs: ["ExtractFlaggedApis.kt"], + main_class: "android.platform.coverage.ExtractFlaggedApisKt", + static_libs: [ + "metalava-signature-reader", + "extract_flagged_apis_proto", + ], +} + +java_library_host { + name: "extract_flagged_apis_proto", + srcs: ["extract_flagged_apis.proto"], + static_libs: ["libprotobuf-java-full"], + proto: { + type: "full", + }, +} + +java_test_host { + name: "extract-flagged-apis-test", + srcs: ["ExtractFlaggedApisTest.kt"], + libs: [ + "extract_flagged_apis_proto", + "junit", + "libprotobuf-java-full", + ], + static_libs: [ + "truth", + "truth-liteproto-extension", + "truth-proto-extension", + ], + data: [ + ":extract-flagged-apis", + ], + test_options: { + unit_test: true, + }, +} diff --git a/api/coverage/tools/ExtractFlaggedApis.kt b/api/coverage/tools/ExtractFlaggedApis.kt new file mode 100644 index 000000000000..0a3ae4f790b0 --- /dev/null +++ b/api/coverage/tools/ExtractFlaggedApis.kt @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.platform.coverage + +import com.android.tools.metalava.model.CallableItem +import com.android.tools.metalava.model.ClassItem +import com.android.tools.metalava.model.Item +import com.android.tools.metalava.model.text.ApiFile +import java.io.File +import java.io.FileWriter + +/** Usage: extract-flagged-apis <api text file> <output .pb file> */ +fun main(args: Array<String>) { + val cb = ApiFile.parseApi(listOf(File(args[0]))) + val builder = FlagApiMap.newBuilder() + for (pkg in cb.getPackages().packages) { + val packageName = pkg.qualifiedName() + pkg.allClasses().forEach { + extractFlaggedApisFromClass(it, it.methods(), packageName, builder) + extractFlaggedApisFromClass(it, it.constructors(), packageName, builder) + } + } + val flagApiMap = builder.build() + FileWriter(args[1]).use { it.write(flagApiMap.toString()) } +} + +fun extractFlaggedApisFromClass( + classItem: ClassItem, + callables: List<CallableItem>, + packageName: String, + builder: FlagApiMap.Builder +) { + if (callables.isEmpty()) return + val classFlag = getClassFlag(classItem) + for (callable in callables) { + val callableFlag = getFlagAnnotation(callable) ?: classFlag + val api = + JavaMethod.newBuilder() + .setPackageName(packageName) + .setClassName(classItem.fullName()) + .setMethodName(callable.name()) + for (param in callable.parameters()) { + api.addParameters(param.type().toTypeString()) + } + if (callableFlag != null) { + addFlaggedApi(builder, api, callableFlag) + } + } +} + +fun addFlaggedApi(builder: FlagApiMap.Builder, api: JavaMethod.Builder, flag: String) { + if (builder.containsFlagToApi(flag)) { + val updatedApis = builder.getFlagToApiOrThrow(flag).toBuilder().addJavaMethods(api).build() + builder.putFlagToApi(flag, updatedApis) + } else { + val apis = FlaggedApis.newBuilder().addJavaMethods(api).build() + builder.putFlagToApi(flag, apis) + } +} + +fun getClassFlag(classItem: ClassItem): String? { + var classFlag = getFlagAnnotation(classItem) + var cur = classItem + // If a class is not a nested class, use its @FlaggedApi annotation value. + // Otherwise, use the flag value of the closest outer class that is annotated by @FlaggedApi. + while (classFlag == null) { + cur = cur.containingClass() ?: break + classFlag = getFlagAnnotation(cur) + } + return classFlag +} + +fun getFlagAnnotation(item: Item): String? { + return item.modifiers + .findAnnotation("android.annotation.FlaggedApi") + ?.findAttribute("value") + ?.value + ?.value() as? String +} diff --git a/api/coverage/tools/ExtractFlaggedApisTest.kt b/api/coverage/tools/ExtractFlaggedApisTest.kt new file mode 100644 index 000000000000..427be36254d3 --- /dev/null +++ b/api/coverage/tools/ExtractFlaggedApisTest.kt @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.platform.coverage + +import com.google.common.truth.extensions.proto.ProtoTruth.assertThat +import com.google.protobuf.TextFormat +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardOpenOption +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(JUnit4::class) +class ExtractFlaggedApisTest { + + companion object { + const val COMMAND = "java -jar extract-flagged-apis.jar %s %s" + } + + private var apiTextFile: Path = Files.createTempFile("current", ".txt") + private var flagToApiMap: Path = Files.createTempFile("flag_api_map", ".textproto") + + @Before + fun setup() { + apiTextFile = Files.createTempFile("current", ".txt") + flagToApiMap = Files.createTempFile("flag_api_map", ".textproto") + } + + @After + fun cleanup() { + Files.deleteIfExists(apiTextFile) + Files.deleteIfExists(flagToApiMap) + } + + @Test + fun extractFlaggedApis_onlyMethodFlag_useMethodFlag() { + val apiText = + """ + // Signature format: 2.0 + package android.net.ipsec.ike { + public final class IkeSession implements java.lang.AutoCloseable { + method @FlaggedApi("com.android.ipsec.flags.dumpsys_api") public void dump(@NonNull java.io.PrintWriter); + } + } + """ + .trimIndent() + Files.write(apiTextFile, apiText.toByteArray(Charsets.UTF_8), StandardOpenOption.APPEND) + + val process = Runtime.getRuntime().exec(createCommand()) + process.waitFor() + + val content = Files.readAllBytes(flagToApiMap).toString(Charsets.UTF_8) + val result = TextFormat.parse(content, FlagApiMap::class.java) + + val expected = FlagApiMap.newBuilder() + val api = + JavaMethod.newBuilder() + .setPackageName("android.net.ipsec.ike") + .setClassName("IkeSession") + .setMethodName("dump") + api.addParameters("java.io.PrintWriter") + addFlaggedApi(expected, api, "com.android.ipsec.flags.dumpsys_api") + assertThat(result).isEqualTo(expected.build()) + } + + @Test + fun extractFlaggedApis_onlyClassFlag_useClassFlag() { + val apiText = + """ + // Signature format: 2.0 + package android.net.ipsec.ike { + @FlaggedApi("com.android.ipsec.flags.dumpsys_api") public final class IkeSession implements java.lang.AutoCloseable { + method public void dump(@NonNull java.io.PrintWriter); + } + } + """ + .trimIndent() + Files.write(apiTextFile, apiText.toByteArray(Charsets.UTF_8), StandardOpenOption.APPEND) + + val process = Runtime.getRuntime().exec(createCommand()) + process.waitFor() + + val content = Files.readAllBytes(flagToApiMap).toString(Charsets.UTF_8) + val result = TextFormat.parse(content, FlagApiMap::class.java) + + val expected = FlagApiMap.newBuilder() + val api = + JavaMethod.newBuilder() + .setPackageName("android.net.ipsec.ike") + .setClassName("IkeSession") + .setMethodName("dump") + api.addParameters("java.io.PrintWriter") + addFlaggedApi(expected, api, "com.android.ipsec.flags.dumpsys_api") + assertThat(result).isEqualTo(expected.build()) + } + + @Test + fun extractFlaggedApis_flaggedConstructorsAreFlaggedApis() { + val apiText = + """ + // Signature format: 2.0 + package android.app.pinner { + @FlaggedApi("android.app.pinner_service_client_api") public class PinnerServiceClient { + ctor @FlaggedApi("android.app.pinner_service_client_api") public PinnerServiceClient(); + } + } + """ + .trimIndent() + Files.write(apiTextFile, apiText.toByteArray(Charsets.UTF_8), StandardOpenOption.APPEND) + + val process = Runtime.getRuntime().exec(createCommand()) + process.waitFor() + + val content = Files.readAllBytes(flagToApiMap).toString(Charsets.UTF_8) + val result = TextFormat.parse(content, FlagApiMap::class.java) + + val expected = FlagApiMap.newBuilder() + val api = + JavaMethod.newBuilder() + .setPackageName("android.app.pinner") + .setClassName("PinnerServiceClient") + .setMethodName("PinnerServiceClient") + addFlaggedApi(expected, api, "android.app.pinner_service_client_api") + assertThat(result).isEqualTo(expected.build()) + } + + @Test + fun extractFlaggedApis_unflaggedNestedClassShouldUseOuterClassFlag() { + val apiText = + """ + // Signature format: 2.0 + package android.location.provider { + @FlaggedApi(Flags.FLAG_NEW_GEOCODER) public final class ForwardGeocodeRequest implements android.os.Parcelable { + method public int describeContents(); + } + public static final class ForwardGeocodeRequest.Builder { + method @NonNull public android.location.provider.ForwardGeocodeRequest build(); + } + } + """ + .trimIndent() + Files.write(apiTextFile, apiText.toByteArray(Charsets.UTF_8), StandardOpenOption.APPEND) + + val process = Runtime.getRuntime().exec(createCommand()) + process.waitFor() + + val content = Files.readAllBytes(flagToApiMap).toString(Charsets.UTF_8) + val result = TextFormat.parse(content, FlagApiMap::class.java) + + val expected = FlagApiMap.newBuilder() + val api1 = + JavaMethod.newBuilder() + .setPackageName("android.location.provider") + .setClassName("ForwardGeocodeRequest") + .setMethodName("describeContents") + addFlaggedApi(expected, api1, "Flags.FLAG_NEW_GEOCODER") + val api2 = + JavaMethod.newBuilder() + .setPackageName("android.location.provider") + .setClassName("ForwardGeocodeRequest.Builder") + .setMethodName("build") + addFlaggedApi(expected, api2, "Flags.FLAG_NEW_GEOCODER") + assertThat(result).ignoringRepeatedFieldOrder().isEqualTo(expected.build()) + } + + @Test + fun extractFlaggedApis_unflaggedNestedClassShouldUseOuterClassFlag_deeplyNested() { + val apiText = + """ + // Signature format: 2.0 + package android.package.xyz { + @FlaggedApi(outer_class_flag) public final class OuterClass { + method public int apiInOuterClass(); + } + public final class OuterClass.Deeply.NestedClass { + method public void apiInNestedClass(); + } + } + """ + .trimIndent() + Files.write(apiTextFile, apiText.toByteArray(Charsets.UTF_8), StandardOpenOption.APPEND) + + val process = Runtime.getRuntime().exec(createCommand()) + process.waitFor() + + val content = Files.readAllBytes(flagToApiMap).toString(Charsets.UTF_8) + val result = TextFormat.parse(content, FlagApiMap::class.java) + + val expected = FlagApiMap.newBuilder() + val api1 = + JavaMethod.newBuilder() + .setPackageName("android.package.xyz") + .setClassName("OuterClass") + .setMethodName("apiInOuterClass") + addFlaggedApi(expected, api1, "outer_class_flag") + val api2 = + JavaMethod.newBuilder() + .setPackageName("android.package.xyz") + .setClassName("OuterClass.Deeply.NestedClass") + .setMethodName("apiInNestedClass") + addFlaggedApi(expected, api2, "outer_class_flag") + assertThat(result).ignoringRepeatedFieldOrder().isEqualTo(expected.build()) + } + + private fun addFlaggedApi(builder: FlagApiMap.Builder, api: JavaMethod.Builder, flag: String) { + if (builder.containsFlagToApi(flag)) { + val updatedApis = + builder.getFlagToApiOrThrow(flag).toBuilder().addJavaMethods(api).build() + builder.putFlagToApi(flag, updatedApis) + } else { + val apis = FlaggedApis.newBuilder().addJavaMethods(api).build() + builder.putFlagToApi(flag, apis) + } + } + + private fun createCommand(): Array<String> { + val command = + String.format(COMMAND, apiTextFile.toAbsolutePath(), flagToApiMap.toAbsolutePath()) + return command.split(" ").toTypedArray() + } +} diff --git a/api/coverage/tools/extract_flagged_apis.proto b/api/coverage/tools/extract_flagged_apis.proto new file mode 100644 index 000000000000..4db2a8b03de5 --- /dev/null +++ b/api/coverage/tools/extract_flagged_apis.proto @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +syntax = "proto3"; + +package android.platform.coverage; + +option java_multiple_files = true; + +message FlagApiMap { + map<string, FlaggedApis> flag_to_api = 1; +} + +message FlaggedApis { + repeated JavaMethod java_methods = 1; +} + +message JavaMethod { + string package_name = 1; + string class_name = 2; + string method_name = 3; + repeated string parameters = 4; +} + diff --git a/api/gen_combined_removed_dex.sh b/api/gen_combined_removed_dex.sh index 9225fe8dfe85..2860e2ed17c2 100755 --- a/api/gen_combined_removed_dex.sh +++ b/api/gen_combined_removed_dex.sh @@ -6,6 +6,6 @@ shift 2 # Convert each removed.txt to the "dex format" equivalent, and print all output. for f in "$@"; do - "$metalava_path" --no-banner "$f" --dex-api "${tmp_dir}/tmp" + "$metalava_path" signature-to-dex "$f" --out "${tmp_dir}/tmp" cat "${tmp_dir}/tmp" done diff --git a/api/go.mod b/api/go.mod new file mode 100644 index 000000000000..445a6f4a5ec6 --- /dev/null +++ b/api/go.mod @@ -0,0 +1,10 @@ +module android/soong/aidl + +go 1.18 + +require ( + android/soong v0.0.0 + github.com/google/blueprint v0.0.0 + google.golang.org/protobuf v0.0.0 + go.starlark.net v0.0.0 +) diff --git a/api/go.work b/api/go.work new file mode 100644 index 000000000000..c09bee578b61 --- /dev/null +++ b/api/go.work @@ -0,0 +1,17 @@ +go 1.22 + +use ( + . + ../../../build/blueprint + ../../../build/soong + ../../../external/go-cmp + ../../../external/golang-protobuf +) + +replace ( + android/soong v0.0.0 => ../../../build/soong + github.com/google/blueprint v0.0.0 => ../../../build/blueprint + github.com/google/go-cmp v0.0.0 => ../../../external/go-cmp + go.starlark.net v0.0.0 => ../../../external/starlark-go + google.golang.org/protobuf v0.0.0 => ../../../external/golang-protobuf +) diff --git a/api/go.work.sum b/api/go.work.sum new file mode 100644 index 000000000000..d00184fa2aa5 --- /dev/null +++ b/api/go.work.sum @@ -0,0 +1,66 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/api/javadoc-lint-baseline b/api/javadoc-lint-baseline new file mode 100644 index 000000000000..79927020d5ea --- /dev/null +++ b/api/javadoc-lint-baseline @@ -0,0 +1,60 @@ +// b/303582215 +android/hardware/camera2/CameraCharacteristics.java:2169: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#stream-use-case-capability-additional-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2344: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#concurrent-stream-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2344: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#concurrent-stream-guaranteed-configurations tables" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2361: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#additional-guaranteed-combinations-for-ultra-high-resolution-sensors guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2361: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#additional-guaranteed-combinations-for-ultra-high-resolution-sensors tables" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2361: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#legacy-level-guaranteed-configurations" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2390: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#preview-stabilization-guaranteed-stream-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2390: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#preview-stabilization-guaranteed-stream-configurations tables" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2402: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#legacy-level-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2402: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#legacy-level-guaranteed-configurations tables" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2445: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#10-bit-output-additional-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2445: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#10-bit-output-additional-guaranteed-configurations tables" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2473: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#legacy-level-additional-guaranteed-combinations-with-multiresolutionoutputs" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2473: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#stream-use-case-capability-additional-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraCharacteristics.java:2473: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#stream-use-case-capability-additional-guaranteed-configurations tables" in android.hardware.camera2.CameraCharacteristics [101] +android/hardware/camera2/CameraMetadata.java:1934: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#level-3-additional-guaranteed-configurations" in android.hardware.camera2.CameraMetadata [101] +android/hardware/camera2/CameraMetadata.java:1980: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#full-level-additional-guaranteed-configurations" in android.hardware.camera2.CameraMetadata [101] +android/hardware/camera2/CameraMetadata.java:2019: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#legacy-level-guaranteed-configurations" in android.hardware.camera2.CameraMetadata [101] +android/hardware/camera2/CameraMetadata.java:2038: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#limited-level-additional-guaranteed-configurations" in android.hardware.camera2.CameraMetadata [101] +android/hardware/camera2/CameraMetadata.java:2533: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#10-bit-output-additional-guaranteed-configurations" in android.hardware.camera2.CameraMetadata [101] +android/hardware/camera2/CameraMetadata.java:3095: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#stream-use-case-capability-additional-guaranteed-configurations" in android.hardware.camera2.CameraMetadata [101] +android/hardware/camera2/CaptureRequest.java:704: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureRequest [101] +android/hardware/camera2/CaptureRequest.java:1501: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureRequest [101] +android/hardware/camera2/CaptureResult.java:923: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureResult [101] +android/hardware/camera2/CaptureResult.java:2337: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureResult [101] + +// These are javadoc errors for @ChangeId constants, which are problematic to generate documentation +// for. They're not necessarily errors in the docs themselves but are also a limitation in the tool. +// Regardless, the docs currently generated for them is not good, but it is also not used directly +// in production at the moment. +// The main limitation is that all references must be fully qualified in order to resolve properly +// (aside from the normal limitatinos of only being able to @link public APIs). +// See the CompatInfo.java source file in doclava for more information. +android/net/wifi/SoftApConfiguration.java:171: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setShutdownTimeoutMillis(long)" in android.net.wifi.SoftApConfiguration [101] +android/os/UserManager.java:2384: lint: Unresolved link/see tag "android.annotation.UserHandleAware#enabledSinceTargetSdkVersion" in android.os.UserManager [101] +android/os/UserManager.java:2384: lint: Unresolved link/see tag "android.annotation.UserHandleAware @UserHandleAware" in android.os.UserManager [101] +android/service/voice/AlwaysOnHotwordDetector.java:269: lint: Unresolved link/see tag "#initialize( PersistableBundle, SharedMemory, SoundTrigger.ModuleProperties)" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:269: lint: Unresolved link/see tag "STATE_HARDWARE_UNAVAILABLE" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "android.service.voice.AlwaysOnHotwordDetector.Callback#onFailure" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "android.service.voice.AlwaysOnHotwordDetector.Callback#onUnknownFailure" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "android.service.voice.AlwaysOnHotwordDetector#STATE_ERROR" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "Callback#onFailure" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "Callback#onUnknownFailure" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "#STATE_ERROR" in android [101] +com/android/internal/policy/PhoneWindow.java:172: lint: Unresolved link/see tag "Build.VERSION_CODES#VANILLA_ICE_CREAM" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:70: lint: Unresolved link/see tag "IdentifierType#DAB_SID_EXT" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:70: lint: Unresolved link/see tag "ProgramSelector#IDENTIFIER_TYPE_DAB_DMB_SID_EXT" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:70: lint: Unresolved link/see tag "RadioTuner" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:72: lint: Unresolved link/see tag "com.android.server.broadcastradio.aidl.IdentifierType#DAB_SID_EXT" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:72: lint: Unresolved link/see tag "com.android.server.broadcastradio.aidl.ProgramSelector#IDENTIFIER_TYPE_DAB_DMB_SID_EXT" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:72: lint: Unresolved link/see tag "com.android.server.broadcastradio.aidl.RadioTuner" in android [101] +com/android/server/devicepolicy/DevicePolicyManagerService.java:861: lint: Unresolved link/see tag "android.security.IKeyChainService#setGrant" in android [101] +com/android/server/pm/PackageInstallerSession.java:313: lint: Unresolved link/see tag "Build.VERSION_CODES#S API 31" in android [101] +com/android/server/pm/PackageInstallerSession.java:313: lint: Unresolved link/see tag "PackageInstaller.SessionParams#setRequireUserAction" in android [101] +com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "Build.VERSION_CODES#UPSIDE_DOWN_CAKE API 34" in android [101] +com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "PackageInstaller.SessionParams#setRequestUpdateOwnership(boolean)" in android [101] +com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "#requestUserPreapproval(PreapprovalDetails, IntentSender)" in android [101] +com/android/server/pm/PackageInstallerSession.java:330: lint: Unresolved link/see tag "com.android.android.server.pm#requestUserPreapproval(PreapprovalDetails, IntentSender)" in android [101] +com/android/server/pm/PackageInstallerSession.java:358: lint: Unresolved link/see tag "IntentSender" in android [101]
\ No newline at end of file |