Skip to content

Commit 633cfb0

Browse files
committed
modify foregroundServiceType to be analyzable for lint
To devs it's the same, but the change appeases Lint because it fits the analyzer’s limited static-flow model If this does not work out again, last quite bad option here may be to suppress Also remove useless check for version Q Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
1 parent 705ba89 commit 633cfb0

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

app/src/main/java/com/nextcloud/talk/services/CallForegroundService.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ class CallForegroundService : Service() {
3535
val notification = buildNotification(conversationName, callExtras)
3636

3737
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
38-
startForeground(
39-
NOTIFICATION_ID,
40-
notification,
41-
resolveForegroundServiceType(callExtras)
42-
)
38+
val foregroundServiceType = resolveForegroundServiceType(callExtras)
39+
startForeground(NOTIFICATION_ID, notification, foregroundServiceType)
4340
} else {
4441
startForeground(NOTIFICATION_ID, notification)
4542
}
@@ -90,10 +87,6 @@ class CallForegroundService : Service() {
9087
}
9188

9289
private fun resolveForegroundServiceType(callExtras: Bundle?): Int {
93-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
94-
return 0
95-
}
96-
9790
var serviceType = 0
9891
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
9992
serviceType = serviceType or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE

0 commit comments

Comments
 (0)