Skip to content

Commit 6e4ecf7

Browse files
committed
Add a lint check to flag usages of Thread.sleep
Bug: 266129370 Test: Added new tests and ran updateLintBaseline Change-Id: Ic77a962a53519674e4b45a63dace8f496edd3522 Merged-In: Ic77a962a53519674e4b45a63dace8f496edd3522
1 parent 1f6e037 commit 6e4ecf7

File tree

94 files changed

+6814
-3210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6814
-3210
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
3+
4+
<issue
5+
id="BanThreadSleep"
6+
message="Uses Thread.sleep()"
7+
errorLine1=" Thread.sleep(millis);"
8+
errorLine2=" ~~~~~">
9+
<location
10+
file="src/androidTest/java/androidx/ads/identifier/benchmark/AdvertisingIdBenchmark.java"/>
11+
</issue>
12+
13+
</issues>

ads/ads-identifier/lint-baseline.xml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
3+
4+
<issue
5+
id="BanThreadSleep"
6+
message="Uses Thread.sleep()"
7+
errorLine1=" Thread.sleep(20000);"
8+
errorLine2=" ~~~~~">
9+
<location
10+
file="src/androidTest/java/androidx/ads/identifier/AdvertisingIdClientTest.java"/>
11+
</issue>
12+
13+
<issue
14+
id="BanThreadSleep"
15+
message="Uses Thread.sleep()"
16+
errorLine1=" Thread.sleep(11000);"
17+
errorLine2=" ~~~~~">
18+
<location
19+
file="src/androidTest/java/androidx/ads/identifier/AdvertisingIdClientTest.java"/>
20+
</issue>
21+
22+
<issue
23+
id="BanThreadSleep"
24+
message="Uses Thread.sleep()"
25+
errorLine1=" Thread.sleep(20000);"
26+
errorLine2=" ~~~~~">
27+
<location
28+
file="src/androidTest/java/androidx/ads/identifier/AdvertisingIdClientTest.java"/>
29+
</issue>
30+
31+
<issue
32+
id="BanThreadSleep"
33+
message="Uses Thread.sleep()"
34+
errorLine1=" Thread.sleep(20000);"
35+
errorLine2=" ~~~~~">
36+
<location
37+
file="src/androidTest/java/androidx/ads/identifier/AdvertisingIdClientTest.java"/>
38+
</issue>
39+
40+
<issue
41+
id="BanThreadSleep"
42+
message="Uses Thread.sleep()"
43+
errorLine1=" Thread.sleep(11000);"
44+
errorLine2=" ~~~~~">
45+
<location
46+
file="src/androidTest/java/androidx/ads/identifier/AdvertisingIdClientTest.java"/>
47+
</issue>
48+
49+
</issues>

appcompat/appcompat-resources/lint-baseline.xml

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<issues format="6" by="lint 7.4.0-alpha08" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.0-alpha08)" variant="all" version="7.4.0-alpha08">
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="cli" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
33

44
<issue
55
id="NewApi"
@@ -107,9 +107,6 @@
107107
errorLine2=" ~~~~~~~~">
108108
<location
109109
file="src/main/java/androidx/appcompat/widget/TintContextWrapper.java"/>
110-
<location
111-
file="src/main/java/androidx/appcompat/widget/TintContextWrapper.java"
112-
message="Setter here"/>
113110
</issue>
114111

115112
<issue
@@ -193,15 +190,6 @@
193190
file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
194191
</issue>
195192

196-
<issue
197-
id="UnknownNullness"
198-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
199-
errorLine1=" public void draw(Canvas canvas) {"
200-
errorLine2=" ~~~~~~">
201-
<location
202-
file="src/main/java/androidx/appcompat/graphics/drawable/DrawableWrapperCompat.java"/>
203-
</issue>
204-
205193
<issue
206194
id="UnknownNullness"
207195
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"

appcompat/appcompat/lint-baseline.xml

+118-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<issues format="6" by="lint 8.0.0-alpha07" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-alpha07)" variant="all" version="8.0.0-alpha07">
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
33

44
<issue
55
id="NewApi"
@@ -208,6 +208,123 @@
208208
file="src/main/java/androidx/appcompat/widget/AppCompatSeekBar.java"/>
209209
</issue>
210210

211+
<issue
212+
id="BanThreadSleep"
213+
message="Uses Thread.sleep()"
214+
errorLine1=" Thread.sleep(1000);"
215+
errorLine2=" ~~~~~">
216+
<location
217+
file="src/androidTest/java/androidx/appcompat/app/AlertDialogTest.java"/>
218+
</issue>
219+
220+
<issue
221+
id="BanThreadSleep"
222+
message="Uses Thread.sleep()"
223+
errorLine1=" Thread.sleep(1000);"
224+
errorLine2=" ~~~~~">
225+
<location
226+
file="src/androidTest/java/androidx/appcompat/app/AlertDialogTest.java"/>
227+
</issue>
228+
229+
<issue
230+
id="BanThreadSleep"
231+
message="Uses Thread.sleep()"
232+
errorLine1=" Thread.sleep(1000);"
233+
errorLine2=" ~~~~~">
234+
<location
235+
file="src/androidTest/java/androidx/appcompat/app/AlertDialogTest.java"/>
236+
</issue>
237+
238+
<issue
239+
id="BanThreadSleep"
240+
message="Uses Thread.sleep()"
241+
errorLine1=" Thread.sleep(1000);"
242+
errorLine2=" ~~~~~">
243+
<location
244+
file="src/androidTest/java/androidx/appcompat/app/AlertDialogTest.java"/>
245+
</issue>
246+
247+
<issue
248+
id="BanThreadSleep"
249+
message="Uses Thread.sleep()"
250+
errorLine1=" Thread.sleep(1000);"
251+
errorLine2=" ~~~~~">
252+
<location
253+
file="src/androidTest/java/androidx/appcompat/app/AlertDialogTest.java"/>
254+
</issue>
255+
256+
<issue
257+
id="BanThreadSleep"
258+
message="Uses Thread.sleep()"
259+
errorLine1=" Thread.sleep(1000);"
260+
errorLine2=" ~~~~~">
261+
<location
262+
file="src/androidTest/java/androidx/appcompat/app/AlertDialogTest.java"/>
263+
</issue>
264+
265+
<issue
266+
id="BanThreadSleep"
267+
message="Uses Thread.sleep()"
268+
errorLine1=" Thread.sleep(50)"
269+
errorLine2=" ~~~~~">
270+
<location
271+
file="src/androidTest/java/androidx/appcompat/widget/AppCompatAttributeTest.kt"/>
272+
</issue>
273+
274+
<issue
275+
id="BanThreadSleep"
276+
message="Uses Thread.sleep()"
277+
errorLine1=" Thread.sleep(200);"
278+
errorLine2=" ~~~~~">
279+
<location
280+
file="src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java"/>
281+
</issue>
282+
283+
<issue
284+
id="BanThreadSleep"
285+
message="Uses Thread.sleep()"
286+
errorLine1=" Thread.sleep(/* millis = */ 2000)"
287+
errorLine2=" ~~~~~">
288+
<location
289+
file="src/androidTest/java/androidx/appcompat/app/LocalesConfigChangedUsingInvalidTopLocale.kt"/>
290+
</issue>
291+
292+
<issue
293+
id="BanThreadSleep"
294+
message="Uses Thread.sleep()"
295+
errorLine1=" Thread.sleep(/* millis = */ 2000)"
296+
errorLine2=" ~~~~~">
297+
<location
298+
file="src/androidTest/java/androidx/appcompat/app/LocalesConfigChangedUsingInvalidTopLocale.kt"/>
299+
</issue>
300+
301+
<issue
302+
id="BanThreadSleep"
303+
message="Uses Thread.sleep()"
304+
errorLine1=" Thread.sleep(/* timeout= */ 1000)"
305+
errorLine2=" ~~~~~">
306+
<location
307+
file="src/androidTest/java/androidx/appcompat/app/LocalesSyncToFrameworkTestCase.kt"/>
308+
</issue>
309+
310+
<issue
311+
id="BanThreadSleep"
312+
message="Uses Thread.sleep()"
313+
errorLine1=" Thread.sleep(1000);"
314+
errorLine2=" ~~~~~">
315+
<location
316+
file="src/androidTest/java/androidx/appcompat/widget/PopupMenuTest.java"/>
317+
</issue>
318+
319+
<issue
320+
id="BanThreadSleep"
321+
message="Uses Thread.sleep()"
322+
errorLine1=" Thread.sleep(1000);"
323+
errorLine2=" ~~~~~">
324+
<location
325+
file="src/androidTest/java/androidx/appcompat/widget/PopupMenuTest.java"/>
326+
</issue>
327+
211328
<issue
212329
id="BanUncheckedReflection"
213330
message="Calling `Method.invoke` without an SDK check"
@@ -341,9 +458,6 @@
341458
errorLine2=" ~~~~~~~~~~~~~~~">
342459
<location
343460
file="src/main/java/androidx/appcompat/widget/ActionBarContainer.java"/>
344-
<location
345-
file="src/main/java/androidx/appcompat/widget/ActionBarContainer.java"
346-
message="Setter here"/>
347461
</issue>
348462

349463
<issue
@@ -362,9 +476,6 @@
362476
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
363477
<location
364478
file="src/main/java/androidx/appcompat/app/AppCompatActivity.java"/>
365-
<location
366-
file="src/main/java/androidx/appcompat/app/AppCompatActivity.java"
367-
message="Setter here"/>
368479
</issue>
369480

370481
<issue
@@ -374,9 +485,6 @@
374485
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
375486
<location
376487
file="src/main/java/androidx/appcompat/app/AppCompatDelegate.java"/>
377-
<location
378-
file="src/main/java/androidx/appcompat/app/AppCompatDelegate.java"
379-
message="Setter here"/>
380488
</issue>
381489

382490
<issue
@@ -386,9 +494,6 @@
386494
errorLine2=" ~~~~~~~~">
387495
<location
388496
file="src/main/java/androidx/appcompat/view/ContextThemeWrapper.java"/>
389-
<location
390-
file="src/main/java/androidx/appcompat/view/ContextThemeWrapper.java"
391-
message="Setter here"/>
392497
</issue>
393498

394499
<issue
@@ -434,9 +539,6 @@
434539
errorLine2=" ~~~~~~~~~~">
435540
<location
436541
file="src/main/java/androidx/appcompat/view/menu/MenuItemImpl.java"/>
437-
<location
438-
file="src/main/java/androidx/appcompat/view/menu/MenuItemImpl.java"
439-
message="Setter here"/>
440542
</issue>
441543

442544
<issue

arch/core/core-testing/lint-baseline.xml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<issues format="6" by="lint 7.4.0-alpha08" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.0-alpha08)" variant="all" version="7.4.0-alpha08">
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
3+
4+
<issue
5+
id="BanThreadSleep"
6+
message="Uses Thread.sleep()"
7+
errorLine1=" Thread.sleep(300);"
8+
errorLine2=" ~~~~~">
9+
<location
10+
file="src/androidTest/java/androidx/arch/core/executor/testing/CountingTaskExecutorRuleTest.java"/>
11+
</issue>
312

413
<issue
514
id="UnknownNullness"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
3+
4+
<issue
5+
id="BanThreadSleep"
6+
message="Uses Thread.sleep()"
7+
errorLine1=" Thread.sleep(TimeUnit.SECONDS.toMillis(sleepSeconds))"
8+
errorLine2=" ~~~~~">
9+
<location
10+
file="src/main/java/androidx/benchmark/BenchmarkState.kt"/>
11+
</issue>
12+
13+
<issue
14+
id="BanThreadSleep"
15+
message="Uses Thread.sleep()"
16+
errorLine1=" Thread.sleep(CONNECTED_PROFILING_SLEEP_MS)"
17+
errorLine2=" ~~~~~">
18+
<location
19+
file="src/main/java/androidx/benchmark/Profiler.kt"/>
20+
</issue>
21+
22+
<issue
23+
id="BanThreadSleep"
24+
message="Uses Thread.sleep()"
25+
errorLine1=" Thread.sleep(CONNECTED_PROFILING_SLEEP_MS)"
26+
errorLine2=" ~~~~~">
27+
<location
28+
file="src/main/java/androidx/benchmark/Profiler.kt"/>
29+
</issue>
30+
31+
<issue
32+
id="BanThreadSleep"
33+
message="Uses Thread.sleep()"
34+
errorLine1=" Thread.sleep(CONNECTED_PROFILING_SLEEP_MS)"
35+
errorLine2=" ~~~~~">
36+
<location
37+
file="src/main/java/androidx/benchmark/Profiler.kt"/>
38+
</issue>
39+
40+
<issue
41+
id="BanThreadSleep"
42+
message="Uses Thread.sleep()"
43+
errorLine1=" Thread.sleep(CONNECTED_PROFILING_SLEEP_MS)"
44+
errorLine2=" ~~~~~">
45+
<location
46+
file="src/main/java/androidx/benchmark/Profiler.kt"/>
47+
</issue>
48+
49+
</issues>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 8.0.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.0.0-beta03">
3+
4+
<issue
5+
id="BanThreadSleep"
6+
message="Uses Thread.sleep()"
7+
errorLine1=" Thread.sleep(5)"
8+
errorLine2=" ~~~~~">
9+
<location
10+
file="src/androidTest/java/androidx/benchmark/junit4/BenchmarkRuleTest.kt"/>
11+
</issue>
12+
13+
</issues>

0 commit comments

Comments
 (0)