blob: dce6aa71daeaee97bfd4d72a61bb3dc0d7937025 [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: [
111 ":services.core-sources",
Hongwei Wangcdcb68d2020-11-23 12:48:05 -0800112 ":services.core-sources-am-wm",
Colin Cross33b78ef2021-03-26 10:31:25 -0700113 "core/java/com/android/server/am/package.html",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900114 ":services.accessibility-sources",
115 ":services.appprediction-sources",
116 ":services.appwidget-sources",
117 ":services.autofill-sources",
118 ":services.backup-sources",
119 ":services.companion-sources",
120 ":services.contentcapture-sources",
121 ":services.contentsuggestions-sources",
Shashwat Razdan6ef76562024-03-07 13:26:12 -0800122 ":services.contextualsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900123 ":services.coverage-sources",
Helen Qin20ff3552022-09-13 15:47:24 +0000124 ":services.credentials-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900125 ":services.devicepolicy-sources",
126 ":services.midi-sources",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200127 ":services.musicsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900128 ":services.net-sources",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800129 ":services.permission-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900130 ":services.print-sources",
Yi Kong86f85932020-06-29 20:03:55 +0800131 ":services.profcollect-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900132 ":services.restrictions-sources",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800133 ":services.searchui-sources",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800134 ":services.smartspace-sources",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700135 ":services.soundtrigger-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900136 ":services.systemcaptions-sources",
Adam He2653f232020-11-30 18:23:20 -0800137 ":services.translation-sources",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000138 ":services.texttospeech-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900139 ":services.usage-sources",
140 ":services.usb-sources",
141 ":services.voiceinteraction-sources",
Sharon Sua5afd372022-02-01 22:09:36 +0000142 ":services.wallpapereffectsgeneration-sources",
Roshan Piusea33fb92020-02-20 12:49:45 -0800143 ":services.wifi-sources",
TYM Tsaiabf72bd2023-11-21 07:12:21 +0000144 ":framework-pm-common-shared-srcs",
Andrei Onea43114702021-02-10 20:53:12 +0000145 ],
146 visibility: ["//visibility:private"],
147}
148
Felipe Lemefec71a72021-04-01 23:32:53 -0700149java_library {
150 name: "Slogf",
151 srcs: ["core/java/com/android/server/utils/Slogf.java"],
152}
153
“Shadmanae41b3a2024-01-31 04:30:31 +0000154soong_config_module_type {
155 name: "art_profile_java_defaults",
156 module_type: "java_defaults",
157 config_namespace: "art_profile",
158 variables: ["services_profile_path"],
159 properties: ["dex_preopt"],
160}
161
162soong_config_string_variable {
163 name: "services_profile_path",
164 values: ["art_wear_profile"],
165}
166
167art_profile_java_defaults {
168 name: "art_profile_java_defaults",
169 soong_config_variables: {
170 services_profile_path: {
171 art_wear_profile: {
172 dex_preopt: {
173 app_image: true,
174 profile: "art-wear-profile",
175 },
176 },
177 conditions_default: {
178 dex_preopt: {
179 app_image: true,
180 profile: "art-profile",
181 },
182 },
183 },
184 },
185}
186
Colin Crosseb652a42017-12-05 09:46:29 -0800187// merge all required services into one jar
188// ============================================================
Ray China750fad2024-07-11 17:42:10 +0800189soong_config_module_type {
190 name: "system_java_library",
191 module_type: "java_library",
192 config_namespace: "system_services",
193 bool_variables: ["without_vibrator"],
194 properties: ["vintf_fragments"],
195}
196
197system_java_library {
Colin Crosseb652a42017-12-05 09:46:29 -0800198 name: "services",
“Shadmanae41b3a2024-01-31 04:30:31 +0000199 defaults: [
200 "services_java_defaults",
201 "art_profile_java_defaults",
202 ],
Colin Crossa12c0f52018-06-27 11:00:11 -0700203 installable: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800204
Hai Zhang3070d7c2022-11-11 21:48:44 -0800205 exclude_kotlinc_generated_files: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800206
Jiyong Parkbae2e902019-11-17 13:11:19 +0900207 srcs: [":services-main-sources"],
Colin Crosseb652a42017-12-05 09:46:29 -0800208
209 // The convention is to name each service module 'services.$(module_name)'
210 static_libs: [
Colin Cross4c0b06b2017-12-12 19:43:04 -0800211 "services.core",
Colin Crosseb652a42017-12-05 09:46:29 -0800212 "services.accessibility",
Sunny Goyal54e91342018-11-14 11:59:02 -0800213 "services.appprediction",
Colin Crosseb652a42017-12-05 09:46:29 -0800214 "services.appwidget",
215 "services.autofill",
216 "services.backup",
217 "services.companion",
Felipe Leme749b8892018-12-03 16:30:30 -0800218 "services.contentcapture",
Winson Chung3fb0f252019-01-08 17:41:55 -0800219 "services.contentsuggestions",
Shashwat Razdan6ef76562024-03-07 13:26:12 -0800220 "services.contextualsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800221 "services.coverage",
Helen Qin20ff3552022-09-13 15:47:24 +0000222 "services.credentials",
Colin Crosseb652a42017-12-05 09:46:29 -0800223 "services.devicepolicy",
Dave Mankoff0c72a322023-07-12 19:32:11 +0000224 "services.flags",
Colin Crosseb652a42017-12-05 09:46:29 -0800225 "services.midi",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200226 "services.musicsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800227 "services.net",
Danning Chen20b32ed2019-12-18 16:52:03 -0800228 "services.people",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800229 "services.permission",
Colin Crosseb652a42017-12-05 09:46:29 -0800230 "services.print",
Yi Kong86f85932020-06-29 20:03:55 +0800231 "services.profcollect",
Colin Crosseb652a42017-12-05 09:46:29 -0800232 "services.restrictions",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800233 "services.searchui",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800234 "services.smartspace",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700235 "services.soundtrigger",
Robert Berrye14120e2019-03-18 16:33:42 -0400236 "services.systemcaptions",
Adam He2653f232020-11-30 18:23:20 -0800237 "services.translation",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000238 "services.texttospeech",
Colin Crosseb652a42017-12-05 09:46:29 -0800239 "services.usage",
240 "services.usb",
241 "services.voiceinteraction",
Sharon Sua5afd372022-02-01 22:09:36 +0000242 "services.wallpapereffectsgeneration",
Roshan Piusea33fb92020-02-20 12:49:45 -0800243 "services.wifi",
Dmitri Plotnikov4eaac3a2020-05-04 17:00:16 -0700244 "service-blobstore",
245 "service-jobscheduler",
Colin Crosseb652a42017-12-05 09:46:29 -0800246 "android.hidl.base-V1.0-java",
247 ],
248
249 libs: [
250 "android.hidl.manager-V1.0-java",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100251 "framework-tethering.stubs.module_lib",
Jared Duke5123eb32024-03-29 22:52:57 +0000252 "keepanno-annotations",
Chris Wailes09724a72021-02-08 10:00:13 -0800253 "service-art.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700254 "service-permission.stubs.system_server",
Seth Moore0277b662022-10-20 14:14:39 -0700255 "service-rkp.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700256 "service-sdksandbox.stubs.system_server",
Colin Crosseb652a42017-12-05 09:46:29 -0800257 ],
258
Ray China750fad2024-07-11 17:42:10 +0800259 soong_config_variables: {
260 without_vibrator: {
261 vintf_fragments: [
262 "manifest_services.xml",
263 ],
264 conditions_default: {
265 vintf_fragments: [
266 "manifest_services.xml",
267 "manifest_services_android.frameworks.vibrator.xml",
268 ],
269 },
270 },
271 },
Brian Julianeba77a82023-02-01 14:13:45 +0000272
Raphael Kim82701132023-02-15 22:40:07 -0800273 required: [
274 "libukey2_jni_shared",
Jiyong Park20d61792024-03-18 18:05:15 +0900275 "protolog.conf.json.gz",
Jiyong Parkd80202c2024-03-26 12:44:42 +0900276 "core.protolog.pb",
Raphael Kim82701132023-02-15 22:40:07 -0800277 ],
Cole Faust596fe0f2024-01-04 09:37:47 -0800278 lint: {
279 baseline_filename: "lint-baseline.xml",
280 },
Raphael Kim82701132023-02-15 22:40:07 -0800281
Colin Crosseb652a42017-12-05 09:46:29 -0800282 // Uncomment to enable output of certain warnings (deprecated, unchecked)
283 //javacflags: ["-Xlint"],
Colin Crosseb652a42017-12-05 09:46:29 -0800284}
285
Colin Cross3a7d8992017-12-05 17:33:58 -0800286// native library
287// =============================================================
288
289cc_library_shared {
290 name: "libandroid_servers",
291 defaults: ["libservices.core-libs"],
292 whole_static_libs: ["libservices.core"],
293}
atrost86895aa2019-08-19 16:51:15 +0100294
295platform_compat_config {
296 name: "services-platform-compat-config",
atrost86895aa2019-08-19 16:51:15 +0100297 src: ":services",
298}
Ulya Trafimovich0d1b063d62019-12-03 11:59:51 +0000299
300filegroup {
301 name: "art-profile",
302 srcs: ["art-profile"],
303}
Jiyong Parkabc72e42019-11-17 15:17:53 +0900304
305// API stub
306// =============================================================
307
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000308soong_config_module_type_import {
309 from: "frameworks/base/api/Android.bp",
310 module_types: ["non_updatable_exportable_droidstubs"],
311}
312
Andrei Onea43114702021-02-10 20:53:12 +0000313stubs_defaults {
314 name: "services-stubs-default",
Jiyong Parkabc72e42019-11-17 15:17:53 +0900315 installable: false,
Anton Hansson84a0e712023-10-23 09:17:45 +0000316 flags: [
317 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)",
318 "--hide-annotation android.annotation.Hide",
319 "--hide InternalClasses", // com.android.* classes are okay in this interface
Anton Hanssonf74130f2020-02-19 18:29:12 +0000320 // TODO: remove the --hide options below
Anton Hansson84a0e712023-10-23 09:17:45 +0000321 "--hide DeprecationMismatch",
322 "--hide HiddenTypedefConstant",
323 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000324 visibility: ["//frameworks/base:__subpackages__"],
Felipe Lemed3895b62021-03-24 16:55:27 -0700325 filter_packages: ["com.android."],
Andrei Onea43114702021-02-10 20:53:12 +0000326}
327
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000328non_updatable_exportable_droidstubs {
Andrei Oneafaa271a2021-03-17 13:32:51 +0000329 name: "services-non-updatable-stubs",
Andrei Onea43114702021-02-10 20:53:12 +0000330 srcs: [":services-non-updatable-sources"],
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000331 defaults: [
332 "services-stubs-default",
333 ],
Andrei Onea43114702021-02-10 20:53:12 +0000334 check_api: {
335 current: {
Andrei Onea8168dc22021-04-30 12:52:36 +0000336 api_file: "api/current.txt",
337 removed_api_file: "api/removed.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000338 },
339 api_lint: {
340 enabled: true,
341 new_since: ":android-non-updatable.api.system-server.latest",
Andrei Onea8168dc22021-04-30 12:52:36 +0000342 baseline_file: "api/lint-baseline.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000343 },
344 },
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000345 soong_config_variables: {
346 release_hidden_api_exportable_stubs: {
347 dists: [
348 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000349 targets: ["sdk"],
350 dir: "apistubs/android/system-server/api",
351 dest: "android-non-updatable.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000352 tag: ".exportable.api.txt",
353 },
354 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000355 targets: ["sdk"],
356 dir: "apistubs/android/system-server/api",
357 dest: "android-non-updatable-removed.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000358 tag: ".exportable.removed-api.txt",
359 },
360 ],
361 conditions_default: {
362 dists: [
363 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000364 targets: ["sdk"],
365 dir: "apistubs/android/system-server/api",
366 dest: "android-non-updatable.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000367 tag: ".api.txt",
368 },
369 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000370 targets: ["sdk"],
371 dir: "apistubs/android/system-server/api",
372 dest: "android-non-updatable-removed.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000373 tag: ".removed-api.txt",
374 },
375 ],
376 },
377 },
378 },
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000379 api_surface: "system-server",
Felipe Lemed3895b62021-03-24 16:55:27 -0700380}