blob: 87096928af7c554982651b4cc3f1bbad2bf50b99 [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",
122 ":services.coverage-sources",
Helen Qin20ff3552022-09-13 15:47:24 +0000123 ":services.credentials-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900124 ":services.devicepolicy-sources",
125 ":services.midi-sources",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200126 ":services.musicsearch-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900127 ":services.net-sources",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800128 ":services.permission-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900129 ":services.print-sources",
Yi Kong86f85932020-06-29 20:03:55 +0800130 ":services.profcollect-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900131 ":services.restrictions-sources",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800132 ":services.searchui-sources",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800133 ":services.smartspace-sources",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700134 ":services.soundtrigger-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900135 ":services.systemcaptions-sources",
Adam He2653f232020-11-30 18:23:20 -0800136 ":services.translation-sources",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000137 ":services.texttospeech-sources",
Jiyong Parkbae2e902019-11-17 13:11:19 +0900138 ":services.usage-sources",
139 ":services.usb-sources",
140 ":services.voiceinteraction-sources",
Sharon Sua5afd372022-02-01 22:09:36 +0000141 ":services.wallpapereffectsgeneration-sources",
Roshan Piusea33fb92020-02-20 12:49:45 -0800142 ":services.wifi-sources",
TYM Tsaiabf72bd2023-11-21 07:12:21 +0000143 ":framework-pm-common-shared-srcs",
Andrei Onea43114702021-02-10 20:53:12 +0000144 ],
145 visibility: ["//visibility:private"],
146}
147
Felipe Lemefec71a72021-04-01 23:32:53 -0700148java_library {
149 name: "Slogf",
150 srcs: ["core/java/com/android/server/utils/Slogf.java"],
151}
152
“Shadmanae41b3a2024-01-31 04:30:31 +0000153soong_config_module_type {
154 name: "art_profile_java_defaults",
155 module_type: "java_defaults",
156 config_namespace: "art_profile",
157 variables: ["services_profile_path"],
158 properties: ["dex_preopt"],
159}
160
161soong_config_string_variable {
162 name: "services_profile_path",
163 values: ["art_wear_profile"],
164}
165
166art_profile_java_defaults {
167 name: "art_profile_java_defaults",
168 soong_config_variables: {
169 services_profile_path: {
170 art_wear_profile: {
171 dex_preopt: {
172 app_image: true,
173 profile: "art-wear-profile",
174 },
175 },
176 conditions_default: {
177 dex_preopt: {
178 app_image: true,
179 profile: "art-profile",
180 },
181 },
182 },
183 },
184}
185
Colin Crosseb652a42017-12-05 09:46:29 -0800186// merge all required services into one jar
187// ============================================================
188java_library {
189 name: "services",
“Shadmanae41b3a2024-01-31 04:30:31 +0000190 defaults: [
191 "services_java_defaults",
192 "art_profile_java_defaults",
193 ],
Colin Crossa12c0f52018-06-27 11:00:11 -0700194 installable: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800195
Hai Zhang3070d7c2022-11-11 21:48:44 -0800196 exclude_kotlinc_generated_files: true,
Colin Crosseb652a42017-12-05 09:46:29 -0800197
Jiyong Parkbae2e902019-11-17 13:11:19 +0900198 srcs: [":services-main-sources"],
Colin Crosseb652a42017-12-05 09:46:29 -0800199
200 // The convention is to name each service module 'services.$(module_name)'
201 static_libs: [
Colin Cross4c0b06b2017-12-12 19:43:04 -0800202 "services.core",
Colin Crosseb652a42017-12-05 09:46:29 -0800203 "services.accessibility",
Sunny Goyal54e91342018-11-14 11:59:02 -0800204 "services.appprediction",
Colin Crosseb652a42017-12-05 09:46:29 -0800205 "services.appwidget",
206 "services.autofill",
207 "services.backup",
208 "services.companion",
Felipe Leme749b8892018-12-03 16:30:30 -0800209 "services.contentcapture",
Winson Chung3fb0f252019-01-08 17:41:55 -0800210 "services.contentsuggestions",
Colin Crosseb652a42017-12-05 09:46:29 -0800211 "services.coverage",
Helen Qin20ff3552022-09-13 15:47:24 +0000212 "services.credentials",
Colin Crosseb652a42017-12-05 09:46:29 -0800213 "services.devicepolicy",
Dave Mankoff0c72a322023-07-12 19:32:11 +0000214 "services.flags",
Colin Crosseb652a42017-12-05 09:46:29 -0800215 "services.midi",
Nick Moukhinecf47bdd2020-08-19 16:29:18 +0200216 "services.musicsearch",
Colin Crosseb652a42017-12-05 09:46:29 -0800217 "services.net",
Danning Chen20b32ed2019-12-18 16:52:03 -0800218 "services.people",
Hai Zhang3070d7c2022-11-11 21:48:44 -0800219 "services.permission",
Colin Crosseb652a42017-12-05 09:46:29 -0800220 "services.print",
Yi Kong86f85932020-06-29 20:03:55 +0800221 "services.profcollect",
Colin Crosseb652a42017-12-05 09:46:29 -0800222 "services.restrictions",
Hyunyoung Song21e60a92020-11-20 20:27:54 -0800223 "services.searchui",
Shashwat Razdand33e8c32021-01-29 13:02:19 -0800224 "services.smartspace",
Atneya Nair0d4726f2023-04-07 15:36:29 -0700225 "services.soundtrigger",
Robert Berrye14120e2019-03-18 16:33:42 -0400226 "services.systemcaptions",
Adam He2653f232020-11-30 18:23:20 -0800227 "services.translation",
Alex Agranovich50c987f2021-02-18 09:19:33 +0000228 "services.texttospeech",
Colin Crosseb652a42017-12-05 09:46:29 -0800229 "services.usage",
230 "services.usb",
231 "services.voiceinteraction",
Sharon Sua5afd372022-02-01 22:09:36 +0000232 "services.wallpapereffectsgeneration",
Roshan Piusea33fb92020-02-20 12:49:45 -0800233 "services.wifi",
Dmitri Plotnikov4eaac3a2020-05-04 17:00:16 -0700234 "service-blobstore",
235 "service-jobscheduler",
Colin Crosseb652a42017-12-05 09:46:29 -0800236 "android.hidl.base-V1.0-java",
237 ],
238
239 libs: [
240 "android.hidl.manager-V1.0-java",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100241 "framework-tethering.stubs.module_lib",
Chris Wailes09724a72021-02-08 10:00:13 -0800242 "service-art.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700243 "service-permission.stubs.system_server",
Seth Moore0277b662022-10-20 14:14:39 -0700244 "service-rkp.stubs.system_server",
Jared Duke06689ad2022-09-07 12:24:36 -0700245 "service-sdksandbox.stubs.system_server",
Colin Crosseb652a42017-12-05 09:46:29 -0800246 ],
247
Brian Julianeba77a82023-02-01 14:13:45 +0000248 vintf_fragments: [
249 "manifest_services.xml",
250 ],
251
Raphael Kim82701132023-02-15 22:40:07 -0800252 required: [
253 "libukey2_jni_shared",
254 ],
Cole Faust596fe0f2024-01-04 09:37:47 -0800255 lint: {
256 baseline_filename: "lint-baseline.xml",
257 },
Raphael Kim82701132023-02-15 22:40:07 -0800258
Colin Crosseb652a42017-12-05 09:46:29 -0800259 // Uncomment to enable output of certain warnings (deprecated, unchecked)
260 //javacflags: ["-Xlint"],
Colin Crosseb652a42017-12-05 09:46:29 -0800261}
262
Colin Cross3a7d8992017-12-05 17:33:58 -0800263// native library
264// =============================================================
265
266cc_library_shared {
267 name: "libandroid_servers",
268 defaults: ["libservices.core-libs"],
269 whole_static_libs: ["libservices.core"],
270}
atrost86895aa2019-08-19 16:51:15 +0100271
272platform_compat_config {
273 name: "services-platform-compat-config",
atrost86895aa2019-08-19 16:51:15 +0100274 src: ":services",
275}
Ulya Trafimovich0d1b063d62019-12-03 11:59:51 +0000276
277filegroup {
278 name: "art-profile",
279 srcs: ["art-profile"],
280}
Jiyong Parkabc72e42019-11-17 15:17:53 +0900281
282// API stub
283// =============================================================
284
Andrei Onea43114702021-02-10 20:53:12 +0000285stubs_defaults {
286 name: "services-stubs-default",
Jiyong Parkabc72e42019-11-17 15:17:53 +0900287 installable: false,
Anton Hansson84a0e712023-10-23 09:17:45 +0000288 flags: [
289 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)",
290 "--hide-annotation android.annotation.Hide",
291 "--hide InternalClasses", // com.android.* classes are okay in this interface
Anton Hanssonf74130f2020-02-19 18:29:12 +0000292 // TODO: remove the --hide options below
Anton Hansson84a0e712023-10-23 09:17:45 +0000293 "--hide DeprecationMismatch",
294 "--hide HiddenTypedefConstant",
295 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000296 visibility: ["//frameworks/base:__subpackages__"],
Felipe Lemed3895b62021-03-24 16:55:27 -0700297 filter_packages: ["com.android."],
Andrei Onea43114702021-02-10 20:53:12 +0000298}
299
300droidstubs {
Andrei Oneafaa271a2021-03-17 13:32:51 +0000301 name: "services-non-updatable-stubs",
Andrei Onea43114702021-02-10 20:53:12 +0000302 srcs: [":services-non-updatable-sources"],
303 defaults: ["services-stubs-default"],
304 check_api: {
305 current: {
Andrei Onea8168dc22021-04-30 12:52:36 +0000306 api_file: "api/current.txt",
307 removed_api_file: "api/removed.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000308 },
309 api_lint: {
310 enabled: true,
311 new_since: ":android-non-updatable.api.system-server.latest",
Andrei Onea8168dc22021-04-30 12:52:36 +0000312 baseline_file: "api/lint-baseline.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000313 },
314 },
315 dists: [
316 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000317 targets: ["sdk"],
Andrei Onea43114702021-02-10 20:53:12 +0000318 dir: "apistubs/android/system-server/api",
319 dest: "android-non-updatable.txt",
Felipe Lemed3895b62021-03-24 16:55:27 -0700320 tag: ".api.txt",
Andrei Onea43114702021-02-10 20:53:12 +0000321 },
322 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000323 targets: ["sdk"],
Andrei Onea43114702021-02-10 20:53:12 +0000324 dir: "apistubs/android/system-server/api",
325 dest: "android-non-updatable-removed.txt",
326 tag: ".removed-api.txt",
327 },
Felipe Lemed3895b62021-03-24 16:55:27 -0700328 ],
Jihoon Kang866b9b72023-09-20 22:28:05 +0000329 api_surface: "system-server",
Felipe Lemed3895b62021-03-24 16:55:27 -0700330}