Fix RecorderWindowCallback crash on null menu parameter#3221
Closed
nguyexua wants to merge 2 commits into
Closed
Conversation
nguyexua
force-pushed
the
lan.nguyen/fix-recorder-window-callback-null-menu-crash
branch
from
March 4, 2026 22:56
0849c26 to
de0f098
Compare
This comment has been minimized.
This comment has been minimized.
nguyexua
force-pushed
the
lan.nguyen/fix-recorder-window-callback-null-menu-crash
branch
from
March 4, 2026 23:45
de0f098 to
95dec94
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3221 +/- ##
===========================================
- Coverage 71.49% 71.38% -0.10%
===========================================
Files 934 935 +1
Lines 34628 34649 +21
Branches 5862 5866 +4
===========================================
- Hits 24755 24734 -21
- Misses 8231 8257 +26
- Partials 1642 1658 +16
🚀 New features to boost your workflow:
|
nguyexua
force-pushed
the
lan.nguyen/fix-recorder-window-callback-null-menu-crash
branch
2 times, most recently
from
March 6, 2026 10:49
8d79d88 to
51d9c76
Compare
Introduce a FixedWindowCallback Java wrapper that annotates nullable parameters correctly, preventing Kotlin's non-null assertions from crashing when Android passes null values to Window.Callback methods. RecorderWindowCallback now extends FixedWindowCallback instead of using Kotlin's `by` delegation.
Remove CountDownLatch-based synchronization and lifecycle callback registration, relying on waitForIdleSync() instead.
nguyexua
force-pushed
the
lan.nguyen/fix-recorder-window-callback-null-menu-crash
branch
from
March 6, 2026 11:03
51d9c76 to
a2babf3
Compare
3 tasks
Member
|
@nguyexua this can be closed I guess? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Introduces a
FixedWindowCallbackJava wrapper in Session Replay that annotates nullable parameters correctly, preventing Kotlin's non-null assertions from crashing when Android passes null values toWindow.Callbackmethods.RecorderWindowCallbacknow extendsFixedWindowCallbackinstead of using Kotlin'sbydelegation.Also simplifies
AppStartupActivityPredicateTestby removing unnecessary synchronization logic.Motivation
A customer reported a crash (
NullPointerException: Parameter specified as non-null is null: method RecorderWindowCallback.onMenuOpened, parameter p1) when opening a custom popup menu.RecorderWindowCallbackpreviously used Kotlin'sby wrappedCallbackdelegation forWindow.Callback. Kotlin generates non-null assertions for all parameters, but Android can call these methods with null values (known Android bug: https://issuetracker.google.com/issues/188568911). The previous fix only handleddispatchTouchEventwith a try-catch, but the same issue affected all menu-related callbacks.Changes
Fix RecorderWindowCallback crash on null menu parameter
FixedWindowCallback.java: A JavaWindow.Callbackwrapper that annotates parameters as@Nullablewhere Android may pass null (e.g.,Menu,MenuItem,MotionEvent). For null menu/item parameters, methods return safe defaults (falseor no-op) instead of forwarding to the delegate.RecorderWindowCallback: Now extendsFixedWindowCallbackinstead of usingby wrappedCallbackdelegation. This eliminates the need for the try-catch workaround indispatchTouchEventand thelogOrRethrowWrappedCallbackExceptionhelper.WindowCallbackInterceptor: Uses.delegate(fromFixedWindowCallback) instead of.wrappedCallbackto unwrap callbacks.onMenuOpened,onMenuItemSelected,onPanelClosed,onPreparePanel,onCreatePanelMenu) and null-parameter handling. Removed obsolete try-catch tests.Simplify AppStartupActivityPredicateTest synchronization
CountDownLatch-based synchronization and lifecycle callback registration, relying onwaitForIdleSync()instead.Review checklist (to be filled by reviewers)