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        ":idmap2_aidl",
116        ":idmap2_core_aidl",
117        ":incidentcompanion_aidl",
118        ":inputconstants_aidl",
119        ":installd_aidl",
120        ":libaudioclient_aidl",
121        ":libbinder_aidl",
122        ":libbluetooth-binder-aidl",
123        ":libcamera_client_aidl",
124        ":libcamera_client_framework_aidl",
125        ":packagemanager_aidl",
126        ":libupdate_engine_aidl",
127        ":resourcemanager_aidl",
128        ":storaged_aidl",
129        ":vold_aidl",
130        ":deviceproductinfoconstants_aidl",
131
132        // For the generated R.java and Manifest.java
133        ":framework-res{.aapt.srcjar}",
134
135        // etc.
136        ":framework-javastream-protos",
137        ":statslog-framework-java-gen", // FrameworkStatsLog.java
138        ":audio_policy_configuration_V7_0",
139    ],
140}
141
142java_library {
143    name: "framework-updatable-stubs-module_libs_api",
144    static_libs: [
145        "android.net.ipsec.ike.stubs.module_lib",
146        "framework-appsearch.stubs.module_lib",
147        "framework-connectivity.stubs.module_lib",
148        "framework-graphics.stubs.module_lib",
149        "framework-media.stubs.module_lib",
150        "framework-mediaprovider.stubs.module_lib",
151        "framework-permission.stubs.module_lib",
152        "framework-permission-s.stubs.module_lib",
153        "framework-scheduling.stubs.module_lib",
154        "framework-sdkextensions.stubs.module_lib",
155        "framework-statsd.stubs.module_lib",
156        "framework-tethering.stubs.module_lib",
157        "framework-wifi.stubs.module_lib",
158    ],
159    sdk_version: "module_current",
160    visibility: ["//visibility:private"],
161}
162
163java_library {
164    name: "framework-all",
165    installable: false,
166    static_libs: [
167        "android.net.ipsec.ike.impl",
168        "framework-minus-apex",
169        "framework-appsearch.impl",
170        "framework-connectivity.impl",
171        "framework-graphics.impl",
172        "framework-mediaprovider.impl",
173        "framework-permission.impl",
174        "framework-permission-s.impl",
175        "framework-scheduling.impl",
176        "framework-sdkextensions.impl",
177        "framework-statsd.impl",
178        "framework-tethering.impl",
179        "framework-wifi.impl",
180        "updatable-media",
181    ],
182    apex_available: ["//apex_available:platform"],
183    sdk_version: "core_platform",
184    visibility: [
185        // DO NOT ADD ANY MORE ENTRIES TO THIS LIST
186        "//external/robolectric-shadows:__subpackages__",
187        "//frameworks/layoutlib:__subpackages__",
188    ],
189}
190
191// AIDL files under these paths are mixture of public and private ones.
192// They shouldn't be exported across module boundaries.
193java_defaults {
194    name: "framework-aidl-export-defaults",
195    aidl: {
196        export_include_dirs: [
197            "core/java",
198            "drm/java",
199            "graphics/java",
200            "identity/java",
201            "keystore/java",
202            "location/java",
203            "lowpan/java",
204            "media/java",
205            "media/mca/effect/java",
206            "media/mca/filterfw/java",
207            "media/mca/filterpacks/java",
208            "mms/java",
209            "opengl/java",
210            "rs/java",
211            "sax/java",
212            "telecomm/java",
213
214            "apex/media/aidl/stable",
215            // TODO(b/147699819): remove this
216            "telephony/java",
217        ],
218    },
219}
220
221// Collection of classes that are generated from non-Java files that are not listed in
222// framework_srcs. These have no or very limited dependency to the framework.
223java_library {
224    name: "framework-internal-utils",
225    static_libs: [
226        "apex_aidl_interface-java",
227        "framework-protos",
228        "updatable-driver-protos",
229        "ota_metadata_proto_java",
230        "android.hidl.base-V1.0-java",
231        "android.hardware.cas-V1.0-java",
232        "android.hardware.cas-V1.1-java",
233        "android.hardware.cas-V1.2-java",
234        "android.hardware.contexthub-V1.0-java",
235        "android.hardware.contexthub-V1.1-java",
236        "android.hardware.contexthub-V1.2-java",
237        "android.hardware.gnss-V1.0-java",
238        "android.hardware.gnss-V2.1-java",
239        "android.hardware.health-V1.0-java-constants",
240        "android.hardware.radio-V1.0-java",
241        "android.hardware.radio-V1.1-java",
242        "android.hardware.radio-V1.2-java",
243        "android.hardware.radio-V1.3-java",
244        "android.hardware.radio-V1.4-java",
245        "android.hardware.radio-V1.5-java",
246        "android.hardware.radio-V1.6-java",
247        "android.hardware.thermal-V1.0-java-constants",
248        "android.hardware.thermal-V1.0-java",
249        "android.hardware.thermal-V1.1-java",
250        "android.hardware.thermal-V2.0-java",
251        "android.hardware.tv.input-V1.0-java-constants",
252        "android.hardware.tv.tuner-V1.0-java-constants",
253        "android.hardware.tv.tuner-V1.1-java-constants",
254        "android.hardware.usb-V1.0-java-constants",
255        "android.hardware.usb-V1.1-java-constants",
256        "android.hardware.usb-V1.2-java-constants",
257        "android.hardware.usb.gadget-V1.0-java",
258        "android.hardware.usb.gadget-V1.1-java",
259        "android.hardware.usb.gadget-V1.2-java",
260        "android.hardware.vibrator-V1.0-java",
261        "android.hardware.vibrator-V1.1-java",
262        "android.hardware.vibrator-V1.2-java",
263        "android.hardware.vibrator-V1.3-java",
264        "android.hardware.vibrator-V2-java",
265        "android.system.suspend.control.internal-java",
266        "devicepolicyprotosnano",
267
268        "com.android.sysprop.apex",
269        "com.android.sysprop.init",
270        "com.android.sysprop.localization",
271        "PlatformProperties",
272    ],
273    sdk_version: "core_platform",
274    installable: false,
275}
276
277// NOTE: This filegroup is exposed for vendor libraries to depend on and is referenced in
278// documentation. Do not remove without consulting the treble/hidl teams.
279filegroup {
280    name: "framework-jarjar-rules",
281    srcs: ["framework-jarjar-rules.txt"],
282    visibility: ["//visibility:public"],
283}
284
285java_defaults {
286    name: "framework-minus-apex-defaults",
287    defaults: ["framework-aidl-export-defaults"],
288    srcs: [
289        ":framework-non-updatable-sources",
290        "core/java/**/*.logtags",
291    ],
292    aidl: {
293        generate_get_transaction_name: true,
294        local_include_dirs: [
295            "media/aidl",
296        ],
297        include_dirs: [
298            "frameworks/av/aidl",
299            "frameworks/native/libs/permission/aidl",
300            "packages/modules/Connectivity/framework/aidl-export",
301        ],
302    },
303    dxflags: [
304        "--core-library",
305        "--multi-dex",
306    ],
307    jarjar_rules: ":framework-jarjar-rules",
308    javac_shard_size: 150,
309    plugins: [
310        "view-inspector-annotation-processor",
311        "staledataclass-annotation-processor",
312        "error_prone_android_framework",
313    ],
314    required: [
315        "framework-platform-compat-config",
316        // TODO: remove gps_debug and protolog.conf.json when the build system propagates "required" properly.
317        "gps_debug.conf",
318        "icu4j-platform-compat-config",
319        "protolog.conf.json.gz",
320        "services-platform-compat-config",
321        "documents-ui-compat-config",
322        "calendar-provider-compat-config",
323    ],
324    libs: [
325        "app-compat-annotations",
326        "ext",
327        "framework-updatable-stubs-module_libs_api",
328        "unsupportedappusage",
329    ],
330    sdk_version: "core_platform",
331    static_libs: [
332        "bouncycastle-repackaged-unbundled",
333        "framework-internal-utils",
334        // If MimeMap ever becomes its own APEX, then this dependency would need to be removed
335        // in favor of an API stubs dependency in java_library "framework" below.
336        "mimemap",
337        "av-types-aidl-java",
338        "tv_tuner_resource_manager_aidl_interface-java",
339        "soundtrigger_middleware-aidl-java",
340        "modules-utils-preconditions",
341        "modules-utils-os",
342        "framework-permission-aidl-java",
343    ],
344}
345
346java_library {
347    name: "framework-minus-apex",
348    defaults: ["framework-minus-apex-defaults"],
349    installable: true,
350    // For backwards compatibility.
351    stem: "framework",
352    apex_available: ["//apex_available:platform"],
353    visibility: [
354        "//frameworks/base",
355        // TODO(b/147128803) remove the below lines
356        "//frameworks/base/apex/appsearch/framework",
357        "//frameworks/base/apex/blobstore/framework",
358        "//frameworks/base/apex/jobscheduler/framework",
359        "//frameworks/base/packages/Tethering/tests/unit",
360        "//packages/modules/Connectivity/Tethering/tests/unit",
361    ],
362    errorprone: {
363        javacflags: [
364            "-Xep:AndroidFrameworkBinderIdentity:ERROR",
365            "-Xep:AndroidFrameworkCompatChange:ERROR",
366            "-Xep:AndroidFrameworkUid:ERROR",
367        ],
368    },
369}
370
371java_library {
372    name: "framework-minus-apex-intdefs",
373    defaults: ["framework-minus-apex-defaults"],
374    plugins: ["intdef-annotation-processor"],
375}
376
377// This "framework" module is NOT installed to the device. It's
378// "framework-minus-apex" that gets installed to the device. Note that
379// the filename is still framework.jar (via the stem property) for
380// compatibility reason. The purpose of this module is to provide
381// framework APIs (both public and private) for bundled apps.
382// "framework-minus-apex" can't be used for the purpose because 1)
383// many apps have already hardcoded the name "framework" and
384// 2) it lacks API symbols from updatable modules - as it's clear from
385// its suffix "-minus-apex".
386java_library {
387    name: "framework",
388    defaults: ["framework-aidl-export-defaults"],
389    installable: false, // this lib is a build-only library
390    static_libs: [
391        "app-compat-annotations",
392        "framework-minus-apex",
393        "framework-appsearch.impl", // TODO(b/146218515): should be removed
394        "framework-updatable-stubs-module_libs_api",
395    ],
396    sdk_version: "core_platform",
397    apex_available: ["//apex_available:platform"],
398}
399
400platform_compat_config {
401    name: "framework-platform-compat-config",
402    src: ":framework-minus-apex",
403}
404
405filegroup {
406    name: "framework-ike-shared-srcs",
407    visibility: ["//packages/modules/IPsec"],
408    srcs: [
409        "core/java/android/net/annotations/PolicyDirection.java",
410        "core/java/com/android/internal/util/HexDump.java",
411        "core/java/com/android/internal/util/IState.java",
412        "core/java/com/android/internal/util/State.java",
413        "core/java/com/android/internal/util/StateMachine.java",
414        "services/core/java/com/android/server/vcn/util/PersistableBundleUtils.java",
415        "telephony/java/android/telephony/Annotation.java",
416    ],
417}
418
419filegroup {
420    name: "framework-networkstack-shared-srcs",
421    srcs: [
422        // TODO: remove these annotations as soon as we can use andoid.support.annotations.*
423        ":framework-annotations",
424        ":modules-utils-preconditions-srcs",
425        "core/java/android/net/DhcpResults.java",
426        "core/java/android/util/IndentingPrintWriter.java",
427        "core/java/android/util/LocalLog.java",
428        "core/java/com/android/internal/util/HexDump.java",
429        "core/java/com/android/internal/util/IndentingPrintWriter.java",
430        "core/java/com/android/internal/util/IState.java",
431        "core/java/com/android/internal/util/MessageUtils.java",
432        "core/java/com/android/internal/util/RingBufferIndices.java",
433        "core/java/com/android/internal/util/State.java",
434        "core/java/com/android/internal/util/StateMachine.java",
435        "core/java/com/android/internal/util/WakeupMessage.java",
436        "core/java/com/android/internal/util/TokenBucket.java",
437    ],
438}
439
440// Build ext.jar
441// ============================================================
442java_library {
443    name: "ext",
444    installable: true,
445    sdk_version: "core_platform",
446    static_libs: [
447        "libphonenumber-platform",
448        "tagsoup",
449        "rappor",
450    ],
451    dxflags: ["--core-library"],
452}
453
454// utility classes statically linked into framework-wifi and dynamically linked
455// into wifi-service
456java_library {
457    name: "framework-wifi-util-lib",
458    sdk_version: "module_current",
459    min_sdk_version: "30",
460    srcs: [
461        ":modules-utils-preconditions-srcs",
462        "core/java/android/os/HandlerExecutor.java",
463        "core/java/com/android/internal/util/AsyncChannel.java",
464        "core/java/com/android/internal/util/AsyncService.java",
465        "core/java/com/android/internal/util/Protocol.java",
466        "telephony/java/android/telephony/Annotation.java",
467        ":net-utils-framework-wifi-common-srcs",
468    ],
469    libs: [
470        "framework-annotations-lib",
471        "framework-connectivity.stubs.module_lib",
472        "unsupportedappusage",
473    ],
474    visibility: [
475        "//frameworks/base/wifi",
476        "//frameworks/base/services/net",
477        "//packages/modules/Wifi/framework",
478    ],
479}
480
481// TODO(b/145644363): move this to under StubLibraries.bp or ApiDocs.bp
482metalava_framework_docs_args = "--manifest $(location core/res/AndroidManifest.xml) " +
483    "--hide-package com.android.server " +
484    "--hide-package android.audio.policy.configuration.V7_0 " +
485    "--error UnhiddenSystemApi " +
486    "--hide RequiresPermission " +
487    "--hide CallbackInterface " +
488    "--hide MissingPermission --hide BroadcastBehavior " +
489    "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " +
490    "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo " +
491    "--error NoSettingsProvider " +
492    "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* " +
493    "--api-lint-ignore-prefix android.icu. " +
494    "--api-lint-ignore-prefix java. " +
495    "--api-lint-ignore-prefix junit. " +
496    "--api-lint-ignore-prefix org. "
497
498packages_to_document = [
499    "android",
500    "dalvik",
501    "java",
502    "javax",
503    "junit",
504    "org.apache.http",
505    "org.json",
506    "org.w3c.dom",
507    "org.xml.sax",
508    "org.xmlpull",
509]
510
511filegroup {
512    name: "android-non-updatable-stub-sources",
513    srcs: [
514        ":framework-mime-sources", // mimemap builds separately but has no separate droidstubs.
515        ":framework-non-updatable-sources",
516        ":opt-telephony-srcs",
517        ":opt-net-voip-srcs",
518        "core/java/**/*.logtags",
519        "**/package.html",
520    ],
521    visibility: ["//visibility:private"],
522}
523
524// These defaults are used for both the jar stubs and the doc stubs.
525stubs_defaults {
526    name: "android-non-updatable-stubs-defaults",
527    srcs: [":android-non-updatable-stub-sources"],
528    sdk_version: "none",
529    system_modules: "none",
530    java_version: "1.8",
531    arg_files: ["core/res/AndroidManifest.xml"],
532    // TODO(b/147699819): remove below aidl includes.
533    aidl: {
534        local_include_dirs: [
535            "apex/media/aidl/stable",
536            "media/aidl",
537            "telephony/java",
538        ],
539        include_dirs: [
540            "frameworks/av/aidl",
541            "frameworks/native/libs/permission/aidl",
542            "packages/modules/Connectivity/framework/aidl-export",
543        ],
544    },
545    // These are libs from framework-internal-utils that are required (i.e. being referenced)
546    // from framework-non-updatable-sources. Add more here when there's a need.
547    // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
548    // dependencies gets bigger.
549    libs: [
550        "android.hardware.cas-V1.2-java",
551        "android.hardware.health-V1.0-java-constants",
552        "android.hardware.radio-V1.5-java",
553        "android.hardware.radio-V1.6-java",
554        "android.hardware.thermal-V1.0-java-constants",
555        "android.hardware.thermal-V2.0-java",
556        "android.hardware.tv.input-V1.0-java-constants",
557        "android.hardware.tv.tuner-V1.0-java-constants",
558        "android.hardware.tv.tuner-V1.1-java-constants",
559        "android.hardware.usb-V1.0-java-constants",
560        "android.hardware.usb-V1.1-java-constants",
561        "android.hardware.usb.gadget-V1.0-java",
562        "android.hardware.vibrator-V1.3-java",
563        "framework-protos",
564        "art.module.public.api",
565        // There are a few classes from modules used by the core that
566        // need to be resolved by metalava. We use a prebuilt stub of the
567        // full sdk to ensure we can resolve them. If a new class gets added,
568        // the prebuilts/sdk/current needs to be updated.
569        "sdk_system_current_android",
570        // NOTE: The below can be removed once the prebuilt stub contains IKE.
571        "sdk_system_current_android.net.ipsec.ike",
572    ],
573    filter_packages: packages_to_document,
574    high_mem: true, // Lots of sources => high memory use, see b/170701554
575    installable: false,
576    annotations_enabled: true,
577    previous_api: ":android.api.public.latest",
578    merge_annotations_dirs: ["metalava-manual"],
579    defaults_visibility: ["//visibility:private"],
580    visibility: ["//frameworks/base/api"],
581}
582
583build = [
584    "StubLibraries.bp",
585    "ApiDocs.bp",
586    "ProtoLibraries.bp",
587    "TestProtoLibraries.bp",
588]
589