blob: e8d6630dab68ff94c8ca05b9fa52ee7e9eb39be5 [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",
123 ":services.contentsuggestions-sources",
Shashwat Razdan6ef76562024-03-07 13:26:12 -0800124 ":services.contextualsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900125 ":services.coverage-sources",
Helen Qin20ff3552022-09-13 15:47:24 +0000126 ":services.credentials-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900127 ":services.devicepolicy-sources",
128 ":services.midi-sources",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200129 ":services.musicsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900130 ":services.net-sources",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800131 ":services.permission-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900132 ":services.print-sources",
Yi Kong86f85932020-06-29 20:03:55 +0800133 ":services.profcollect-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900134 ":services.restrictions-sources",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800135 ":services.searchui-sources",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800136 ":services.smartspace-sources",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700137 ":services.soundtrigger-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900138 ":services.systemcaptions-sources",
Adam He2653f232020-11-30 18:23:20 -0800139 ":services.translation-sources",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000140 ":services.texttospeech-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900141 ":services.usage-sources",
142 ":services.usb-sources",
143 ":services.voiceinteraction-sources",
Sharon Sua5afd372022-02-01 22:09:36 +0000144 ":services.wallpapereffectsgeneration-sources",
Roshan Piusea33fb92020-02-20 12:49:45 -0800145 ":services.wifi-sources",
TYM Tsaiabf72bd2023-11-21 07:12:21 +0000146 ":framework-pm-common-shared-srcs",
Andrei Onea43114702021-02-10 20:53:12 +0000147 ],
148 visibility: ["//visibility:private"],
149}
150
Felipe Lemefec71a72021-04-01 23:32:53 -0700151java_library {
152 name: "Slogf",
153 srcs: ["core/java/com/android/server/utils/Slogf.java"],
154}
155
“Shadmanae41b3a2024-01-31 04:30:31 +0000156soong_config_module_type {
157 name: "art_profile_java_defaults",
158 module_type: "java_defaults",
159 config_namespace: "art_profile",
160 variables: ["services_profile_path"],
161 properties: ["dex_preopt"],
162}
163
164soong_config_string_variable {
165 name: "services_profile_path",
166 values: ["art_wear_profile"],
167}
168
169art_profile_java_defaults {
170 name: "art_profile_java_defaults",
171 soong_config_variables: {
172 services_profile_path: {
173 art_wear_profile: {
174 dex_preopt: {
175 app_image: true,
176 profile: "art-wear-profile",
177 },
178 },
179 conditions_default: {
180 dex_preopt: {
181 app_image: true,
182 profile: "art-profile",
183 },
184 },
185 },
186 },
187}
188
Kiyoung Kim32a5c082024-10-11 17:03:55 +0900189vintf_fragment {
190 name: "manifest_services.xml",
191 src: "manifest_services.xml",
192}
193
Colin Crosseb652a42017-12-05 09:46:29 -0800194// merge all required services into one jar
195// ============================================================
196java_library {
197 name: "services",
“Shadmanae41b3a2024-01-31 04:30:31 +0000198 defaults: [
199 "services_java_defaults",
200 "art_profile_java_defaults",
201 ],
Colin Crossa12c0f52018-06-27 11:00:11 -0700202 installable: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800203
Hai Zhang3070d7c2022-11-11 21:48:44 -0800204 exclude_kotlinc_generated_files: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800205
Jiyong Parkbae2e902019-11-17 13:11:19 +0900206 srcs: [":services-main-sources"],
Colin Crosseb652a42017-12-05 09:46:29 -0800207
208 // The convention is to name each service module 'services.$(module_name)'
209 static_libs: [
Colin Cross4c0b06b2017-12-12 19:43:04 -0800210 "services.core",
Colin Crosseb652a42017-12-05 09:46:29 -0800211 "services.accessibility",
Sunny Goyal54e91342018-11-14 11:59:02 -0800212 "services.appprediction",
Colin Crosseb652a42017-12-05 09:46:29 -0800213 "services.appwidget",
214 "services.autofill",
215 "services.backup",
216 "services.companion",
Felipe Leme749b8892018-12-03 16:30:30 -0800217 "services.contentcapture",
Winson Chung3fb0f252019-01-08 17:41:55 -0800218 "services.contentsuggestions",
Shashwat Razdan6ef76562024-03-07 13:26:12 -0800219 "services.contextualsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800220 "services.coverage",
Helen Qin20ff3552022-09-13 15:47:24 +0000221 "services.credentials",
Colin Crosseb652a42017-12-05 09:46:29 -0800222 "services.devicepolicy",
Dave Mankoff0c72a322023-07-12 19:32:11 +0000223 "services.flags",
Colin Crosseb652a42017-12-05 09:46:29 -0800224 "services.midi",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200225 "services.musicsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800226 "services.net",
Danning Chen20b32ed2019-12-18 16:52:03 -0800227 "services.people",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800228 "services.permission",
Colin Crosseb652a42017-12-05 09:46:29 -0800229 "services.print",
Yi Kong86f85932020-06-29 20:03:55 +0800230 "services.profcollect",
Colin Crosseb652a42017-12-05 09:46:29 -0800231 "services.restrictions",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800232 "services.searchui",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800233 "services.smartspace",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700234 "services.soundtrigger",
Robert Berrye14120e2019-03-18 16:33:42 -0400235 "services.systemcaptions",
Adam He2653f232020-11-30 18:23:20 -0800236 "services.translation",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000237 "services.texttospeech",
Colin Crosseb652a42017-12-05 09:46:29 -0800238 "services.usage",
239 "services.usb",
240 "services.voiceinteraction",
Sharon Sua5afd372022-02-01 22:09:36 +0000241 "services.wallpapereffectsgeneration",
Roshan Piusea33fb92020-02-20 12:49:45 -0800242 "services.wifi",
Dmitri Plotnikov4eaac3a2020-05-04 17:00:16 -0700243 "service-blobstore",
244 "service-jobscheduler",
Colin Crosseb652a42017-12-05 09:46:29 -0800245 "android.hidl.base-V1.0-java",
246 ],
247
248 libs: [
249 "android.hidl.manager-V1.0-java",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100250 "framework-tethering.stubs.module_lib",
Jared Duke5123eb32024-03-29 22:52:57 +0000251 "keepanno-annotations",
Chris Wailes09724a72021-02-08 10:00:13 -0800252 "service-art.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700253 "service-permission.stubs.system_server",
Seth Moore0277b662022-10-20 14:14:39 -0700254 "service-rkp.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700255 "service-sdksandbox.stubs.system_server",
Colin Crosseb652a42017-12-05 09:46:29 -0800256 ],
257
Kiyoung Kim32a5c082024-10-11 17:03:55 +0900258 vintf_fragment_modules: [
Brian Julianeba77a82023-02-01 14:13:45 +0000259 "manifest_services.xml",
260 ],
261
Raphael Kim82701132023-02-15 22:40:07 -0800262 required: [
263 "libukey2_jni_shared",
Jiyong Park20d61792024-03-18 18:05:15 +0900264 "protolog.conf.json.gz",
Jiyong Parkd80202c2024-03-26 12:44:42 +0900265 "core.protolog.pb",
Raphael Kim82701132023-02-15 22:40:07 -0800266 ],
Cole Faust596fe0f2024-01-04 09:37:47 -0800267 lint: {
268 baseline_filename: "lint-baseline.xml",
269 },
Raphael Kim82701132023-02-15 22:40:07 -0800270
Colin Crosseb652a42017-12-05 09:46:29 -0800271 // Uncomment to enable output of certain warnings (deprecated, unchecked)
272 //javacflags: ["-Xlint"],
Colin Crosseb652a42017-12-05 09:46:29 -0800273}
274
Colin Cross3a7d8992017-12-05 17:33:58 -0800275// native library
276// =============================================================
277
278cc_library_shared {
279 name: "libandroid_servers",
280 defaults: ["libservices.core-libs"],
281 whole_static_libs: ["libservices.core"],
282}
atrost86895aa2019-08-19 16:51:15 +0100283
284platform_compat_config {
285 name: "services-platform-compat-config",
atrost86895aa2019-08-19 16:51:15 +0100286 src: ":services",
287}
Ulya Trafimovich0d1b063d62019-12-03 11:59:51 +0000288
289filegroup {
290 name: "art-profile",
291 srcs: ["art-profile"],
292}
Jiyong Parkabc72e42019-11-17 15:17:53 +0900293
294// API stub
295// =============================================================
296
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000297soong_config_module_type_import {
298 from: "frameworks/base/api/Android.bp",
299 module_types: ["non_updatable_exportable_droidstubs"],
300}
301
Andrei Onea43114702021-02-10 20:53:12 +0000302stubs_defaults {
303 name: "services-stubs-default",
Jiyong Parkabc72e42019-11-17 15:17:53 +0900304 installable: false,
Anton Hansson84a0e712023-10-23 09:17:45 +0000305 flags: [
306 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)",
307 "--hide-annotation android.annotation.Hide",
308 "--hide InternalClasses", // com.android.* classes are okay in this interface
Anton Hanssonf74130f2020-02-19 18:29:12 +0000309 // TODO: remove the --hide options below
Anton Hansson84a0e712023-10-23 09:17:45 +0000310 "--hide DeprecationMismatch",
311 "--hide HiddenTypedefConstant",
312 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000313 visibility: ["//frameworks/base:__subpackages__"],
Felipe Lemed3895b62021-03-24 16:55:27 -0700314 filter_packages: ["com.android."],
Andrei Onea43114702021-02-10 20:53:12 +0000315}
316
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000317non_updatable_exportable_droidstubs {
Andrei Oneafaa271a2021-03-17 13:32:51 +0000318 name: "services-non-updatable-stubs",
Andrei Onea43114702021-02-10 20:53:12 +0000319 srcs: [":services-non-updatable-sources"],
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000320 defaults: [
321 "services-stubs-default",
322 ],
Andrei Onea43114702021-02-10 20:53:12 +0000323 check_api: {
324 current: {
Andrei Onea8168dc22021-04-30 12:52:36 +0000325 api_file: "api/current.txt",
326 removed_api_file: "api/removed.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000327 },
328 api_lint: {
329 enabled: true,
330 new_since: ":android-non-updatable.api.system-server.latest",
Andrei Onea8168dc22021-04-30 12:52:36 +0000331 baseline_file: "api/lint-baseline.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000332 },
333 },
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000334 soong_config_variables: {
335 release_hidden_api_exportable_stubs: {
336 dists: [
337 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000338 targets: ["sdk"],
339 dir: "apistubs/android/system-server/api",
340 dest: "android-non-updatable.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000341 tag: ".exportable.api.txt",
342 },
343 {
Jihoon Kang00f480e2024-04-10 18:55:36 +0000344 targets: ["sdk"],
345 dir: "apistubs/android/system-server/api",
346 dest: "android-non-updatable-removed.txt",
Jihoon Kang2d295ae2024-03-21 23:57:14 +0000347 tag: ".exportable.removed-api.txt",
348 },
349 ],
350 conditions_default: {
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: ".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: ".removed-api.txt",
363 },
364 ],
365 },
366 },
367 },
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000368 api_surface: "system-server",
Jihoon Kangfcc577c2024-08-02 18:57:13 +0000369 sdk_version: "module_current",
370 libs: [
371 "framework-annotations-lib",
372 ],
Felipe Lemed3895b62021-03-24 16:55:27 -0700373}