From 32926ab200d9fc4c37253f0e398dafdf78c78212 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Mon, 2 Mar 2026 10:04:26 +0100 Subject: [PATCH] chore(sdk-crash-detection): Add more ignores to Java config --- .../sdk_crashes/sdk_crash_detection_config.py | 21 +++++++++++ .../sdk_crashes/test_sdk_crash_detector.py | 36 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/sentry/utils/sdk_crashes/sdk_crash_detection_config.py b/src/sentry/utils/sdk_crashes/sdk_crash_detection_config.py index 810e40d8a69a..31170923f858 100644 --- a/src/sentry/utils/sdk_crashes/sdk_crash_detection_config.py +++ b/src/sentry/utils/sdk_crashes/sdk_crash_detection_config.py @@ -317,6 +317,27 @@ def build_sdk_crash_detection_configs() -> Sequence[SDKCrashDetectionConfig]: module_pattern="io.sentry.graphql.SentryGraphqlInstrumentation", function_pattern="instrumentExecutionResultComplete", ), + # WindowCallbackAdapter just forwards the calls to the next callback in the chain. + # It does not cause crashes/ANRs itself. + FunctionAndModulePattern( + module_pattern="io.sentry.android.core.internal.gestures.WindowCallbackAdapter", + function_pattern="*", + ), + # All functions that we delegate to are inside lambdas, so we ignore them. + FunctionAndModulePattern( + module_pattern="io.sentry.android.sqlite.SentrySupportSQLiteStatement$*", + function_pattern="invoke", + ), + # Our wrapper class does not override beginTransaction, so we ignore it. + FunctionAndModulePattern( + module_pattern="io.sentry.android.sqlite.SentrySupportSQLiteDatabase", + function_pattern="beginTransaction*", + ), + # Our wrapper class does not override any move* methods, so we ignore it. + FunctionAndModulePattern( + module_pattern="io.sentry.android.sqlite.SentryCrossProcessCursor", + function_pattern="move*", + ), }, ) configs.append(java_config) diff --git a/tests/sentry/utils/sdk_crashes/test_sdk_crash_detector.py b/tests/sentry/utils/sdk_crashes/test_sdk_crash_detector.py index 91f212364b7e..d5e79764f0c7 100644 --- a/tests/sentry/utils/sdk_crashes/test_sdk_crash_detector.py +++ b/tests/sentry/utils/sdk_crashes/test_sdk_crash_detector.py @@ -71,6 +71,42 @@ def test_build_sdk_crash_detection_configs( True, "Should report a crash when function pattern is wildcard but module doesn't match", ), + ( + "invoke_match_module_prefix_with_suffix", + [ + FunctionAndModulePattern( + module_pattern="io.sentry.android.sqlite.SentrySupportSQLiteStatement$*", + function_pattern="invoke", + ) + ], + [ + { + "function": "invoke", + "module": "io.sentry.android.sqlite.SentrySupportSQLiteStatement$bindLong$1", + "package": "MyApp", + } + ], + False, + "Should not report a crash when module matches SentrySupportSQLiteStatement$* and function is invoke", + ), + ( + "begin_transaction_match_database_wrapper", + [ + FunctionAndModulePattern( + module_pattern="io.sentry.android.sqlite.SentrySupportSQLiteDatabase", + function_pattern="beginTransaction*", + ) + ], + [ + { + "function": "beginTransactionNonExclusive", + "module": "io.sentry.android.sqlite.SentrySupportSQLiteDatabase", + "package": "MyApp", + } + ], + False, + "Should not report a crash when beginTransaction* is called on SentrySupportSQLiteDatabase", + ), ], ) def test_sdk_crash_ignore_matchers(