@@ -484,6 +484,17 @@ startup_inproc_backend(
484484 options ? sentry_options_get_handler_strategy (options ) :
485485# endif
486486 SENTRY_HANDLER_STRATEGY_DEFAULT ;
487+ # ifdef SENTRY_PLATFORM_ANDROID
488+ // CHAIN_AT_START invokes the previous handler and expects to regain
489+ // control. On Android API < 26, the old debuggerd daemon kills the
490+ // crashing process via SIGKILL after the chained handler triggers
491+ // it, so we fall back to DEFAULT which chains at the end instead.
492+ if (g_backend_config .handler_strategy
493+ == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START
494+ && android_get_device_api_level () < 26 ) {
495+ g_backend_config .handler_strategy = SENTRY_HANDLER_STRATEGY_DEFAULT ;
496+ }
497+ # endif
487498 if (backend ) {
488499 backend -> data = & g_backend_config ;
489500 }
@@ -1551,20 +1562,9 @@ dispatch_ucontext(const sentry_ucontext_t *uctx,
15511562static void
15521563process_ucontext (const sentry_ucontext_t * uctx )
15531564{
1554- sentry_handler_strategy_t strategy = g_backend_config .handler_strategy ;
1555- #ifdef SENTRY_PLATFORM_ANDROID
1556- // CHAIN_AT_START invokes the previous handler and expects to regain
1557- // control. On Android API < 26, the old debuggerd daemon kills the
1558- // crashing process via SIGKILL after the chained handler triggers
1559- // it, so we fall back to DEFAULT which chains at the end instead.
1560- if (strategy == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START
1561- && android_get_device_api_level () < 26 ) {
1562- strategy = SENTRY_HANDLER_STRATEGY_DEFAULT ;
1563- }
1564- #endif
1565-
15661565#ifdef SENTRY_PLATFORM_LINUX
1567- if (strategy == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START
1566+ if (g_backend_config .handler_strategy
1567+ == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START
15681568 && uctx -> signum != SIGABRT ) {
15691569 // SIGABRT is excluded: CLR/Mono never uses it for managed exception
15701570 // translation. Chaining SIGABRT to a SIG_DFL previous handler calls
@@ -1700,7 +1700,8 @@ process_ucontext(const sentry_ucontext_t *uctx)
17001700 sentry__atomic_store (& g_crash_handling_state , CRASH_STATE_DONE );
17011701
17021702 sentry__leave_signal_handler ();
1703- if (strategy != SENTRY_HANDLER_STRATEGY_CHAIN_AT_START ) {
1703+ if (g_backend_config .handler_strategy
1704+ != SENTRY_HANDLER_STRATEGY_CHAIN_AT_START ) {
17041705 invoke_signal_handler (
17051706 uctx -> signum , uctx -> siginfo , (void * )uctx -> user_context );
17061707 }
0 commit comments