From 4c2eafc20161b980d627743ff73ac0d03e423dcf Mon Sep 17 00:00:00 2001 From: "randy.jeong" Date: Wed, 29 May 2019 10:43:39 +0900 Subject: [PATCH] Ignore signal registration for debugging It's difficult to identify native crash/error of 3rd party app. Because they can control their app with own signal handling. Therefore I would like to support the way to ignore signal registration in 3rd party app with the specific property. To enable this, do just setprop "debug.ignoreappsignalhandler 1". Test: test app to hook signal, then setprop debug.ignoreappsignalhandler 1 Change-Id: I2af98a0f58e5ac039eab0ebe9c3780357aca7820 Signed-off-by: randy.jeong --- core/java/com/android/internal/os/Zygote.java | 8 ++++++++ services/core/java/com/android/server/am/ProcessList.java | 3 +++ 2 files changed, 11 insertions(+) diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 9b51c12396482..9d4cdc73b452f 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -106,6 +106,14 @@ public final class Zygote { */ public static final int USE_APP_IMAGE_STARTUP_CACHE = 1 << 16; + /** + * When set, application specified signal handlers are not chained (i.e, ignored) + * by the runtime. + * + * Used for debugging only. Usage: set debug.ignoreappsignalhandler to 1. + */ + public static final int DEBUG_IGNORE_APP_SIGNAL_HANDLER = 1 << 17; + /** No external storage should be mounted. */ public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE; /** Default external storage should be mounted. */ diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index ffbc6b3147761..5465309f7826a 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -1526,6 +1526,9 @@ public final class ProcessList { if ("1".equals(SystemProperties.get("debug.assert"))) { runtimeFlags |= Zygote.DEBUG_ENABLE_ASSERT; } + if ("1".equals(SystemProperties.get("debug.ignoreappsignalhandler"))) { + runtimeFlags |= Zygote.DEBUG_IGNORE_APP_SIGNAL_HANDLER; + } if (mService.mNativeDebuggingApp != null && mService.mNativeDebuggingApp.equals(app.processName)) { // Enable all debug flags required by the native debugger.