-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathAndroid.bp
More file actions
339 lines (321 loc) · 12.9 KB
/
Android.bp
File metadata and controls
339 lines (321 loc) · 12.9 KB
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
package {
default_visibility: [":__subpackages__"],
default_applicable_licenses: ["system_bt_license"],
default_team: "trendy_team_bluetooth",
}
// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
name: "system_bt_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-MIT",
"legacy_unencumbered",
],
license_text: [
"NOTICE",
],
}
filegroup {
name: "BluetoothGTestConfigTemplate",
srcs: [
"BluetoothGTestTemplate.xml",
],
}
filegroup {
name: "BluetoothRustTestConfigTemplate",
srcs: [
"BluetoothRustTestTemplate.xml",
],
}
// This default contains properties that should be common to all the cc targets
// developed by the Bluetooth team.
//
// Be careful when adding new properties here:
// - The option should not impact negatively any target, for example "-Wno-*"
// options should not be added here but instead on every targets needing
// them to avoid allowing adding new warnings in targets that didn't contained
// them (you can use the bpmodify tool to ease the work of adding this warning
// everywhere) and also allows cleaning them one at a time.
//
// - The option should apply to all the c/c++ code developed by the Bluetooth team:
// test, tools, fuzzers, etc, not only production targets, if you need to add an option
// for a subset of Bluetooth cc targets you should look at the defaults including this
// defaults like "fluoride_defaults" and "gd_defaults".
//
// - Try to keep the name as precise as possible to document to the dependent of what
// this default contains. This also means that if you add a new option that isn't
// documented by the name of this default, rename it.
//
// - Try avoiding adding option that would not fit "future" targets, for example dependencies,
// even if every modules of Bluetooth depends on a specific dependency it should be left out
// from this default to not push it for future targets that might not need it.
cc_defaults {
name: "bluetooth_cflags",
cflags: [
"-Wall",
"-Werror",
"-Wextra",
"-Wmissing-prototypes",
// Override global.go that demote the error to a warning
"-Werror=format",
"-Werror=reorder-init-list",
"-Werror=unused-variable",
"-Wthread-safety",
],
c_std: "c99",
cpp_std: "c++20",
}
// Base configuration for Bluetooth fuzz targets.
cc_defaults {
name: "bluetooth_fuzz_config",
fuzz_config: {
componentid: 27441, // Android > Android OS & Apps > Systems > bluetooth
fuzzed_code_usage: "shipped",
service_privilege: "privileged",
vector: "remote",
users: "single_user",
cc: [
"android-bluetooth-security@google.com",
"android-security-assurance-redteam@google.com",
],
hotlists: [
"3705175", // ASA Red Team Discovered Issues
"4593311", // Ittiam Fuzzer Bug
"4810445", // ASA Red Team: Bluetooth Engagement Issues
],
acknowledgement: [
"Android Bluetooth Team of Google",
"Android Red Team of Google",
],
},
}
// List of tidy checks that are enabled for cc targets.
// Note that the goal is not to enable all checks, many of them will
// appear as noise especially in the modernize-* range.
bluetooth_tidy_checks = [
"-*",
"misc-*",
// Checks for unused and missing includes.
// Should be enabled as an alternative to IWYU, but currently generates
// too many warnings.
"-misc-include-cleaner",
// This check implements detection of local variables which could be declared
// as const but are not.
"-misc-const-correctness",
// Finds classes that contain non-static data members in addition to user-declared
// non-static member functions and diagnose all data members declared with a
// non-public access specifier.
"-misc-non-private-member-variables-in-classes",
]
// This default tidy checks that will be run against all the cc targets
// developed by the Bluetooth team.
cc_defaults {
name: "bluetooth_tidy",
tidy: true,
tidy_checks: bluetooth_tidy_checks,
tidy_checks_as_errors: bluetooth_tidy_checks,
}
java_defaults {
name: "bluetooth_errorprone_rules",
errorprone: {
enabled: true,
javacflags: [
"-Xep:AlmostJavadoc:ERROR",
"-Xep:AlreadyChecked:ERROR",
"-Xep:AmbiguousMethodReference:ERROR",
"-Xep:ArrayRecordComponent:ERROR",
"-Xep:AssignmentExpression:ERROR",
"-Xep:AttemptedNegativeZero:ERROR",
"-Xep:BadImport:ERROR",
"-Xep:BadInstanceof:ERROR",
"-Xep:CatchAndPrintStackTrace:ERROR",
"-Xep:CatchFail:ERROR",
"-Xep:CheckReturnValue:ERROR",
"-Xep:ClassCanBeStatic:ERROR",
"-Xep:DateFormatConstant:ERROR",
"-Xep:DirectInvocationOnMock:ERROR",
"-Xep:DuplicateBranches:ERROR",
"-Xep:EffectivelyPrivate:ERROR",
"-Xep:EmptyBlockTag:ERROR",
"-Xep:EmptyCatch:ERROR",
"-Xep:EnumOrdinal:ERROR",
"-Xep:EqualsGetClass:ERROR",
"-Xep:EqualsHashCode:ERROR",
"-Xep:EqualsIncompatibleType:ERROR",
"-Xep:FallThrough:ERROR",
// "-Xep:FieldCanBeFinal:ERROR", // TODO: b/410743019 - enable this check
"-Xep:FieldCanBeLocal:ERROR",
"-Xep:FieldCanBeStatic:ERROR",
"-Xep:Finalize:ERROR",
"-Xep:ForEachIterable:ERROR",
"-Xep:FutureReturnValueIgnored:ERROR",
"-Xep:GuardedBy:ERROR",
"-Xep:HidingField:ERROR",
"-Xep:InconsistentHashCode:ERROR",
"-Xep:IncrementInForLoopAndHeader:ERROR",
"-Xep:InlineFormatString:ERROR",
"-Xep:InlineMeInliner:ERROR",
"-Xep:IntLiteralCast:ERROR",
"-Xep:InvalidBlockTag:ERROR",
"-Xep:InvalidInlineTag:ERROR",
"-Xep:InvalidLink:ERROR",
"-Xep:InvalidParam:ERROR",
"-Xep:JUnit4EmptyMethods:ERROR",
"-Xep:JavaLangClash:ERROR",
"-Xep:JavaUtilDate:ERROR",
"-Xep:JdkObsolete:ERROR",
"-Xep:LockOnNonEnclosingClassLiteral:ERROR",
"-Xep:LongFloatConversion:ERROR",
"-Xep:LoopOverCharArray:ERROR",
"-Xep:MethodCanBeStatic:ERROR",
"-Xep:MissingCasesInEnumSwitch:ERROR",
"-Xep:MissingDefault:ERROR",
"-Xep:MixedMutabilityReturnType:ERROR",
"-Xep:MockNotUsedInProduction:ERROR",
"-Xep:ModifiedButNotUsed:ERROR",
"-Xep:ModifyCollectionInEnhancedForLoop:ERROR",
"-Xep:NarrowCalculation:ERROR",
"-Xep:NarrowingCompoundAssignment:ERROR",
"-Xep:NonApiType:ERROR",
"-Xep:NonAtomicVolatileUpdate:ERROR",
"-Xep:NonCanonicalStaticMemberImport:ERROR",
"-Xep:NonCanonicalType:ERROR",
"-Xep:NotJavadoc:ERROR",
"-Xep:NullOptional:ERROR",
"-Xep:NullableOptional:ERROR",
"-Xep:NullablePrimitive:ERROR",
"-Xep:NullableVoid:ERROR",
"-Xep:ObjectEqualsForPrimitives:ERROR",
// "-Xep:ObjectToString:ERROR", // Wrongfully reporting errors
"-Xep:OperatorPrecedence:ERROR",
"-Xep:RedundantControlFlow:ERROR",
"-Xep:ReferenceEquality:ERROR",
"-Xep:ReturnAtTheEndOfVoidFunction:ERROR",
"-Xep:ReturnFromVoid:ERROR",
"-Xep:SelfAssertion:ERROR",
"-Xep:StatementSwitchToExpressionSwitch:ERROR",
"-Xep:StaticAssignmentInConstructor:ERROR",
"-Xep:StaticGuardedByInstance:ERROR",
"-Xep:StringCaseLocaleUsage:ERROR",
"-Xep:StringCharset:ERROR",
"-Xep:StringConcatToTextBlock:ERROR",
// "-Xep:StringSplitter:ERROR", // Not enabled in android platform
"-Xep:SwitchDefault:ERROR",
"-Xep:SynchronizeOnNonFinalField:ERROR",
"-Xep:ThreadJoinLoop:ERROR",
"-Xep:ToStringReturnsNull:ERROR",
"-Xep:TraditionalSwitchExpression:ERROR",
"-Xep:TruthAssertExpected:ERROR",
"-Xep:TruthConstantAsserts:ERROR",
"-Xep:TruthGetOrDefault:ERROR",
"-Xep:TruthIncompatibleType:ERROR",
"-Xep:UndefinedEquals:ERROR",
"-Xep:UnnecessaryAssignment:ERROR",
"-Xep:UnnecessaryAsync:ERROR",
"-Xep:UnnecessaryBreakInSwitch:ERROR",
"-Xep:UnnecessaryDefaultInEnumSwitch:ERROR",
"-Xep:UnnecessaryStringBuilder:ERROR",
"-Xep:UnrecognisedJavadocTag:ERROR",
"-Xep:UnusedMethod:ERROR",
"-Xep:UnusedNestedClass:ERROR",
"-Xep:UnusedTypeParameter:ERROR",
"-Xep:UnusedVariable:ERROR",
"-Xep:UseEnumSwitch:ERROR",
"-Xep:VariableNameSameAsType:ERROR",
"-Xep:WaitNotInLoop:ERROR",
"-Xep:WakelockReleasedDangerously:ERROR",
// Exclude generated files
"-XepExcludedPaths:.*/srcjars/.*",
// The @InlineMe annotation could be made available, but it would
// apply on external facing API. This is not desired.
// For more context, see https://r.android.com/3303475
"-Xep:InlineMeSuggester:OFF",
],
},
}
java_defaults {
name: "bluetooth_framework_errorprone_rules",
defaults: ["bluetooth_errorprone_rules"],
errorprone: {
extra_check_modules: ["error_prone_android_framework"],
javacflags: [
"-Xep:AndroidFrameworkBinderIdentity:ERROR",
"-Xep:AndroidFrameworkBluetoothPermission:ERROR",
"-Xep:AndroidFrameworkCompatChange:ERROR",
"-Xep:AndroidFrameworkEfficientParcelable:ERROR",
"-Xep:AndroidFrameworkEfficientStrings:ERROR",
"-Xep:AndroidFrameworkPendingIntentMutability:ERROR",
"-Xep:AndroidFrameworkRequiresPermission:ERROR",
"-Xep:AndroidFrameworkRethrowFromSystem:ERROR",
"-Xep:AndroidFrameworkTargetSdk:ERROR",
"-Xep:AndroidHideInComments:ERROR",
// After fixing this errorprone, we decided to not merge the change.
// It is not very readable and the benefits are minimal when looking
// at the size of the maps used in the Bluetooth application.
// See https://r.android.com/3200511
"-Xep:AndroidFrameworkEfficientCollections:OFF",
// Does not look pertinent in our situation
"-Xep:AndroidFrameworkEfficientXml:OFF",
],
},
}
java_defaults {
name: "bluetooth_lint_rules",
lint: {
error_checks: [
"Autofill",
"DefaultLocale",
"DuplicateDefinition",
// "ExportedContentProvider", // TODO: b/289445022 - enable this check
// "ExportedReceiver", // TODO: b/289445022 - enable this check
// "ExportedService", // TODO: b/289445022 - enable this check
"ExtraText",
"ExtraTranslation",
"GestureBackNavigation",
"GuardedLogInvocation",
"HandlerLeak",
"InflateParams",
// "InvalidPermission", // TODO: b/289445022 - enable this check
"LabelFor",
"MissingClass",
// "MissingVersion", // TODO: b/289445022 - enable this check
"MonochromeLauncherIcon",
"NewApi",
"ObsoleteSdkInt",
// "QueryAllPackagesPermission", // TODO: b/289445022 - enable this check
"Recycle",
"RtlHardcoded",
"RtlSymmetry",
"ScrollViewSize",
"SetTextI18n",
"SimpleDateFormat",
"StaticFieldLeak",
"StringFormatCount",
"StringFormatInvalid",
"TextFields",
"TypographyEllipsis",
"UseSparseArrays",
"UseValueOf",
"VectorPath",
"VisibleForTests",
"Wakelock",
"WakelockTimeout",
],
extra_check_modules: ["BluetoothLintChecker"],
},
}