Skip to content
Snippets Groups Projects
Commit 584d29b1 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Fix deadlock at app startup

parent 8fcd6587
No related branches found
No related tags found
No related merge requests found
......@@ -67,13 +67,7 @@ public class Medialibrary {
private final List<EntryPointsEventsCb> entryPointsEventsCbList = new ArrayList<>();
private static Context sContext;
static {
LibVLC.loadLibraries();
}
private static class MedialibraryHolder {
public static final Medialibrary instance = new Medialibrary();
}
private static final Medialibrary instance = new Medialibrary();
public static Context getContext() {
return sContext;
......@@ -143,7 +137,7 @@ public class Medialibrary {
}
public static Medialibrary getInstance() {
return MedialibraryHolder.instance;
return instance;
}
@WorkerThread
......
......@@ -36,6 +36,7 @@ import android.support.v4.util.SimpleArrayMap;
import android.util.Log;
import org.videolan.libvlc.Dialog;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.medialibrary.Medialibrary;
import org.videolan.vlc.gui.DialogActivity;
......@@ -74,7 +75,7 @@ public class VLCApplication extends Application {
public static final ThreadFactory THREAD_FACTORY = new ThreadFactory() {
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
final Thread thread = new Thread(runnable);
thread.setPriority(Process.THREAD_PRIORITY_DEFAULT+Process.THREAD_PRIORITY_LESS_FAVORABLE);
return thread;
}
......@@ -93,9 +94,12 @@ public class VLCApplication extends Application {
setLocale();
LibVLC.loadLibraries();
runBackground(new Runnable() {
@Override
public void run() {
if (AndroidUtil.isOOrLater)
NotificationHelper.createNotificationChannels();
// Prepare cache folder constants
......@@ -112,6 +116,7 @@ public class VLCApplication extends Application {
AndroidDevices.setRemoteControlReceiverEnabled(false);
}
});
if (sActivityCbListener != null)
registerActivityLifecycleCallbacks(sActivityCbListener);
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment