[Android] Code cleaning and safety checks

Geoffrey Métais git at videolan.org
Mon Sep 23 18:10:30 CEST 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 12 11:51:47 2019 +0200| [b1b71a7783c633d0d0c8b7378f644d1e81b11fe3] | committer: Geoffrey Métais

Code cleaning and safety checks

(cherry picked from commit 6bc276383cd1d63ac664ed7d03cd93397ddb50e5)
(cherry picked from commit 3b478388cf6ca45523a8aa1bb2fb439f1b20d139)

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

 vlc-android/src/org/videolan/vlc/PlaybackService.kt | 7 +------
 vlc-android/src/org/videolan/vlc/StartActivity.kt   | 4 ++--
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index d7264fbdb..55181b882 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -1303,13 +1303,8 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
             ContextCompat.startForegroundService(context, serviceIntent)
         }
 
-        fun getService(iBinder: IBinder): PlaybackService? {
-            val binder = iBinder as LocalBinder
-            return binder.service
-        }
-
         fun loadLastAudio(context: Context) {
-            val i = Intent(context, PlaybackService::class.java).apply { action = ACTION_REMOTE_LAST_PLAYLIST }
+            val i = Intent(ACTION_REMOTE_LAST_PLAYLIST, null, context, PlaybackService::class.java)
             ContextCompat.startForegroundService(context, i)
         }
 
diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.kt b/vlc-android/src/org/videolan/vlc/StartActivity.kt
index f431f6113..cd36defe4 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -196,10 +196,10 @@ class StartActivity : FragmentActivity() {
     }
 
     private fun startPlaybackFromApp(intent: Intent) {
-        if (intent.type != null && intent.type!!.startsWith("video"))
+        if (intent.type?.startsWith("video") == true)
             startActivity(intent.setClass(this, VideoPlayerActivity::class.java))
         else
-            MediaUtils.openMediaNoUi(intent.data!!)
+            intent.data.let { MediaUtils.openMediaNoUi(it) }
         finish()
     }
 



More information about the Android mailing list