[Android] Set notification delay for any medialib operation

Geoffrey Métais git at videolan.org
Thu Apr 6 16:33:22 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr  6 16:25:12 2017 +0200| [0fefdb7a62d82d823e99cef6ebb4641dead6468d] | committer: Geoffrey Métais

Set notification delay for any medialib operation

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

 vlc-android/src/org/videolan/vlc/MediaParsingService.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index a1c6300..61608e6 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -98,6 +98,10 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
 
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
+        synchronized (this) {
+            if (mLastNotificationTime <= 0L)
+                mLastNotificationTime = System.currentTimeMillis();
+        }
         switch (intent.getAction()) {
             case ACTION_INIT:
                 setupMedialibrary(intent.getBooleanExtra(StartActivity.EXTRA_UPGRADE, false));
@@ -156,9 +160,6 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
             VLCApplication.runBackground(new Runnable() {
                 @Override
                 public void run() {
-                    synchronized (this) {
-                        mLastNotificationTime = System.currentTimeMillis();
-                    }
                     mMedialibrary.setup();
                     boolean shouldInit = !(new File(MediaParsingService.this.getCacheDir()+Medialibrary.VLC_MEDIA_DB_NAME).exists());
                     String[] storages = AndroidDevices.getMediaDirectories();



More information about the Android mailing list