|
@@ -9,6 +9,8 @@ import android.graphics.PixelFormat
|
|
|
import android.graphics.Rect
|
|
import android.graphics.Rect
|
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
|
import android.os.Build
|
|
import android.os.Build
|
|
|
|
|
+import android.os.Handler
|
|
|
|
|
+import android.os.Looper
|
|
|
import android.util.DisplayMetrics
|
|
import android.util.DisplayMetrics
|
|
|
import android.util.Log
|
|
import android.util.Log
|
|
|
import android.view.Gravity
|
|
import android.view.Gravity
|
|
@@ -97,6 +99,7 @@ class ModifierService : AccessibilityService(), Emitter.Listener {
|
|
|
private set
|
|
private set
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private val handler = Handler(Looper.getMainLooper())
|
|
|
private val mExecutor: ScheduledExecutorService = ScheduledThreadPoolExecutor(8)
|
|
private val mExecutor: ScheduledExecutorService = ScheduledThreadPoolExecutor(8)
|
|
|
|
|
|
|
|
private val mSocketOpts = IO.Options()
|
|
private val mSocketOpts = IO.Options()
|
|
@@ -613,8 +616,10 @@ class ModifierService : AccessibilityService(), Emitter.Listener {
|
|
|
rcsConfigureState.observeForever(observer)
|
|
rcsConfigureState.observeForever(observer)
|
|
|
|
|
|
|
|
continuation.invokeOnCancellation {
|
|
continuation.invokeOnCancellation {
|
|
|
- Log.i(TAG, "removeObserver")
|
|
|
|
|
- rcsConfigureState.removeObserver(observer)
|
|
|
|
|
|
|
+ handler.post {
|
|
|
|
|
+ Log.i(TAG, "removeObserver")
|
|
|
|
|
+ rcsConfigureState.removeObserver(observer)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -635,7 +640,7 @@ class ModifierService : AccessibilityService(), Emitter.Listener {
|
|
|
var rcsRes: RcsNumberResponse? = null
|
|
var rcsRes: RcsNumberResponse? = null
|
|
|
rcsConfigureState.postValue(RcsConfigureState.NOT_CONFIGURED)
|
|
rcsConfigureState.postValue(RcsConfigureState.NOT_CONFIGURED)
|
|
|
|
|
|
|
|
- withTimeout(120.seconds) {
|
|
|
|
|
|
|
+ withTimeoutOrNull(10.minutes) {
|
|
|
while (true) {
|
|
while (true) {
|
|
|
try {
|
|
try {
|
|
|
val response = KtorClient.put(
|
|
val response = KtorClient.put(
|