1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Build the master framework library.
16
17// READ ME: ########################################################
18//
19// When updating this list of aidl files, consider if that aidl is
20// part of the SDK API.  If it is, also add it to the list in Android.mk
21// that is preprocessed and distributed with the SDK.  This list should
22// not contain any aidl files for parcelables, but the one below should
23// if you intend for 3rd parties to be able to send those objects
24// across process boundaries.
25//
26// READ ME: ########################################################
27
28package {
29    default_applicable_licenses: ["frameworks_base_license"],
30}
31
32// Added automatically by a large-scale-change that took the approach of
33// 'apply every license found to every target'. While this makes sure we respect
34// every license restriction, it may not be entirely correct.
35//
36// e.g. GPL in an MIT project might only apply to the contrib/ directory.
37//
38// Please consider splitting the single license below into multiple licenses,
39// taking care not to lose any license_kind information, and overriding the
40// default license using the 'licenses: [...]' property on targets as needed.
41//
42// For unused files, consider creating a 'fileGroup' with "//visibility:private"
43// to attach the license to, and including a comment whether the files may be
44// used in the current project.
45// See: http://go/android-license-faq
46license {
47    name: "frameworks_base_license",
48    visibility: [":__subpackages__"],
49    license_kinds: [
50        "SPDX-license-identifier-Apache-2.0",
51        "SPDX-license-identifier-BSD",
52        "SPDX-license-identifier-CC-BY",
53        "SPDX-license-identifier-CPL-1.0",
54        "SPDX-license-identifier-GPL",
55        "SPDX-license-identifier-GPL-2.0",
56        "SPDX-license-identifier-MIT",
57        "SPDX-license-identifier-Unicode-DFS",
58        "SPDX-license-identifier-W3C",
59        "legacy_unencumbered",
60    ],
61    license_text: [
62        "NOTICE",
63    ],
64}
65
66filegroup {
67    name: "framework-non-updatable-sources",
68    srcs: [
69        // Java/AIDL sources under frameworks/base
70        ":framework-annotations",
71        ":framework-blobstore-sources",
72        ":framework-core-sources",
73        ":framework-drm-sources",
74        ":framework-graphics-nonupdatable-sources",
75        ":framework-jobscheduler-sources", // jobscheduler is not a module for R
76        ":framework-keystore-sources",
77        ":framework-identity-sources",
78        ":framework-location-sources",
79        ":framework-lowpan-sources",
80        ":framework-mca-effect-sources",
81        ":framework-mca-filterfw-sources",
82        ":framework-mca-filterpacks-sources",
83        ":framework-media-sources",
84        ":framework-mms-sources",
85        ":framework-opengl-sources",
86        ":framework-rs-sources",
87        ":framework-sax-sources",
88        ":framework-telecomm-sources",
89        ":framework-telephony-common-sources",
90        ":framework-telephony-sources",
91        ":framework-vcn-util-sources",
92        ":framework-wifi-annotations",
93        ":framework-wifi-non-updatable-sources",
94        ":PacProcessor-aidl-sources",
95        ":ProxyHandler-aidl-sources",
96        ":net-utils-framework-common-srcs",
97
98        // AIDL from frameworks/base/native/
99        ":platform-compat-native-aidl",
100
101        // AIDL sources from external directories
102        ":android.hardware.security.keymint-V1-java-source",
103        ":android.hardware.security.secureclock-V1-java-source",
104        ":android.security.apc-java-source",
105        ":android.security.authorization-java-source",
106        ":android.security.legacykeystore-java-source",
107        ":android.security.maintenance-java-source",
108        ":android.security.metrics-java-source",
109        ":android.system.keystore2-V1-java-source",
110        ":credstore_aidl",
111        ":dumpstate_aidl",
112        ":framework_native_aidl",
113        ":gatekeeper_aidl",
114        ":gsiservice_aidl",
115        ":guiconstants_aidl",
116        ":idmap2_aidl",
117        ":idmap2_core_aidl",
118        ":incidentcompanion_aidl",
119        ":inputconstants_aidl",
120        ":installd_aidl",
121        ":libaudioclient_aidl",
122        ":libbinder_aidl",
123        ":libbluetooth-binder-aidl",
124        ":libcamera_client_aidl",
125        ":libcamera_client_framework_aidl",
126        ":packagemanager_aidl",
127        ":libupdate_engine_aidl",
128        ":resourcemanager_aidl",
129        ":storaged_aidl",
130        ":vold_aidl",
131        ":deviceproductinfoconstants_aidl",
132
133        // For the generated R.java and Manifest.java
134        ":framework-res{.aapt.srcjar}",
135
136        // etc.
137        ":framework-javastream-protos",
138        ":statslog-framework-java-gen", // FrameworkStatsLog.java
139        ":audio_policy_configuration_V7_0",
140    ],
141}
142
143java_library {
144    name: "framework-updatable-stubs-module_libs_api",
145    static_libs: [
146        "android.net.ipsec.ike.stubs.module_lib",
147        "framework-appsearch.stubs.module_lib",
148        "framework-connectivity.stubs.module_lib",
149        "framework-graphics.stubs.module_lib",
150        "framework-media.stubs.module_lib",
151        "framework-mediaprovider.stubs.module_lib",
152        "framework-permission.stubs.module_lib",
153        "framework-permission-s.stubs.module_lib",
154        "framework-scheduling.stubs.module_lib",
155        "framework-sdkextensions.stubs.module_lib",
156        "framework-statsd.stubs.module_lib",
157        "framework-tethering.stubs.module_lib",
158        "framework-wifi.stubs.module_lib",
159    ],
160    sdk_version: "module_current",
161    visibility: ["//visibility:private"],
162}
163
164java_library {
165    name: "framework-all",
166    installable: false,
167    static_libs: [
168        "android.net.ipsec.ike.impl",
169        "framework-minus-apex",
170        "framework-appsearch.impl",
171        "framework-connectivity.impl",
172        "framework-graphics.impl",
173        "framework-mediaprovider.impl",
174        "framework-permission.impl",
175        "framework-permission-s.impl",
176        "framework-scheduling.impl",
177        "framework-sdkextensions.impl",
178        "framework-statsd.impl",
179        "framework-tethering.impl",
180        "framework-wifi.impl",
181        "updatable-media",
182    ],
183    apex_available: ["//apex_available:platform"],
184    sdk_version: "core_platform",
185    visibility: [
186        // DO NOT ADD ANY MORE ENTRIES TO THIS LIST
187        "//external/robolectric-shadows:__subpackages__",
188        "//frameworks/layoutlib:__subpackages__",
189    ],
190}
191
192// AIDL files under these paths are mixture of public and private ones.
193// They shouldn't be exported across module boundaries.
194java_defaults {
195    name: "framework-aidl-export-defaults",
196    aidl: {
197        export_include_dirs: [
198            "core/java",
199            "drm/java",
200            "graphics/java",
201            "identity/java",
202            "keystore/java",
203            "location/java",
204            "lowpan/java",
205            "media/java",
206            "media/mca/effect/java",
207            "media/mca/filterfw/java",
208            "media/mca/filterpacks/java",
209            "mms/java",
210            "opengl/java",
211            "rs/java",
212            "sax/java",
213            "telecomm/java",
214
215            "apex/media/aidl/stable",
216            // TODO(b/147699819): remove this
217            "telephony/java",
218        ],
219    },
220}
221
222// Collection of classes that are generated from non-Java files that are not listed in
223// framework_srcs. These have no or very limited dependency to the framework.
224java_library {
225    name: "framework-internal-utils",
226    static_libs: [
227        "apex_aidl_interface-java",
228        "framework-protos",
229        "updatable-driver-protos",
230        "ota_metadata_proto_java",
231        "android.hidl.base-V1.0-java",
232        "android.hardware.cas-V1.0-java",
233        "android.hardware.cas-V1.1-java",
234        "android.hardware.cas-V1.2-java",
235        "android.hardware.contexthub-V1.0-java",
236        "android.hardware.contexthub-V1.1-java",
237        "android.hardware.contexthub-V1.2-java",
238        "android.hardware.gnss-V1.0-java",
239        "android.hardware.gnss-V2.1-java",
240        "android.hardware.health-V1.0-java-constants",
241        "android.hardware.radio-V1.0-java",
242        "android.hardware.radio-V1.1-java",
243        "android.hardware.radio-V1.2-java",
244        "android.hardware.radio-V1.3-java",
245        "android.hardware.radio-V1.4-java",
246        "android.hardware.radio-V1.5-java",
247        "android.hardware.radio-V1.6-java",
248        "android.hardware.thermal-V1.0-java-constants",
249        "android.hardware.thermal-V1.0-java",
250        "android.hardware.thermal-V1.1-java",
251        "android.hardware.thermal-V2.0-java",
252        "android.hardware.tv.input-V1.0-java-constants",
253        "android.hardware.tv.tuner-V1.0-java-constants",
254        "android.hardware.tv.tuner-V1.1-java-constants",
255        "android.hardware.usb-V1.0-java-constants",
256        "android.hardware.usb-V1.1-java-constants",
257        "android.hardware.usb-V1.2-java-constants",
258        "android.hardware.usb.gadget-V1.0-java",
259        "android.hardware.usb.gadget-V1.1-java",
260        "android.hardware.usb.gadget-V1.2-java",
261        "android.hardware.vibrator-V1.0-java",
262        "android.hardware.vibrator-V1.1-java",
263        "android.hardware.vibrator-V1.2-java",
264        "android.hardware.vibrator-V1.3-java",
265        "android.hardware.vibrator-V2-java",
266        "android.system.suspend.control.internal-java",
267        "devicepolicyprotosnano",
268
269        "com.android.sysprop.apex",
270        "com.android.sysprop.init",
271        "com.android.sysprop.localization",
272        "PlatformProperties",
273    ],
274    sdk_version: "core_platform",
275    installable: false,
276}
277
278// NOTE: This filegroup is exposed for vendor libraries to depend on and is referenced in
279// documentation. Do not remove without consulting the treble/hidl teams.
280filegroup {
281    name: "framework-jarjar-rules",
282    srcs: ["framework-jarjar-rules.txt"],
283    visibility: ["//visibility:public"],
284}
285
286java_defaults {
287    name: "framework-minus-apex-defaults",
288    defaults: ["framework-aidl-export-defaults"],
289    srcs: [
290        ":framework-non-updatable-sources",
291        "core/java/**/*.logtags",
292    ],
293    aidl: {
294        generate_get_transaction_name: true,
295        local_include_dirs: [
296            "media/aidl",
297        ],
298        include_dirs: [
299            "frameworks/av/aidl",
300            "frameworks/native/libs/permission/aidl",
301            "packages/modules/Connectivity/framework/aidl-export",
302        ],
303    },
304    dxflags: [
305        "--core-library",
306        "--multi-dex",
307    ],
308    jarjar_rules: ":framework-jarjar-rules",
309    javac_shard_size: 150,
310    plugins: [
311        "view-inspector-annotation-processor",
312        "staledataclass-annotation-processor",
313        "error_prone_android_framework",
314    ],
315    required: [
316        "framework-platform-compat-config",
317        // TODO: remove gps_debug and protolog.conf.json when the build system propagates "required" properly.
318        "gps_debug.conf",
319        "icu4j-platform-compat-config",
320        "protolog.conf.json.gz",
321        "services-platform-compat-config",
322        "documents-ui-compat-config",
323        "calendar-provider-compat-config",
324    ],
325    libs: [
326        "app-compat-annotations",
327        "ext",
328        "framework-updatable-stubs-module_libs_api",
329        "unsupportedappusage",
330    ],
331    sdk_version: "core_platform",
332    static_libs: [
333        "bouncycastle-repackaged-unbundled",
334        "framework-internal-utils",
335        // If MimeMap ever becomes its own APEX, then this dependency would need to be removed
336        // in favor of an API stubs dependency in java_library "framework" below.
337        "mimemap",
338        "av-types-aidl-java",
339        "tv_tuner_resource_manager_aidl_interface-java",
340        "soundtrigger_middleware-aidl-java",
341        "modules-utils-preconditions",
342        "modules-utils-os",
343        "framework-permission-aidl-java",
344        "spatializer-aidl-java",
345        "audiopolicy-types-aidl-java",
346    ],
347}
348
349java_library {
350    name: "framework-minus-apex",
351    defaults: ["framework-minus-apex-defaults"],
352    installable: true,
353    // For backwards compatibility.
354    stem: "framework",
355    apex_available: ["//apex_available:platform"],
356    visibility: [
357        "//frameworks/base",
358        // TODO(b/147128803) remove the below lines
359        "//frameworks/base/apex/appsearch/framework",
360        "//frameworks/base/apex/blobstore/framework",
361        "//frameworks/base/apex/jobscheduler/framework",
362        "//frameworks/base/packages/Tethering/tests/unit",
363        "//packages/modules/Connectivity/Tethering/tests/unit",
364    ],
365    errorprone: {
366        javacflags: [
367            "-Xep:AndroidFrameworkBinderIdentity:ERROR",
368            "-Xep:AndroidFrameworkCompatChange:ERROR",
369            "-Xep:AndroidFrameworkUid:ERROR",
370        ],
371    },
372}
373
374java_library {
375    name: "framework-minus-apex-intdefs",
376    defaults: ["framework-minus-apex-defaults"],
377    plugins: ["intdef-annotation-processor"],
378}
379
380// This "framework" module is NOT installed to the device. It's
381// "framework-minus-apex" that gets installed to the device. Note that
382// the filename is still framework.jar (via the stem property) for
383// compatibility reason. The purpose of this module is to provide
384// framework APIs (both public and private) for bundled apps.
385// "framework-minus-apex" can't be used for the purpose because 1)
386// many apps have already hardcoded the name "framework" and
387// 2) it lacks API symbols from updatable modules - as it's clear from
388// its suffix "-minus-apex".
389java_library {
390    name: "framework",
391    defaults: ["framework-aidl-export-defaults"],
392    installable: false, // this lib is a build-only library
393    static_libs: [
394        "app-compat-annotations",
395        "framework-minus-apex",
396        "framework-appsearch.impl", // TODO(b/146218515): should be removed
397        "framework-updatable-stubs-module_libs_api",
398    ],
399    sdk_version: "core_platform",
400    apex_available: ["//apex_available:platform"],
401}
402
403platform_compat_config {
404    name: "framework-platform-compat-config",
405    src: ":framework-minus-apex",
406}
407
408filegroup {
409    name: "framework-ike-shared-srcs",
410    visibility: ["//packages/modules/IPsec"],
411    srcs: [
412        "core/java/android/net/annotations/PolicyDirection.java",
413        "core/java/com/android/internal/util/HexDump.java",
414        "core/java/com/android/internal/util/IState.java",
415        "core/java/com/android/internal/util/State.java",
416        "core/java/com/android/internal/util/StateMachine.java",
417        "services/core/java/com/android/server/vcn/util/PersistableBundleUtils.java",
418        "telephony/java/android/telephony/Annotation.java",
419    ],
420}
421
422filegroup {
423    name: "framework-networkstack-shared-srcs",
424    srcs: [
425        // TODO: remove these annotations as soon as we can use andoid.support.annotations.*
426        ":framework-annotations",
427        ":modules-utils-preconditions-srcs",
428        "core/java/android/net/DhcpResults.java",
429        "core/java/android/util/IndentingPrintWriter.java",
430        "core/java/android/util/LocalLog.java",
431        "core/java/com/android/internal/util/HexDump.java",
432        "core/java/com/android/internal/util/IndentingPrintWriter.java",
433        "core/java/com/android/internal/util/IState.java",
434        "core/java/com/android/internal/util/MessageUtils.java",
435        "core/java/com/android/internal/util/RingBufferIndices.java",
436        "core/java/com/android/internal/util/State.java",
437        "core/java/com/android/internal/util/StateMachine.java",
438        "core/java/com/android/internal/util/WakeupMessage.java",
439        "core/java/com/android/internal/util/TokenBucket.java",
440    ],
441}
442
443// Build ext.jar
444// ============================================================
445java_library {
446    name: "ext",
447    installable: true,
448    sdk_version: "core_platform",
449    static_libs: [
450        "libphonenumber-platform",
451        "tagsoup",
452        "rappor",
453    ],
454    dxflags: ["--core-library"],
455}
456
457// utility classes statically linked into framework-wifi and dynamically linked
458// into wifi-service
459java_library {
460    name: "framework-wifi-util-lib",
461    sdk_version: "module_current",
462    min_sdk_version: "30",
463    srcs: [
464        ":modules-utils-preconditions-srcs",
465        "core/java/android/os/HandlerExecutor.java",
466        "core/java/com/android/internal/util/AsyncChannel.java",
467        "core/java/com/android/internal/util/AsyncService.java",
468        "core/java/com/android/internal/util/Protocol.java",
469        "telephony/java/android/telephony/Annotation.java",
470        ":net-utils-framework-wifi-common-srcs",
471    ],
472    libs: [
473        "framework-annotations-lib",
474        "framework-connectivity.stubs.module_lib",
475        "unsupportedappusage",
476    ],
477    visibility: [
478        "//frameworks/base/wifi",
479        "//frameworks/base/services/net",
480        "//packages/modules/Wifi/framework",
481    ],
482}
483
484// TODO(b/145644363): move this to under StubLibraries.bp or ApiDocs.bp
485metalava_framework_docs_args = "--manifest $(location core/res/AndroidManifest.xml) " +
486    "--hide-package com.android.server " +
487    "--hide-package android.audio.policy.configuration.V7_0 " +
488    "--error UnhiddenSystemApi " +
489    "--hide RequiresPermission " +
490    "--hide CallbackInterface " +
491    "--hide MissingPermission --hide BroadcastBehavior " +
492    "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " +
493    "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo " +
494    "--error NoSettingsProvider " +
495    "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* " +
496    "--api-lint-ignore-prefix android.icu. " +
497    "--api-lint-ignore-prefix java. " +
498    "--api-lint-ignore-prefix junit. " +
499    "--api-lint-ignore-prefix org. "
500
501packages_to_document = [
502    "android",
503    "dalvik",
504    "java",
505    "javax",
506    "junit",
507    "org.apache.http",
508    "org.json",
509    "org.w3c.dom",
510    "org.xml.sax",
511    "org.xmlpull",
512]
513
514filegroup {
515    name: "android-non-updatable-stub-sources",
516    srcs: [
517        ":framework-mime-sources", // mimemap builds separately but has no separate droidstubs.
518        ":framework-non-updatable-sources",
519        ":opt-telephony-srcs",
520        ":opt-net-voip-srcs",
521        "core/java/**/*.logtags",
522        "**/package.html",
523    ],
524    visibility: ["//visibility:private"],
525}
526
527// These defaults are used for both the jar stubs and the doc stubs.
528stubs_defaults {
529    name: "android-non-updatable-stubs-defaults",
530    srcs: [":android-non-updatable-stub-sources"],
531    sdk_version: "none",
532    system_modules: "none",
533    java_version: "1.8",
534    arg_files: ["core/res/AndroidManifest.xml"],
535    // TODO(b/147699819): remove below aidl includes.
536    aidl: {
537        local_include_dirs: [
538            "apex/media/aidl/stable",
539            "media/aidl",
540            "telephony/java",
541        ],
542        include_dirs: [
543            "frameworks/av/aidl",
544            "frameworks/native/libs/permission/aidl",
545            "packages/modules/Connectivity/framework/aidl-export",
546        ],
547    },
548    // These are libs from framework-internal-utils that are required (i.e. being referenced)
549    // from framework-non-updatable-sources. Add more here when there's a need.
550    // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
551    // dependencies gets bigger.
552    libs: [
553        "android.hardware.cas-V1.2-java",
554        "android.hardware.health-V1.0-java-constants",
555        "android.hardware.radio-V1.5-java",
556        "android.hardware.radio-V1.6-java",
557        "android.hardware.thermal-V1.0-java-constants",
558        "android.hardware.thermal-V2.0-java",
559        "android.hardware.tv.input-V1.0-java-constants",
560        "android.hardware.tv.tuner-V1.0-java-constants",
561        "android.hardware.tv.tuner-V1.1-java-constants",
562        "android.hardware.usb-V1.0-java-constants",
563        "android.hardware.usb-V1.1-java-constants",
564        "android.hardware.usb.gadget-V1.0-java",
565        "android.hardware.vibrator-V1.3-java",
566        "framework-protos",
567        "art.module.public.api",
568        // There are a few classes from modules used by the core that
569        // need to be resolved by metalava. We use a prebuilt stub of the
570        // full sdk to ensure we can resolve them. If a new class gets added,
571        // the prebuilts/sdk/current needs to be updated.
572        "sdk_system_current_android",
573        // NOTE: The below can be removed once the prebuilt stub contains IKE.
574        "sdk_system_current_android.net.ipsec.ike",
575    ],
576    filter_packages: packages_to_document,
577    high_mem: true, // Lots of sources => high memory use, see b/170701554
578    installable: false,
579    annotations_enabled: true,
580    previous_api: ":android.api.public.latest",
581    merge_annotations_dirs: ["metalava-manual"],
582    defaults_visibility: ["//visibility:private"],
583    visibility: ["//frameworks/base/api"],
584}
585
586build = [
587    "StubLibraries.bp",
588    "ApiDocs.bp",
589    "ProtoLibraries.bp",
590    "TestProtoLibraries.bp",
591]
592