2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-04 08:05:10 +00:00

Don't call mutex.lock in the main thread

This commit is contained in:
Albert Vaca
2015-06-05 20:35:14 -07:00
parent 307071e9e7
commit a5e9b29e20

View File

@@ -306,14 +306,19 @@ public class BackgroundService extends Service {
RunCommand(c, null); RunCommand(c, null);
} }
public static void RunCommand(Context c, final InstanceCallback callback) { public static void RunCommand(final Context c, final InstanceCallback callback) {
if (callback != null) { new Thread(new Runnable() {
mutex.lock(); @Override
callbacks.add(callback); public void run() {
mutex.unlock(); if (callback != null) {
} mutex.lock();
Intent serviceIntent = new Intent(c, BackgroundService.class); callbacks.add(callback);
c.startService(serviceIntent); mutex.unlock();
}
Intent serviceIntent = new Intent(c, BackgroundService.class);
c.startService(serviceIntent);
}
}).start();
} }
} }