From df6c25d518484e60477add216e597c54d3ca4b3c Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Tue, 20 Aug 2019 20:48:47 +0900 Subject: [PATCH 1/2] Remove -without-aidls filegroups for the media apex. When there is no *.aidl file in a filegroup, include path for the aidl compiler is not set to the path property of the filegroup. This blocks the plan to cut the dependency from API stubs libs to the framework, because then we have to rely on the include paths deducted from the input filegroups, rather than AIDL include paths exported from the framework. To make that happen, this change first removes the *-without-aidls filegroups and replace the reference to them with the corresponding file groups having AIDLs. Adding the AIDL files for media apex to the API stubs is fine because the AIDL files are @hidden ones. Bug: 70046217 Bug: 135922046 Test: m Exempt-From-Owner-Approval: Approved internally Merged-In: I794f6d0a7bcbef311d345d6e18ca311800af8ef4 (cherry picked from commit d2411f730f6d143d00b605312e632d0e41d9f632) Change-Id: I794f6d0a7bcbef311d345d6e18ca311800af8ef4 --- Android.bp | 4 ++-- media/Android.bp | 23 +++-------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/Android.bp b/Android.bp index 8a2c78b5186f8..379eedbfb3ee5 100644 --- a/Android.bp +++ b/Android.bp @@ -877,7 +877,7 @@ stubs_defaults { ":opt-telephony-srcs", ":opt-net-voip-srcs", ":core_public_api_files", - ":updatable-media-srcs-without-aidls", + ":updatable-media-srcs", "test-mock/src/**/*.java", "test-runner/src/**/*.java", ], @@ -940,7 +940,7 @@ stubs_defaults { ":opt-telephony-srcs", ":opt-net-voip-srcs", ":core_public_api_files", - ":updatable-media-srcs-without-aidls", + ":updatable-media-srcs", ], srcs_lib: "framework", srcs_lib_whitelist_pkgs: packages_to_document, diff --git a/media/Android.bp b/media/Android.bp index 4f9671f9936bf..6fa01bfa12937 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -42,13 +42,6 @@ filegroup { ], } -filegroup { - name: "updatable-media-srcs-without-aidls", - srcs : [ - ":mediasession2-srcs-without-aidls", - ], -} - filegroup { name: "mediasession2-srcs", srcs: [ @@ -67,18 +60,6 @@ filegroup { ], } -filegroup { - name: "mediasession2-srcs-without-aidls", - srcs: [ - ":mediasession2-srcs", - ], - exclude_srcs: [ - "apex/java/android/media/IMediaController2.aidl", - "apex/java/android/media/IMediaSession2.aidl", - "apex/java/android/media/IMediaSession2Service.aidl", - ], -} - filegroup { name: "mediaplayer2-srcs", srcs: [ @@ -96,6 +77,7 @@ filegroup { "apex/java/android/media/BufferingParams.java", "apex/java/android/media/ProxyDataSourceCallback.java", ], + path: "apex/java", } metalava_updatable_media_args = " --error UnhiddenSystemApi " + @@ -108,7 +90,7 @@ metalava_updatable_media_args = " --error UnhiddenSystemApi " + droidstubs { name: "updatable-media-stubs", srcs: [ - ":updatable-media-srcs-without-aidls", + ":updatable-media-srcs", ":framework-media-annotation-srcs", ], args: metalava_updatable_media_args, @@ -120,6 +102,7 @@ droidstubs { java_library { name: "updatable_media_stubs", srcs: [":updatable-media-stubs"], + // Ideally, sdk_version here should be "current_system", but "current - 1" is used // to avoid dependency cycle with framework. sdk_version: "28", From 5366ea2089e4e9e30514c3743f21431d8496e2b6 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 19 Aug 2019 15:24:49 +0900 Subject: [PATCH 2/2] Cut the dependency to framework from droiddoc modules droiddoc modules for the SDK API documentation and stubs library generations have depended on the 'framework' (which was recently changed to framework-minus-apex' module to get the list of Java source files to be processed. This however caused a circular dependency when we tried to modularize some classes in the framework library as a separate library. The separate java library depended on the stubs library (because it should only use SDK APIs) and the stubs library depended on the framework library. The framework library itself depended on the separated library (or its stub) to use APIs from the separated library, thus forming a circular dependency. This change fixes the problem by directly giving the framework source files via a filegroup `framework-sources-to-document` where all Java and AIDL files that are to be documented are included in. This change also put the generated R.java and Manifest.java files from framework-res into the filegroup for framework sources. Bug: 70046217 Bug: 135922046 Test: m Exempt-From-Owner-Approval: Approved internally Merged-In: I09ad88da47540d31ad089aad5e1151a4b6877ec2 (cherry picked from commit 20426538f85098552f52dffb40d0f7ffff7946d4) Change-Id: I09ad88da47540d31ad089aad5e1151a4b6877ec2 --- Android.bp | 169 +++++++++++++++++++----------------- core/java/com/package.html | 8 ++ location/lib/Android.bp | 9 +- media/Android.bp | 14 +-- media/lib/signer/Android.bp | 7 +- test-mock/Android.bp | 8 +- 6 files changed, 118 insertions(+), 97 deletions(-) create mode 100644 core/java/com/package.html diff --git a/Android.bp b/Android.bp index 379eedbfb3ee5..56adbe003da17 100644 --- a/Android.bp +++ b/Android.bp @@ -162,49 +162,54 @@ filegroup { path: "wifi/java", } -framework_srcs = [ - // Java/AIDL sources under frameworks/base - ":framework-core-sources", - ":framework-drm-sources", - ":framework-graphics-sources", - ":framework-keystore-sources", - ":framework-location-sources", - ":framework-lowpan-sources", - ":framework-media-sources", - ":framework-mca-effect-sources", - ":framework-mca-filterfw-sources", - ":framework-mca-filterpacks-sources", - ":framework-opengl-sources", - ":framework-rs-sources", - ":framework-sax-sources", - ":framework-telecomm-sources", - ":framework-telephony-sources", - ":framework-wifi-sources", - ":PacProcessor-aidl-sources", - ":ProxyHandler-aidl-sources", +filegroup { + name: "framework-srcs", + srcs: [ + // Java/AIDL sources under frameworks/base + ":framework-core-sources", + ":framework-drm-sources", + ":framework-graphics-sources", + ":framework-keystore-sources", + ":framework-location-sources", + ":framework-lowpan-sources", + ":framework-media-sources", + ":framework-mca-effect-sources", + ":framework-mca-filterfw-sources", + ":framework-mca-filterpacks-sources", + ":framework-opengl-sources", + ":framework-rs-sources", + ":framework-sax-sources", + ":framework-telecomm-sources", + ":framework-telephony-sources", + ":framework-wifi-sources", + ":PacProcessor-aidl-sources", + ":ProxyHandler-aidl-sources", - // AIDL sources from external directories - ":dumpstate_aidl", - ":framework_native_aidl", - ":gatekeeper_aidl", - ":gsiservice_aidl", - ":incidentcompanion_aidl", - ":installd_aidl", - ":keystore_aidl", - ":libaudioclient_aidl", - ":libbinder_aidl", - ":libbluetooth-binder-aidl", - ":libcamera_client_aidl", - ":libcamera_client_framework_aidl", - ":libupdate_engine_aidl", - ":storaged_aidl", - ":vold_aidl", + // AIDL sources from external directories + ":dumpstate_aidl", + ":framework_native_aidl", + ":gatekeeper_aidl", + ":gsiservice_aidl", + ":incidentcompanion_aidl", + ":installd_aidl", + ":keystore_aidl", + ":libaudioclient_aidl", + ":libbinder_aidl", + ":libbluetooth-binder-aidl", + ":libcamera_client_aidl", + ":libcamera_client_framework_aidl", + ":libupdate_engine_aidl", + ":storaged_aidl", + ":vold_aidl", - // etc. - "core/java/**/*.logtags", - ":framework-javastream-protos", - ":framework-statslog-gen", -] + // For the generated R.java and Manifest.java + ":framework-res{.aapt.srcjar}", + + // etc. + ":framework-javastream-protos", + ":framework-statslog-gen", + ], +} java_defaults { name: "framework-aidl-export-defaults", @@ -231,30 +236,10 @@ java_defaults { }, } -java_defaults { - name: "framework-defaults", - defaults: ["framework-aidl-export-defaults"], - installable: true, - - srcs: framework_srcs, - - aidl: { - generate_get_transaction_name: true, - }, - - exclude_srcs: [ - // See comment on framework-atb-backward-compatibility module below - "core/java/android/content/pm/AndroidTestBaseUpdater.java", - ], - - sdk_version: "core_platform", - libs: [ - "ext", - "updatable_media_stubs", - ], - - jarjar_rules: ":framework-jarjar-rules", - +// Collection of classes that are generated from non-Java files that are not listed in +// framework_srcs. These have no or very limited dependency to the framework. +java_library { + name: "framework-internal-utils", static_libs: [ "mimemap", "apex_aidl_interface-java", @@ -290,6 +275,38 @@ java_defaults { "com.android.sysprop.apex", "PlatformProperties", ], + sdk_version: "core_platform", + installable: false, +} + +java_defaults { + name: "framework-defaults", + defaults: ["framework-aidl-export-defaults"], + installable: true, + + srcs: [ + ":framework-srcs", + "core/java/**/*.logtags", + ], + + aidl: { + generate_get_transaction_name: true, + }, + + exclude_srcs: [ + // See comment on framework-atb-backward-compatibility module below + "core/java/android/content/pm/AndroidTestBaseUpdater.java", + ], + + sdk_version: "core_platform", + libs: [ + "ext", + "updatable_media_stubs", + ], + + jarjar_rules: ":framework-jarjar-rules", + + static_libs: ["framework-internal-utils"], required: [ // TODO: remove gps_debug when the build system propagates "required" properly. @@ -746,7 +763,7 @@ python_binary_host { ], } -// TODO: Don't rely on this list once droiddoc can take a list of packages to document +// TODO: Don't rely on this list by switching package.html into package-info.java frameworks_base_subdirs = [ "core/java", "graphics/java", @@ -766,13 +783,6 @@ frameworks_base_subdirs = [ "rs/java", ] -packages_to_document = [ - "android", - "javax/microedition/khronos", - "org/apache/http/conn", - "org/apache/http/params", -] - // Make the api/current.txt file available for use by modules in other // directories. filegroup { @@ -873,6 +883,8 @@ metalava_framework_docs_args += " --replace-documentation " + stubs_defaults { name: "framework-doc-stubs-default", srcs: [ + ":framework-srcs", + "core/java/**/*.logtags", "test-base/src/**/*.java", ":opt-telephony-srcs", ":opt-net-voip-srcs", @@ -881,8 +893,6 @@ stubs_defaults { "test-mock/src/**/*.java", "test-runner/src/**/*.java", ], - srcs_lib: "framework", - srcs_lib_whitelist_pkgs: packages_to_document, libs: framework_docs_only_libs, local_sourcepaths: frameworks_base_subdirs, create_doc_stubs: true, @@ -937,13 +947,14 @@ doc_defaults { stubs_defaults { name: "metalava-api-stubs-default", srcs: [ + ":framework-srcs", + "core/java/**/*.logtags", ":opt-telephony-srcs", ":opt-net-voip-srcs", ":core_public_api_files", ":updatable-media-srcs", ], - srcs_lib: "framework", - srcs_lib_whitelist_pkgs: packages_to_document, + libs: ["framework-internal-utils"], local_sourcepaths: frameworks_base_subdirs, installable: false, annotations_enabled: true, @@ -957,6 +968,7 @@ stubs_defaults { "sdk-dir", "api-versions-jars-dir", ], + sdk_version: "core_platform", } droidstubs { @@ -1320,6 +1332,7 @@ droidstubs { ":openjdk_java_files", ":opt-telephony-common-srcs", ], + arg_files: [ "core/res/AndroidManifest.xml", ], @@ -1454,7 +1467,7 @@ filegroup { // annotations to private apis aidl_mapping { name: "framework-aidl-mappings", - srcs: framework_srcs, + srcs: [":framework-srcs"], output: "framework-aidl-mappings.txt", } diff --git a/core/java/com/package.html b/core/java/com/package.html new file mode 100644 index 0000000000000..8f35da9a81586 --- /dev/null +++ b/core/java/com/package.html @@ -0,0 +1,8 @@ + + + + {@hide} + + diff --git a/location/lib/Android.bp b/location/lib/Android.bp index 1bf5221b1dc13..349b9e0637843 100644 --- a/location/lib/Android.bp +++ b/location/lib/Android.bp @@ -16,10 +16,9 @@ java_sdk_library { name: "com.android.location.provider", - srcs: ["java/**/*.java"], + srcs: [ + "java/**/*.java", + ":framework-srcs", + ], api_packages: ["com.android.location.provider"], - srcs_lib: "framework", - // TODO(b/70046217): remove core/java and android below. It was added to provide definitions for - // types like android.os.Bundle - srcs_lib_whitelist_pkgs: ["android", "com.android.internal.location"], } diff --git a/media/Android.bp b/media/Android.bp index 6fa01bfa12937..25aef76a8fe6e 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -58,6 +58,7 @@ filegroup { "apex/java/android/media/Session2Link.java", "apex/java/android/media/Session2Token.java", ], + path: "apex/java", } filegroup { @@ -94,18 +95,17 @@ droidstubs { ":framework-media-annotation-srcs", ], args: metalava_updatable_media_args, - // Ideally, sdk_version here should be "current_system", but "current - 1" is used - // to avoid dependency cycle with framework. - sdk_version: "28", + aidl: { + // TODO(b/135922046) remove this + include_dirs: ["frameworks/base/core/java"], + }, + sdk_version: "system_current", } java_library { name: "updatable_media_stubs", srcs: [":updatable-media-stubs"], - - // Ideally, sdk_version here should be "current_system", but "current - 1" is used - // to avoid dependency cycle with framework. - sdk_version: "28", + sdk_version: "system_current", } java_library { diff --git a/media/lib/signer/Android.bp b/media/lib/signer/Android.bp index f04b2fc16a175..85a007f427b86 100644 --- a/media/lib/signer/Android.bp +++ b/media/lib/signer/Android.bp @@ -16,8 +16,9 @@ java_sdk_library { name: "com.android.mediadrm.signer", - srcs: ["java/**/*.java"], + srcs: [ + "java/**/*.java", + ":framework-srcs", + ], api_packages: ["com.android.mediadrm.signer"], - srcs_lib: "framework", - srcs_lib_whitelist_pkgs: ["android.media"], } diff --git a/test-mock/Android.bp b/test-mock/Android.bp index fd469a005e7d2..34ac3dcc824fd 100644 --- a/test-mock/Android.bp +++ b/test-mock/Android.bp @@ -19,14 +19,14 @@ java_sdk_library { name: "android.test.mock", - srcs: ["src/**/*.java"], + srcs: [ + "src/**/*.java", + ":framework-srcs", + ], api_packages: [ "android.test.mock", ], - - srcs_lib: "framework", - srcs_lib_whitelist_pkgs: ["android"], compile_dex: true, }