1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_base_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
}
// Defaults for platform code that runs inside system_server
java_defaults {
name: "platform_service_defaults",
plugins: ["error_prone_android_framework"],
errorprone: {
javacflags: [
// "-Xep:AndroidFrameworkBinderIdentity:ERROR",
"-Xep:AndroidFrameworkCompatChange:ERROR",
// "-Xep:AndroidFrameworkUid:ERROR",
"-Xep:SelfEquals:ERROR",
"-Xep:NullTernary:ERROR",
"-Xep:TryFailThrowable:ERROR",
"-Xep:HashtableContains:ERROR",
"-Xep:FormatString:ERROR",
"-Xep:ArrayHashCode:ERROR",
"-Xep:SelfAssignment:ERROR",
"-Xep:ArrayEquals:ERROR",
"-Xep:IdentityBinaryExpression:ERROR",
// NOTE: only enable to generate local patchfiles
// "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster",
// "-XepPatchLocation:/tmp/refaster/",
],
},
lint: {
extra_check_modules: ["AndroidFrameworkLintChecker"],
},
}
// Opt-in config for optimizing and shrinking the services target using R8.
// Enabled via `export SYSTEM_OPTIMIZE_JAVA=true`, or explicitly in Make via the
// `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA` variable.
// TODO(b/196084106): Enable optimizations by default after stabilizing and
// building out retrace infrastructure.
soong_config_module_type {
name: "system_optimized_java_defaults",
module_type: "java_defaults",
config_namespace: "ANDROID",
bool_variables: ["SYSTEM_OPTIMIZE_JAVA"],
properties: ["optimize"],
}
system_optimized_java_defaults {
name: "services_java_defaults",
soong_config_variables: {
SYSTEM_OPTIMIZE_JAVA: {
optimize: {
enabled: true,
// TODO(b/210510433): Enable optimizations after improving
// retracing infra.
optimize: false,
shrink: true,
proguard_flags_files: ["proguard.flags"],
},
// Note: Optimizations are disabled by default if unspecified in
// the java_library rule.
conditions_default: {},
},
},
}
filegroup {
name: "services-main-sources",
srcs: [
"java/**/*.java",
"java/**/package.html",
],
path: "java",
visibility: ["//visibility:private"],
}
filegroup {
name: "services-non-updatable-sources",
srcs: [
":services.core-sources",
":services.core-sources-am-wm",
"core/java/com/android/server/am/package.html",
":services.accessibility-sources",
":services.appprediction-sources",
":services.appwidget-sources",
":services.autofill-sources",
":services.backup-sources",
":services.bluetooth-sources", // TODO(b/214988855) : Remove once apex/service-bluetooth jar is ready
":backuplib-sources",
":services.companion-sources",
":services.contentcapture-sources",
":services.contentsuggestions-sources",
":services.coverage-sources",
":services.devicepolicy-sources",
":services.midi-sources",
":services.musicsearch-sources",
":services.net-sources",
":services.print-sources",
":services.profcollect-sources",
":services.restrictions-sources",
":services.searchui-sources",
":services.smartspace-sources",
":services.speech-sources",
":services.systemcaptions-sources",
":services.translation-sources",
":services.texttospeech-sources",
":services.usage-sources",
":services.usb-sources",
":services.voiceinteraction-sources",
":services.wallpapereffectsgeneration-sources",
":services.wifi-sources",
],
visibility: ["//visibility:private"],
}
java_library {
name: "Slogf",
srcs: ["core/java/com/android/server/utils/Slogf.java"],
}
// merge all required services into one jar
// ============================================================
java_library {
name: "services",
defaults: ["services_java_defaults"],
installable: true,
dex_preopt: {
app_image: true,
profile: "art-profile",
},
srcs: [":services-main-sources"],
// The convention is to name each service module 'services.$(module_name)'
static_libs: [
"services.core",
"services.accessibility",
"services.appprediction",
"services.appwidget",
"services.autofill",
"services.backup",
"services.companion",
"services.contentcapture",
"services.contentsuggestions",
"services.coverage",
"services.devicepolicy",
"services.midi",
"services.musicsearch",
"services.net",
"services.people",
"services.print",
"services.profcollect",
"services.restrictions",
"services.searchui",
"services.smartspace",
"services.speech",
"services.systemcaptions",
"services.translation",
"services.texttospeech",
"services.usage",
"services.usb",
"services.voiceinteraction",
"services.wallpapereffectsgeneration",
"services.wifi",
"service-blobstore",
"service-jobscheduler",
"android.hidl.base-V1.0-java",
],
libs: [
"android.hidl.manager-V1.0-java",
"framework-tethering.stubs.module_lib",
"service-art.stubs.system_server",
],
// Uncomment to enable output of certain warnings (deprecated, unchecked)
//javacflags: ["-Xlint"],
}
// native library
// =============================================================
cc_library_shared {
name: "libandroid_servers",
defaults: ["libservices.core-libs"],
whole_static_libs: ["libservices.core"],
}
platform_compat_config {
name: "services-platform-compat-config",
src: ":services",
}
filegroup {
name: "art-profile",
srcs: ["art-profile"],
}
// API stub
// =============================================================
stubs_defaults {
name: "services-stubs-default",
installable: false,
args: " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)" +
" --hide-annotation android.annotation.Hide" +
" --hide InternalClasses" + // com.android.* classes are okay in this interface
// TODO: remove the --hide options below
" --hide DeprecationMismatch" +
" --hide HiddenTypedefConstant",
visibility: ["//frameworks/base:__subpackages__"],
filter_packages: ["com.android."],
}
droidstubs {
name: "services-non-updatable-stubs",
srcs: [":services-non-updatable-sources"],
defaults: ["services-stubs-default"],
check_api: {
current: {
api_file: "api/current.txt",
removed_api_file: "api/removed.txt",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.system-server.latest",
baseline_file: "api/lint-baseline.txt",
},
},
dists: [
{
targets: ["sdk"],
dir: "apistubs/android/system-server/api",
dest: "android-non-updatable.txt",
tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/system-server/api",
dest: "android-non-updatable-removed.txt",
tag: ".removed-api.txt",
},
],
}
|