1 package android.os 2 3 import kotlinx.coroutines.GlobalScope 4 import kotlinx.coroutines.launch 5 import java.util.concurrent.* 6 7 class Handler(val looper: Looper) { postnull8 fun post(r: Runnable): Boolean { 9 try { 10 GlobalScope.launch { r.run() } 11 } catch (e: RejectedExecutionException) { 12 // Execute leftover callbacks in place for tests 13 r.run() 14 } 15 16 return true 17 } 18 } 19 20 class Looper { 21 companion object { 22 @JvmStatic getMainLoopernull23 fun getMainLooper() = Looper() 24 } 25 } 26