调试 Android 应用程序时如何禁用 SIGABRT?

How to disable SIGABRT when debugging Android app?

我正在尝试调试我的应用程序的 UI 异常行为,但由于某些可怕的原因,我在断点处移动约 15 秒后应用程序被杀死,我该如何摆脱这种行为它是让我疯狂。

A/libc: Fatal signal 6 (SIGABRT) at 0x00000274 (code=0), thread 25754 (getapp.debug)

我在 LG D605 和 Android Studio 3.2 Canary 6 上使用 LineageOS 11,如果我在调试时摆脱这种绝对令人恼火的行为,我完全愿意重新编译整个 Android 系统.

来自 Android Studio 的调试器 window 可以 select "View breakpoints" (Ctrl+Shift+8) 并从那里设置 "Suspend [X]: [O] All"(线程),Android 现在允许使用调试器花费合理的时间,而不是之前的 ~15 秒。

您可以select在开发者选项中调试应用程序。
或者,您可以 在 ActivityManagerService.java

中增加 KEY_DISPATCHING_TIMEOUT 或 INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT
// How long we allow a receiver to run before giving up on it.
static final int BROADCAST_FG_TIMEOUT = 10*1000;
static final int BROADCAST_BG_TIMEOUT = 60*1000;
// How long we wait until we timeout on key dispatching.
static final int KEY_DISPATCHING_TIMEOUT = 5*1000;
// How long we wait until we timeout on key dispatching during instrumentation.
static final int INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT = 60*1000;

构建和推送服务模块:

make services
adb push $ANDROID_PRODUCT_OUT/system/framework/services.jar system/framework/
adb push $ANDROID_PRODUCT_OUT/system/framework/oat/arm/services.odex system/framework/oat/arm/
[you need reboot] adb reboot or manually reboot