修复 某些情况下调用app.sendBroadcast("inspect_layout_bounds")等崩溃的问题

This commit is contained in:
hyb1996 2018-10-18 00:21:26 +08:00
parent fbe2df406a
commit 0bccf1c3a3

View File

@ -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;
}
}
}
};