[Android] Directly run calls already in background

Geoffrey Métais git at videolan.org
Wed Jul 26 11:33:11 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul 26 11:09:05 2017 +0200| [08be31a234ee06b46ca9539200014f47a31d160f] | committer: Geoffrey Métais

Directly run calls already in background

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

 vlc-android/src/org/videolan/vlc/VLCApplication.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 358c75b00..cac2f7a16 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -156,7 +156,10 @@ public class VLCApplication extends Application {
     }
 
     public static void runBackground(Runnable runnable) {
-        instance.mThreadPool.execute(runnable);
+        if (Looper.myLooper() != Looper.getMainLooper())
+            runnable.run();
+        else
+            instance.mThreadPool.execute(runnable);
     }
 
     public static void runOnMainThread(Runnable runnable) {



More information about the Android mailing list