[Android] Fix StackOverflowError by returning VLCApplication which is wrapped

Nicolas Pomepuy git at videolan.org
Tue Aug 13 10:27:08 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Aug 12 10:14:46 2019 +0200| [02ae94d64c297bd9aa9e5d31bb686072e5a89030] | committer: Geoffrey Métais

Fix StackOverflowError by returning VLCApplication which is wrapped

(cherry picked from commit 4c3b295f69062e2fdac722c87da277337320e6d6)

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

 vlc-android/src/org/videolan/vlc/DebugLogService.kt               | 2 +-
 vlc-android/src/org/videolan/vlc/MediaParsingService.kt           | 2 +-
 vlc-android/src/org/videolan/vlc/PlaybackService.kt               | 2 +-
 vlc-android/src/org/videolan/vlc/PreviewVideoInputService.kt      | 2 +-
 vlc-android/src/org/videolan/vlc/RecommendationsService.kt        | 2 +-
 vlc-android/src/org/videolan/vlc/StartActivity.kt                 | 2 +-
 vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt              | 3 ++-
 vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt | 2 +-
 8 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/DebugLogService.kt b/vlc-android/src/org/videolan/vlc/DebugLogService.kt
index bc9fa209e..0244e24d5 100644
--- a/vlc-android/src/org/videolan/vlc/DebugLogService.kt
+++ b/vlc-android/src/org/videolan/vlc/DebugLogService.kt
@@ -46,7 +46,7 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     override fun onBind(intent: Intent): IBinder? {
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 79b67ce05..717844f47 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -96,7 +96,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     @SuppressLint("WakelockTimeout")
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 7623eb297..fac4c3458 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -448,7 +448,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     override fun onCreate() {
diff --git a/vlc-android/src/org/videolan/vlc/PreviewVideoInputService.kt b/vlc-android/src/org/videolan/vlc/PreviewVideoInputService.kt
index b214fadcc..50973d305 100644
--- a/vlc-android/src/org/videolan/vlc/PreviewVideoInputService.kt
+++ b/vlc-android/src/org/videolan/vlc/PreviewVideoInputService.kt
@@ -38,7 +38,7 @@ class PreviewVideoInputService : TvInputService(), CoroutineScope {
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     private inner class PreviewSession(context: Context
diff --git a/vlc-android/src/org/videolan/vlc/RecommendationsService.kt b/vlc-android/src/org/videolan/vlc/RecommendationsService.kt
index c0d65d652..04e450452 100644
--- a/vlc-android/src/org/videolan/vlc/RecommendationsService.kt
+++ b/vlc-android/src/org/videolan/vlc/RecommendationsService.kt
@@ -55,7 +55,7 @@ class RecommendationsService : IntentService("RecommendationService"), Coroutine
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     override fun onCreate() {
diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.kt b/vlc-android/src/org/videolan/vlc/StartActivity.kt
index 3c134ccb9..06997dc09 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -80,7 +80,7 @@ class StartActivity : FragmentActivity() {
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt b/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
index 06bb956b7..4b600067e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
@@ -9,6 +9,7 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.MainScope
 import kotlinx.coroutines.cancel
 import org.videolan.tools.KeyHelper
+import org.videolan.vlc.VLCApplication
 import org.videolan.vlc.gui.helpers.applyTheme
 import org.videolan.vlc.util.Settings
 import org.videolan.vlc.util.getContextWithLocale
@@ -29,7 +30,7 @@ open class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
index 932d06de2..52eace2e7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.kt
@@ -61,7 +61,7 @@ abstract class BaseTvActivity : FragmentActivity(), CoroutineScope by MainScope(
     }
 
     override fun getApplicationContext(): Context {
-        return getContextWithLocale()
+        return VLCApplication.appContext
     }
 
     override fun onCreate(savedInstanceState: Bundle?) {



More information about the Android mailing list