From 0bccf1c3a3331de95e8bf7c4b98a5873f58ecf18 Mon Sep 17 00:00:00 2001 From: hyb1996 <946994919@qq.com> Date: Thu, 18 Oct 2018 00:21:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E8=B0=83=E7=94=A8app.sendBroadcast(?= =?UTF-8?q?"inspect=5Flayout=5Fbounds")=E7=AD=89=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/autojs/autojs/autojs/AutoJs.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/autojs/autojs/autojs/AutoJs.java b/app/src/main/java/org/autojs/autojs/autojs/AutoJs.java index 6e9ce514..39300dbe 100644 --- a/app/src/main/java/org/autojs/autojs/autojs/AutoJs.java +++ b/app/src/main/java/org/autojs/autojs/autojs/AutoJs.java @@ -63,12 +63,18 @@ public class AutoJs extends com.stardust.autojs.AutoJs { private BroadcastReceiver mLayoutInspectBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - ensureAccessibilityServiceEnabled(); - String action = intent.getAction(); - if (LayoutBoundsFloatyWindow.class.getName().equals(action)) { - capture(LayoutBoundsFloatyWindow::new); - } else if (LayoutHierarchyFloatyWindow.class.getName().equals(action)) { - capture(LayoutHierarchyFloatyWindow::new); + try { + ensureAccessibilityServiceEnabled(); + String action = intent.getAction(); + if (LayoutBoundsFloatyWindow.class.getName().equals(action)) { + capture(LayoutBoundsFloatyWindow::new); + } else if (LayoutHierarchyFloatyWindow.class.getName().equals(action)) { + capture(LayoutHierarchyFloatyWindow::new); + } + } catch (Exception e) { + if (Looper.myLooper() != Looper.getMainLooper()) { + throw e; + } } } };