From 69d25f0badeed0b792ffda726ce69cebda12bccd Mon Sep 17 00:00:00 2001 From: renwj Date: Tue, 28 Mar 2023 10:38:17 +0800 Subject: [PATCH] =?UTF-8?q?[2.15.0]=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt b/app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt index 24e9815327..746a875ee0 100644 --- a/app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt +++ b/app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt @@ -24,6 +24,9 @@ class ANRFix { @TargetMethod(methodName = "post") @ReplaceInvoke fun handlerPostProxy(handler: Handler, action: Runnable): Boolean { + if (Looper.getMainLooper() != handler.looper) { + return handler.post(action) + } val what = ObjectHashCodeUtils.getHashCodeIfNeed(action) handler.removeMessages(what) val msg = Message.obtain(handler, action) @@ -36,6 +39,9 @@ class ANRFix { @TargetMethod(methodName = "postDelayed") @ReplaceInvoke fun handlerPostDelayProxy(handler: Handler, action: Runnable, delayMillis: Long): Boolean { + if (Looper.getMainLooper() != handler.looper) { + return handler.postDelayed(action, delayMillis) + } val what = ObjectHashCodeUtils.getHashCodeIfNeed(action) handler.removeMessages(what) val msg = Message.obtain(handler, action)