1 package leakcanary.internal 2 3 import android.os.Handler 4 import android.os.Looper 5 <lambda>null6internal val mainHandler by lazy { Handler(Looper.getMainLooper()) } 7 8 internal val isMainThread: Boolean get() = Looper.getMainLooper().thread === Thread.currentThread() 9 checkMainThreadnull10internal fun checkMainThread() { 11 check(isMainThread) { 12 "Should be called from the main thread, not ${Thread.currentThread()}" 13 } 14 } 15 checkNotMainThreadnull16internal fun checkNotMainThread() { 17 check(!isMainThread) { 18 "Should not be called from the main thread" 19 } 20 } 21