[Android] Ext. devices: remove deprecated devices filtering

Geoffrey Métais git at videolan.org
Fri Mar 15 15:09:20 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 15 11:40:59 2019 +0100| [eed912339b3d1a4f594d64dabb39e66f67055e63] | committer: Geoffrey Métais

Ext. devices: remove deprecated devices filtering

Medialibrary correctly indicates if device is new now

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

 vlc-android/src/org/videolan/vlc/StoragesMonitor.kt | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/StoragesMonitor.kt b/vlc-android/src/org/videolan/vlc/StoragesMonitor.kt
index 728baee40..6b33a5bb9 100644
--- a/vlc-android/src/org/videolan/vlc/StoragesMonitor.kt
+++ b/vlc-android/src/org/videolan/vlc/StoragesMonitor.kt
@@ -7,7 +7,6 @@ import android.content.Intent
 import android.content.pm.PackageManager
 import android.net.Uri
 import android.text.TextUtils
-import android.util.Log
 import androidx.lifecycle.Lifecycle
 import androidx.lifecycle.ProcessLifecycleOwner
 import kotlinx.coroutines.channels.Channel
@@ -25,7 +24,6 @@ private const val TAG = "VLC/StoragesMonitor"
 class StoragesMonitor : BroadcastReceiver() {
 
     override fun onReceive(context: Context, intent: Intent) {
-        Log.d(TAG, "onReceive ${intent.action}")
         val action = intent.action ?: return
         if (ProcessLifecycleOwner.get().lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) return
         when (action) {
@@ -40,9 +38,7 @@ class StoragesMonitor : BroadcastReceiver() {
             is Mount -> {
                 if (TextUtils.isEmpty(action.uuid)) return at actor
                 if (action.path.scanAllowed()) {
-                    val knownDevices = action.ctx.getFromMl { devices }
-                    val ml = Medialibrary.getInstance()
-                    val isNew = !containsDevice(knownDevices, action.path) && ml.addDevice(action.uuid, action.path, true)
+                    val isNew = action.ctx.getFromMl { addDevice(action.uuid, action.path, true) }
                     if (isNew) {
                         val intent = Intent(action.ctx, DialogActivity::class.java).apply {
                             setAction(DialogActivity.KEY_DEVICE)



More information about the Android mailing list