[Android] MediaParsingService: Always set foreground Oreo+
Geoffrey Métais
git at videolan.org
Mon Aug 12 13:44:15 CEST 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 9 13:57:12 2019 +0200| [42028545c255d8f7f038142c7fa1b16c44a5f6f3] | committer: Geoffrey Métais
MediaParsingService: Always set foreground Oreo+
(cherry picked from commit 828ffce2949538f11d1ad55d9cc2b0de843f3037)
> https://code.videolan.org/videolan/vlc-android/commit/42028545c255d8f7f038142c7fa1b16c44a5f6f3
---
vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index d125aa8e4..2caf77834 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -120,15 +120,14 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
- if (intent == null) {
- exitCommand()
- return Service.START_NOT_STICKY
- }
// Set 1s delay before displaying scan icon
// Except for Android 8+ which expects startForeground immediately
-
if (AndroidUtil.isOOrLater) forceForeground()
else if (lastNotificationTime <= 0L) lastNotificationTime = System.currentTimeMillis()
+ if (intent == null) {
+ exitCommand()
+ return Service.START_NOT_STICKY
+ }
dispatcher.onServicePreSuperOnStart()
when (intent.action) {
ACTION_INIT -> {
More information about the Android
mailing list