Skip to content

Commit 16c07c2

Browse files
authored
Ignore strict mode issues on Android Automotive emulator (#6040)
1 parent 0970bf7 commit 16c07c2

File tree

3 files changed

+97
-39
lines changed

3 files changed

+97
-39
lines changed

app/lint-baseline.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@
136136
<issue
137137
id="NewApi"
138138
message="Field requires API level 31 (current min is 30): `CameraControl`"
139-
errorLine1=" &quot;camera&quot; to CameraControl,"
140-
errorLine2=" ~~~~~~~~~~~~~">
139+
errorLine1=" CAMERA_DOMAIN to CameraControl,"
140+
errorLine2=" ~~~~~~~~~~~~~">
141141
<location
142142
file="src/main/kotlin/io/homeassistant/companion/android/controls/HaControlsProviderService.kt"
143-
line="44"
144-
column="25"/>
143+
line="46"
144+
column="30"/>
145145
</issue>
146146

147147
<issue
@@ -459,7 +459,7 @@
459459
errorLine2=" ~~~~~~~~~">
460460
<location
461461
file="src/main/kotlin/io/homeassistant/companion/android/websocket/WebsocketBroadcastReceiver.kt"
462-
line="8"
462+
line="14"
463463
column="18"/>
464464
</issue>
465465

@@ -868,7 +868,7 @@
868868
errorLine2=" ~~~~~~~~~~~~~~~~">
869869
<location
870870
file="src/main/kotlin/io/homeassistant/companion/android/widgets/button/ButtonWidgetConfigureActivity.kt"
871-
line="415"
871+
line="416"
872872
column="59"/>
873873
</issue>
874874

@@ -912,7 +912,7 @@
912912
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
913913
<location
914914
file="src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureActivity.kt"
915-
line="118"
915+
line="134"
916916
column="42"/>
917917
</issue>
918918

app/src/main/kotlin/io/homeassistant/companion/android/util/IgnoreViolationRules.kt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ val threadPolicyIgnoredViolationRules = listOf(
2020
IgnoreActivityThreadVsyncDiskReadWrite,
2121
IgnoreSamsungInputRuneDiskRead,
2222
IgnoreSamsungKnoxProKioskDiskRead,
23+
IgnoreAndroidAutoServiceConnectionDiskRead,
24+
IgnoreAndroidAutoRendererServiceDiskRead,
2325
)
2426

2527
/**
@@ -157,3 +159,37 @@ private data object IgnoreSamsungKnoxProKioskDiskRead : IgnoreViolationRule {
157159
}
158160
}
159161
}
162+
163+
/**
164+
* Ignore a [DiskReadViolation] in Android Auto/Automotive's ServiceConnectionManager.
165+
* This occurs when the Android Auto library initializes its service connection and is
166+
* beyond application control.
167+
*/
168+
private data object IgnoreAndroidAutoServiceConnectionDiskRead : IgnoreViolationRule {
169+
@RequiresApi(Build.VERSION_CODES.P)
170+
override fun shouldIgnore(violation: Violation): Boolean {
171+
if (violation !is DiskReadViolation) return false
172+
173+
return violation.stackTrace.any {
174+
it.className == "androidx.car.app.activity.ServiceConnectionManager" &&
175+
it.methodName == "initializeService"
176+
}
177+
}
178+
}
179+
180+
/**
181+
* Ignore a [DiskReadViolation] in Android Auto/Automotive's IRendererService.
182+
* This occurs when the Android Auto renderer service handles binder transactions and is
183+
* beyond application control.
184+
*/
185+
private data object IgnoreAndroidAutoRendererServiceDiskRead : IgnoreViolationRule {
186+
@RequiresApi(Build.VERSION_CODES.P)
187+
override fun shouldIgnore(violation: Violation): Boolean {
188+
if (violation !is DiskReadViolation) return false
189+
190+
return violation.stackTrace.any {
191+
it.className == "androidx.car.app.activity.renderer.IRendererService\$Stub" &&
192+
it.methodName == "onTransact"
193+
}
194+
}
195+
}

automotive/lint-baseline.xml

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@
136136
<issue
137137
id="NewApi"
138138
message="Field requires API level 31 (current min is 30): `CameraControl`"
139-
errorLine1=" &quot;camera&quot; to CameraControl,"
140-
errorLine2=" ~~~~~~~~~~~~~">
139+
errorLine1=" CAMERA_DOMAIN to CameraControl,"
140+
errorLine2=" ~~~~~~~~~~~~~">
141141
<location
142142
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/controls/HaControlsProviderService.kt"
143-
line="44"
144-
column="25"/>
143+
line="46"
144+
column="30"/>
145145
</issue>
146146

147147
<issue
@@ -404,7 +404,7 @@
404404
errorLine2=" ~~~~~~~~~">
405405
<location
406406
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/websocket/WebsocketBroadcastReceiver.kt"
407-
line="8"
407+
line="14"
408408
column="18"/>
409409
</issue>
410410

@@ -459,7 +459,7 @@
459459
errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
460460
<location
461461
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/settings/vehicle/views/AndroidAutoFavoritesView.kt"
462-
line="38"
462+
line="39"
463463
column="1"/>
464464
</issue>
465465

@@ -547,7 +547,7 @@
547547
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
548548
<location
549549
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/widgets/BaseWidgetConfigureActivity.kt"
550-
line="116"
550+
line="120"
551551
column="5"/>
552552
</issue>
553553

@@ -569,7 +569,7 @@
569569
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
570570
<location
571571
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/widgets/camera/CameraWidgetConfigureActivity.kt"
572-
line="59"
572+
line="74"
573573
column="21"/>
574574
</issue>
575575

@@ -657,7 +657,7 @@
657657
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
658658
<location
659659
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureActivity.kt"
660-
line="76"
660+
line="88"
661661
column="21"/>
662662
</issue>
663663

@@ -789,7 +789,7 @@
789789
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
790790
<location
791791
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
792-
line="73"
792+
line="75"
793793
column="5"/>
794794
</issue>
795795

@@ -800,7 +800,7 @@
800800
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
801801
<location
802802
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
803-
line="87"
803+
line="89"
804804
column="5"/>
805805
</issue>
806806

@@ -811,7 +811,7 @@
811811
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
812812
<location
813813
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
814-
line="102"
814+
line="104"
815815
column="5"/>
816816
</issue>
817817

@@ -822,7 +822,7 @@
822822
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
823823
<location
824824
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
825-
line="118"
825+
line="120"
826826
column="5"/>
827827
</issue>
828828

@@ -833,7 +833,7 @@
833833
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
834834
<location
835835
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
836-
line="135"
836+
line="137"
837837
column="5"/>
838838
</issue>
839839

@@ -844,7 +844,29 @@
844844
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
845845
<location
846846
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
847-
line="150"
847+
line="152"
848+
column="5"/>
849+
</issue>
850+
851+
<issue
852+
id="ObsoleteSdkInt"
853+
message="Unnecessary; `SDK_INT` is always >= 28"
854+
errorLine1=" @RequiresApi(Build.VERSION_CODES.P)"
855+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
856+
<location
857+
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
858+
line="169"
859+
column="5"/>
860+
</issue>
861+
862+
<issue
863+
id="ObsoleteSdkInt"
864+
message="Unnecessary; `SDK_INT` is always >= 28"
865+
errorLine1=" @RequiresApi(Build.VERSION_CODES.P)"
866+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
867+
<location
868+
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/util/IgnoreViolationRules.kt"
869+
line="186"
848870
column="5"/>
849871
</issue>
850872

@@ -921,7 +943,7 @@
921943
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
922944
<location
923945
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*7}/io/homeassistant/companion/android/sensors/LocationSensorManager.kt"
924-
line="951"
946+
line="957"
925947
column="40"/>
926948
</issue>
927949

@@ -932,7 +954,7 @@
932954
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
933955
<location
934956
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*7}/io/homeassistant/companion/android/sensors/LocationSensorManager.kt"
935-
line="1347"
957+
line="1353"
936958
column="14"/>
937959
</issue>
938960

@@ -954,7 +976,7 @@
954976
errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
955977
<location
956978
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/vehicle/MainVehicleScreen.kt"
957-
line="42"
979+
line="43"
958980
column="1"/>
959981
</issue>
960982

@@ -976,7 +998,7 @@
976998
errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
977999
<location
9781000
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/settings/vehicle/ManageAndroidAutoViewModel.kt"
979-
line="25"
1001+
line="26"
9801002
column="1"/>
9811003
</issue>
9821004

@@ -1141,7 +1163,7 @@
11411163
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
11421164
<location
11431165
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/widgets/mediaplayer/MediaPlayerControlsWidgetConfigureActivity.kt"
1144-
line="63"
1166+
line="77"
11451167
column="21"/>
11461168
</issue>
11471169

@@ -2340,7 +2362,7 @@
23402362
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
23412363
<location
23422364
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2343-
line="256"
2365+
line="273"
23442366
column="13"/>
23452367
</issue>
23462368

@@ -2351,7 +2373,7 @@
23512373
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
23522374
<location
23532375
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2354-
line="512"
2376+
line="533"
23552377
column="21"/>
23562378
</issue>
23572379

@@ -2362,7 +2384,7 @@
23622384
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
23632385
<location
23642386
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2365-
line="513"
2387+
line="534"
23662388
column="21"/>
23672389
</issue>
23682390

@@ -2373,7 +2395,7 @@
23732395
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
23742396
<location
23752397
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2376-
line="543"
2398+
line="564"
23772399
column="25"/>
23782400
</issue>
23792401

@@ -2384,7 +2406,7 @@
23842406
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
23852407
<location
23862408
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2387-
line="543"
2409+
line="564"
23882410
column="25"/>
23892411
</issue>
23902412

@@ -2395,7 +2417,7 @@
23952417
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
23962418
<location
23972419
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2398-
line="628"
2420+
line="649"
23992421
column="13"/>
24002422
</issue>
24012423

@@ -2406,7 +2428,7 @@
24062428
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
24072429
<location
24082430
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2409-
line="1197"
2431+
line="1242"
24102432
column="21"/>
24112433
</issue>
24122434

@@ -2417,7 +2439,7 @@
24172439
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
24182440
<location
24192441
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/webview/WebViewActivity.kt"
2420-
line="1316"
2442+
line="1361"
24212443
column="17"/>
24222444
</issue>
24232445

@@ -2428,7 +2450,7 @@
24282450
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
24292451
<location
24302452
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/websocket/WebsocketManager.kt"
2431-
line="223"
2453+
line="224"
24322454
column="13"/>
24332455
</issue>
24342456

@@ -2439,7 +2461,7 @@
24392461
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
24402462
<location
24412463
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/websocket/WebsocketManager.kt"
2442-
line="278"
2464+
line="279"
24432465
column="17"/>
24442466
</issue>
24452467

@@ -2817,7 +2839,7 @@
28172839
errorLine2=" ~~~~~~~~~~~~~~~~">
28182840
<location
28192841
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/widgets/button/ButtonWidgetConfigureActivity.kt"
2820-
line="415"
2842+
line="416"
28212843
column="59"/>
28222844
</issue>
28232845

@@ -2861,7 +2883,7 @@
28612883
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
28622884
<location
28632885
file="${:automotive*fullDebug*MAIN*sourceProvider*0*javaDir*5}/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureActivity.kt"
2864-
line="118"
2886+
line="134"
28652887
column="42"/>
28662888
</issue>
28672889

0 commit comments

Comments
 (0)