blob: 0006455f41b0055e86a23895e76cf7e333febe3d [file] [log] [blame]
Bob Badour8a6a2bc2021-02-12 17:07:05 -08001package {
2 // See: http://go/android-license-faq
3 // A large-scale-change added 'default_applicable_licenses' to import
4 // all of the 'license_kinds' from "frameworks_base_license"
5 // to get the below license kinds:
6 // SPDX-license-identifier-Apache-2.0
7 default_applicable_licenses: ["frameworks_base_license"],
8}
9
Anton Hanssone3d44e82021-04-12 18:14:30 +010010// Defaults for platform code that runs inside system_server
11java_defaults {
12 name: "platform_service_defaults",
13 plugins: ["error_prone_android_framework"],
14 errorprone: {
15 javacflags: [
Anton Hanssone3d44e82021-04-12 18:14:30 +010016 "-Xep:AndroidFrameworkCompatChange:ERROR",
17 // "-Xep:AndroidFrameworkUid:ERROR",
Michael Wright010aa302022-02-04 17:12:47 +000018 "-Xep:SelfEquals:ERROR",
Michael Wright2e7197c2022-02-04 19:00:44 +000019 "-Xep:NullTernary:ERROR",
Michael Wright5c975952022-02-04 20:08:57 +000020 "-Xep:TryFailThrowable:ERROR",
Michael Wright400ea882022-02-04 20:45:04 +000021 "-Xep:HashtableContains:ERROR",
Michael Wrightc92adae2022-02-04 20:49:14 +000022 "-Xep:FormatString:ERROR",
Michael Wright16451b02022-02-04 20:59:26 +000023 "-Xep:ArrayHashCode:ERROR",
Michael Wright573d22a2022-02-04 21:02:33 +000024 "-Xep:SelfAssignment:ERROR",
Michael Wright3cc84d02022-02-04 21:05:45 +000025 "-Xep:ArrayEquals:ERROR",
Michael Wright684f5a52022-02-04 21:41:04 +000026 "-Xep:IdentityBinaryExpression:ERROR",
Anton Hanssone3d44e82021-04-12 18:14:30 +010027 // NOTE: only enable to generate local patchfiles
28 // "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster",
29 // "-XepPatchLocation:/tmp/refaster/",
30 ],
31 },
Azhara Assanovaa131ad92021-06-11 09:53:48 +000032 lint: {
33 extra_check_modules: ["AndroidFrameworkLintChecker"],
34 },
Anton Hanssone3d44e82021-04-12 18:14:30 +010035}
36
Jared Dukefb64d442023-09-22 16:49:22 +000037// Config to control optimizing and shrinking the services target using R8.
38// Set via `export SYSTEM_OPTIMIZE_JAVA=true|false`, or explicitly in Make via the
Jared Duke4514bdf2021-11-18 13:18:21 -080039// `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA` variable.
Jared Duke4514bdf2021-11-18 13:18:21 -080040soong_config_module_type {
41 name: "system_optimized_java_defaults",
42 module_type: "java_defaults",
43 config_namespace: "ANDROID",
tyiu39a05ed2023-10-04 17:54:32 +000044 bool_variables: [
45 "SYSTEM_OPTIMIZE_JAVA",
46 "FULL_SYSTEM_OPTIMIZE_JAVA",
47 ],
Jared Dukefb64d442023-09-22 16:49:22 +000048 properties: [
49 "optimize",
50 "dxflags",
51 ],
Jared Duke4514bdf2021-11-18 13:18:21 -080052}
53
54system_optimized_java_defaults {
55 name: "services_java_defaults",
56 soong_config_variables: {
57 SYSTEM_OPTIMIZE_JAVA: {
58 optimize: {
59 enabled: true,
Jared Dukeea03d102022-02-15 13:57:06 -080060 // TODO(b/210510433): Enable optimizations after improving
61 // retracing infra.
tyiu39a05ed2023-10-04 17:54:32 +000062 // See also FULL_SYSTEM_OPTIMIZE_JAVA.
Jared Dukeea03d102022-02-15 13:57:06 -080063 optimize: false,
Jared Duke4514bdf2021-11-18 13:18:21 -080064 shrink: true,
Jared Duke06689ad2022-09-07 12:24:36 -070065 ignore_warnings: false,
Jared Duke76919e82023-10-25 21:46:36 +000066 proguard_compatibility: false,
Jared Duke6cf7fbd2023-05-19 20:21:36 +000067 proguard_flags_files: [
68 "proguard.flags",
69 // Ensure classes referenced in the framework-res manifest
70 // and implemented in system_server are kept.
71 ":framework-res{.aapt.proguardOptionsFile}",
72 ],
Jared Duke4514bdf2021-11-18 13:18:21 -080073 },
Hai Zhang3070d7c2022-11-11 21:48:44 -080074 conditions_default: {
75 optimize: {
76 enabled: true,
77 optimize: false,
78 shrink: true,
79 ignore_warnings: false,
80 // Note that this proguard config is very conservative, only shrinking the
81 // permission subpackage to prune unused jarjar'ed Kotlin dependencies.
82 proguard_flags_files: ["proguard_permission.flags"],
83 },
Jared Dukefb64d442023-09-22 16:49:22 +000084 // Explicitly configure R8 to preserve debug info, as this path should
85 // really only allow stripping of permission-specific code and deps.
86 dxflags: ["--debug"],
Hai Zhang3070d7c2022-11-11 21:48:44 -080087 },
Jared Duke4514bdf2021-11-18 13:18:21 -080088 },
tyiu39a05ed2023-10-04 17:54:32 +000089 // Allow form factors to opt-in full system java optimization
90 FULL_SYSTEM_OPTIMIZE_JAVA: {
91 optimize: {
92 optimize: true,
93 },
94 },
Jared Duke4514bdf2021-11-18 13:18:21 -080095 },
96}
97
Jiyong Parkbae2e902019-11-17 13:11:19 +090098filegroup {
99 name: "services-main-sources",
Colin Cross33b78ef2021-03-26 10:31:25 -0700100 srcs: [
101 "java/**/*.java",
102 "java/**/package.html",
103 ],
Jiyong Parkbae2e902019-11-17 13:11:19 +0900104 path: "java",
105 visibility: ["//visibility:private"],
106}
107
108filegroup {
Andrei Onea43114702021-02-10 20:53:12 +0000109 name: "services-non-updatable-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900110 srcs: [
Jihoon Kangfcc577c2024-08-02 18:57:13 +0000111 ":incremental_aidl",
112 ":services.core-aidl-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900113 ":services.core-sources",
Hongwei Wangcdcb68d2020-11-23 12:48:05 -0800114 ":services.core-sources-am-wm",
Colin Cross33b78ef2021-03-26 10:31:25 -0700115 "core/java/com/android/server/am/package.html",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900116 ":services.accessibility-sources",
117 ":services.appprediction-sources",
118 ":services.appwidget-sources",
119 ":services.autofill-sources",
120 ":services.backup-sources",
121 ":services.companion-sources",
122 ":services.contentcapture-sources",
Oluwarotimi Adesinaa326f0b2024-08-05 18:28:16 +0000123 ":services.appfunctions-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900124 ":services.contentsuggestions-sources",
Shashwat Razdan6ef76562024-03-07 13:26:12 -0800125 ":services.contextualsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900126 ":services.coverage-sources",
Helen Qin20ff3552022-09-13 15:47:24 +0000127 ":services.credentials-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900128 ":services.devicepolicy-sources",
129 ":services.midi-sources",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200130 ":services.musicsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900131 ":services.net-sources",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800132 ":services.permission-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900133 ":services.print-sources",
Yi Kong86f85932020-06-29 20:03:55 +0800134 ":services.profcollect-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900135 ":services.restrictions-sources",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800136 ":services.searchui-sources",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800137 ":services.smartspace-sources",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700138 ":services.soundtrigger-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900139 ":services.systemcaptions-sources",
Adam He2653f232020-11-30 18:23:20 -0800140 ":services.translation-sources",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000141 ":services.texttospeech-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900142 ":services.usage-sources",
143 ":services.usb-sources",
144 ":services.voiceinteraction-sources",
Sharon Sua5afd372022-02-01 22:09:36 +0000145 ":services.wallpapereffectsgeneration-sources",
Roshan Piusea33fb92020-02-20 12:49:45 -0800146 ":services.wifi-sources",
TYM Tsaiabf72bd2023-11-21 07:12:21 +0000147 ":framework-pm-common-shared-srcs",
Andrei Onea43114702021-02-10 20:53:12 +0000148 ],
149 visibility: ["//visibility:private"],
150}
151
Felipe Lemefec71a72021-04-01 23:32:53 -0700152java_library {
153 name: "Slogf",
154 srcs: ["core/java/com/android/server/utils/Slogf.java"],
155}
156
“Shadmanae41b3a2024-01-31 04:30:31 +0000157soong_config_module_type {
158 name: "art_profile_java_defaults",
159 module_type: "java_defaults",
160 config_namespace: "art_profile",
161 variables: ["services_profile_path"],
162 properties: ["dex_preopt"],
163}
164
165soong_config_string_variable {
166 name: "services_profile_path",
167 values: ["art_wear_profile"],
168}
169
170art_profile_java_defaults {
171 name: "art_profile_java_defaults",
172 soong_config_variables: {
173 services_profile_path: {
174 art_wear_profile: {
175 dex_preopt: {
176 app_image: true,
177 profile: "art-wear-profile",
178 },
179 },
180 conditions_default: {
181 dex_preopt: {
182 app_image: true,
183 profile: "art-profile",
184 },
185 },
186 },
187 },
188}
189
Colin Crosseb652a42017-12-05 09:46:29 -0800190// merge all required services into one jar
191// ============================================================
Ray China750fad2024-07-11 17:42:10 +0800192soong_config_module_type {
193 name: "system_java_library",
194 module_type: "java_library",
195 config_namespace: "system_services",
196 bool_variables: ["without_vibrator"],
197 properties: ["vintf_fragments"],
198}
199
200system_java_library {
Colin Crosseb652a42017-12-05 09:46:29 -0800201 name: "services",
“Shadmanae41b3a2024-01-31 04:30:31 +0000202 defaults: [
203 "services_java_defaults",
204 "art_profile_java_defaults",
205 ],
Colin Crossa12c0f52018-06-27 11:00:11 -0700206 installable: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800207
Hai Zhang3070d7c2022-11-11 21:48:44 -0800208 exclude_kotlinc_generated_files: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800209
Jiyong Parkbae2e902019-11-17 13:11:19 +0900210 srcs: [":services-main-sources"],
Colin Crosseb652a42017-12-05 09:46:29 -0800211
212 // The convention is to name each service module 'services.$(module_name)'
213 static_libs: [
Colin Cross4c0b06b2017-12-12 19:43:04 -0800214 "services.core",
Colin Crosseb652a42017-12-05 09:46:29 -0800215 "services.accessibility",
Sunny Goyal54e91342018-11-14 11:59:02 -0800216 "services.appprediction",
Colin Crosseb652a42017-12-05 09:46:29 -0800217 "services.appwidget",
218 "services.autofill",
219 "services.backup",
220 "services.companion",
Oluwarotimi Adesinaa326f0b2024-08-05 18:28:16 +0000221 "services.appfunctions",
Felipe Leme749b8892018-12-03 16:30:30 -0800222 "services.contentcapture",
Winson Chung3fb0f252019-01-08 17:41:55 -0800223 "services.contentsuggestions",
Shashwat Razdan6ef76562024-03-07 13:26:12 -0800224 "services.contextualsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800225 "services.coverage",
Helen Qin20ff3552022-09-13 15:47:24 +0000226 "services.credentials",
Colin Crosseb652a42017-12-05 09:46:29 -0800227 "services.devicepolicy",
Dave Mankoff0c72a322023-07-12 19:32:11 +0000228 "services.flags",
Colin Crosseb652a42017-12-05 09:46:29 -0800229 "services.midi",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200230 "services.musicsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800231 "services.net",
Danning Chen20b32ed2019-12-18 16:52:03 -0800232 "services.people",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800233 "services.permission",
Colin Crosseb652a42017-12-05 09:46:29 -0800234 "services.print",
Yi Kong86f85932020-06-29 20:03:55 +0800235 "services.profcollect",
Colin Crosseb652a42017-12-05 09:46:29 -0800236 "services.restrictions",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800237 "services.searchui",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800238 "services.smartspace",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700239 "services.soundtrigger",
Robert Berrye14120e2019-03-18 16:33:42 -0400240 "services.systemcaptions",
Adam He2653f232020-11-30 18:23:20 -0800241 "services.translation",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000242 "services.texttospeech",
Colin Crosseb652a42017-12-05 09:46:29 -0800243 "services.usage",
244 "services.usb",
245 "services.voiceinteraction",
Sharon Sua5afd372022-02-01 22:09:36 +0000246 "services.wallpapereffectsgeneration",
Roshan Piusea33fb92020-02-20 12:49:45 -0800247 "services.wifi",
Dmitri Plotnikov4eaac3a2020-05-04 17:00:16 -0700248 "service-blobstore",
249 "service-jobscheduler",
Colin Crosseb652a42017-12-05 09:46:29 -0800250 "android.hidl.base-V1.0-java",
251 ],
252
253 libs: [
254 "android.hidl.manager-V1.0-java",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100255 "framework-tethering.stubs.module_lib",
Jared Duke5123eb32024-03-29 22:52:57 +0000256 "keepanno-annotations",
Chris Wailes09724a72021-02-08 10:00:13 -0800257 "service-art.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700258 "service-permission.stubs.system_server",
Seth Moore0277b662022-10-20 14:14:39 -0700259 "service-rkp.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700260 "service-sdksandbox.stubs.system_server",
Colin Crosseb652a42017-12-05 09:46:29 -0800261 ],
262
Ray China750fad2024-07-11 17:42:10 +0800263 soong_config_variables: {
264 without_vibrator: {
265 vintf_fragments: [
266 "manifest_services.xml",
267 ],
268 conditions_default: {
269 vintf_fragments: [
270 "manifest_services.xml",
271 "manifest_services_android.frameworks.vibrator.xml",
272 ],
273 },
274 },
275 },
Brian Julianeba77a82023-02-01 14:13:45 +0000276
Raphael Kim82701132023-02-15 22:40:07 -0800277 required: [
278 "libukey2_jni_shared",
Jiyong Park20d61792024-03-18 18:05:15 +0900279 "protolog.conf.json.gz",
Jiyong Parkd80202c2024-03-26 12:44:42 +0900280 "core.protolog.pb",
Raphael Kim82701132023-02-15 22:40:07 -0800281 ],
Cole Faust596fe0f2024-01-04 09:37:47 -0800282 lint: {
283 baseline_filename: "lint-baseline.xml",
284 },
Raphael Kim82701132023-02-15 22:40:07 -0800285
Colin Crosseb652a42017-12-05 09:46:29 -0800286 // Uncomment to enable output of certain warnings (deprecated, unchecked)
287 //javacflags: ["-Xlint"],
Colin Crosseb652a42017-12-05 09:46:29 -0800288}
289
Colin Cross3a7d8992017-12-05 17:33:58 -0800290// native library
291// =============================================================
292
293cc_library_shared {
294 name: "libandroid_servers",
295 defaults: ["libservices.core-libs"],
296 whole_static_libs: ["libservices.core"],
297}
atrost86895aa2019-08-19 16:51:15 +0100298
299platform_compat_config {
300 name: "services-platform-compat-config",
atrost86895aa2019-08-19 16:51:15 +0100301 src: ":services",
302}
Ulya Trafimovich0d1b063d62019-12-03 11:59:51 +0000303
304filegroup {
305 name: "art-profile",
306 srcs: ["art-profile"],
307}
Jiyong Parkabc72e42019-11-17 15:17:53 +0900308
309// API stub
310// =============================================================
311
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000312soong_config_module_type_import {
313 from: "frameworks/base/api/Android.bp",
314 module_types: ["non_updatable_exportable_droidstubs"],
315}
316
Andrei Onea43114702021-02-10 20:53:12 +0000317stubs_defaults {
318 name: "services-stubs-default",
Jiyong Parkabc72e42019-11-17 15:17:53 +0900319 installable: false,
Anton Hansson84a0e712023-10-23 09:17:45 +0000320 flags: [
321 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)",
322 "--hide-annotation android.annotation.Hide",
323 "--hide InternalClasses", // com.android.* classes are okay in this interface
Anton Hanssonf74130f2020-02-19 18:29:12 +0000324 // TODO: remove the --hide options below
Anton Hansson84a0e712023-10-23 09:17:45 +0000325 "--hide DeprecationMismatch",
326 "--hide HiddenTypedefConstant",
327 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000328 visibility: ["//frameworks/base:__subpackages__"],
Felipe Lemed3895b62021-03-24 16:55:27 -0700329 filter_packages: ["com.android."],
Andrei Onea43114702021-02-10 20:53:12 +0000330}
331
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000332non_updatable_exportable_droidstubs {
Andrei Oneafaa271a2021-03-17 13:32:51 +0000333 name: "services-non-updatable-stubs",
Andrei Onea43114702021-02-10 20:53:12 +0000334 srcs: [":services-non-updatable-sources"],
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000335 defaults: [
336 "services-stubs-default",
337 ],
Andrei Onea43114702021-02-10 20:53:12 +0000338 check_api: {
339 current: {
Andrei Onea8168dc22021-04-30 12:52:36 +0000340 api_file: "api/current.txt",
341 removed_api_file: "api/removed.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000342 },
343 api_lint: {
344 enabled: true,
345 new_since: ":android-non-updatable.api.system-server.latest",
Andrei Onea8168dc22021-04-30 12:52:36 +0000346 baseline_file: "api/lint-baseline.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000347 },
348 },
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000349 soong_config_variables: {
350 release_hidden_api_exportable_stubs: {
351 dists: [
352 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000353 targets: ["sdk"],
354 dir: "apistubs/android/system-server/api",
355 dest: "android-non-updatable.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000356 tag: ".exportable.api.txt",
357 },
358 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000359 targets: ["sdk"],
360 dir: "apistubs/android/system-server/api",
361 dest: "android-non-updatable-removed.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000362 tag: ".exportable.removed-api.txt",
363 },
364 ],
365 conditions_default: {
366 dists: [
367 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000368 targets: ["sdk"],
369 dir: "apistubs/android/system-server/api",
370 dest: "android-non-updatable.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000371 tag: ".api.txt",
372 },
373 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000374 targets: ["sdk"],
375 dir: "apistubs/android/system-server/api",
376 dest: "android-non-updatable-removed.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000377 tag: ".removed-api.txt",
378 },
379 ],
380 },
381 },
382 },
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000383 api_surface: "system-server",
Jihoon Kangfcc577c2024-08-02 18:57:13 +0000384 sdk_version: "module_current",
385 libs: [
386 "framework-annotations-lib",
387 ],
Felipe Lemed3895b62021-03-24 16:55:27 -0700388}