[Android] Fix logic fail for Oreo service launching

Geoffrey Métais git at videolan.org
Thu Sep 21 12:03:49 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 21 12:03:26 2017 +0200| [d5c580c6f58cd9036ed2085d499c8cc581ced8aa] | committer: Geoffrey Métais

Fix logic fail for Oreo service launching

> https://code.videolan.org/videolan/vlc-android/commit/d5c580c6f58cd9036ed2085d499c8cc581ced8aa
---

 vlc-android/src/org/videolan/vlc/MediaParsingService.java | 2 +-
 vlc-android/src/org/videolan/vlc/util/Util.java           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index 0dc4eec74..4ef915927 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -124,7 +124,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
             // Set 1s delay before displaying scan icon
             // Except for Android 8+ which expects startForeground immediatly
             if (mLastNotificationTime <= 0L)
-                mLastNotificationTime = AndroidUtil.isOOrLater && VLCApplication.isForeground() ? System.currentTimeMillis() : 0L;
+                mLastNotificationTime = !AndroidUtil.isOOrLater && VLCApplication.isForeground() ? System.currentTimeMillis() : 0L;
         }
         switch (intent.getAction()) {
             case ACTION_INIT:
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index d0363d04a..11ce0cb13 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -177,7 +177,7 @@ public class Util {
      * @param intent service intent to start
      */
     public static void startService(Context ctx, Intent intent) {
-        if (AndroidUtil.isOOrLater && VLCApplication.isForeground())
+        if (!AndroidUtil.isOOrLater || VLCApplication.isForeground())
             ctx.startService(intent);
         else
             ctx.startForegroundService(intent);



More information about the Android mailing list