[Android] Don't look for new devices when scan is disabled

Geoffrey Métais git at videolan.org
Wed Aug 1 10:30:04 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jul 31 18:26:28 2018 +0200| [e8ef16e5f3020f815294c3c2dced519eecbb1757] | committer: Geoffrey Métais

Don't look for new devices when scan is disabled

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

 vlc-android/src/org/videolan/vlc/ExternalMonitor.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index adc932729..29b2f7f9c 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -91,13 +91,16 @@ public class ExternalMonitor extends BroadcastReceiver implements LifecycleObser
     }
 
     private static void checkNewStorages(final Context ctx) {
-        if (VLCApplication.getMLInstance().isInitiated())
-            new Handler(Looper.getMainLooper()).post(new Runnable() {
+        if (VLCApplication.getMLInstance().isInitiated()) {
+            final int scanOpt = VLCApplication.showTvUi() ? Constants.ML_SCAN_ON
+                    : PreferenceManager.getDefaultSharedPreferences(ctx).getInt(Constants.KEY_MEDIALIBRARY_SCAN, -1);
+            if (scanOpt == Constants.ML_SCAN_ON) new Handler(Looper.getMainLooper()).post(new Runnable() {
                 @Override
                 public void run() {
-                    ctx.startService(new Intent(Constants.ACTION_CHECK_STORAGES, null,ctx, MediaParsingService.class));
+                    ctx.startService(new Intent(Constants.ACTION_CHECK_STORAGES, null, ctx, MediaParsingService.class));
                 }
             });
+        }
         devices = new LiveDataset<>();
         final UsbManager usbManager = (UsbManager) ctx.getSystemService(Context.USB_SERVICE);
         devices.add(new ArrayList<>(usbManager.getDeviceList().values()));



More information about the Android mailing list