|
@@ -19,8 +19,6 @@ package org.jitsi.meet.sdk;
|
19
|
19
|
import android.content.Context;
|
20
|
20
|
import android.net.wifi.WifiInfo;
|
21
|
21
|
import android.net.wifi.WifiManager;
|
22
|
|
-import android.os.Handler;
|
23
|
|
-import android.os.Looper;
|
24
|
22
|
import android.util.Log;
|
25
|
23
|
|
26
|
24
|
import com.facebook.react.bridge.Promise;
|
|
@@ -36,6 +34,8 @@ import java.net.NetworkInterface;
|
36
|
34
|
import java.net.SocketException;
|
37
|
35
|
import java.net.UnknownHostException;
|
38
|
36
|
import java.util.Enumeration;
|
|
37
|
+import java.util.concurrent.ExecutorService;
|
|
38
|
+import java.util.concurrent.Executors;
|
39
|
39
|
|
40
|
40
|
/**
|
41
|
41
|
* Module exposing WiFi statistics.
|
|
@@ -64,10 +64,10 @@ class WiFiStatsModule
|
64
|
64
|
public final static int SIGNAL_LEVEL_SCALE = 101;
|
65
|
65
|
|
66
|
66
|
/**
|
67
|
|
- * {@link Handler} for running all operations on the main thread.
|
|
67
|
+ * {@link ExecutorService} for running all operations on a dedicated thread.
|
68
|
68
|
*/
|
69
|
|
- private final Handler mainThreadHandler
|
70
|
|
- = new Handler(Looper.getMainLooper());
|
|
69
|
+ private static final ExecutorService executor
|
|
70
|
+ = Executors.newSingleThreadExecutor();
|
71
|
71
|
|
72
|
72
|
/**
|
73
|
73
|
* Initializes a new module instance. There shall be a single instance of
|
|
@@ -203,6 +203,6 @@ class WiFiStatsModule
|
203
|
203
|
}
|
204
|
204
|
}
|
205
|
205
|
};
|
206
|
|
- mainThreadHandler.post(r);
|
|
206
|
+ executor.execute(r);
|
207
|
207
|
}
|
208
|
208
|
}
|