RUM-700 prevent NPE in GestureListener#1634
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1634 +/- ##
===========================================
- Coverage 83.77% 83.74% -0.03%
===========================================
Files 455 456 +1
Lines 15691 15691
Branches 2334 2334
===========================================
- Hits 13144 13140 -4
- Misses 1922 1933 +11
+ Partials 625 618 -7
|
mariusc83
approved these changes
Sep 22, 2023
| import androidx.annotation.NonNull; | ||
| import androidx.annotation.Nullable; | ||
|
|
||
| public abstract class GestureListenerCompat implements GestureDetector.OnGestureListener { |
Member
There was a problem hiding this comment.
I know you opened a ticket at Google about this and I also updated that one, did they ever reply to you ? Nice trick anyway.
Contributor
Author
There was a problem hiding this comment.
No never got an answer ;D
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?
Create a custom Java version of
GestureDetector.OnGestureListenerclass to keep compatibility with older versions of AndroidMotivation
Our telemetry is reporting a lot of exception similar to:
On Android pre API 32, the
onScrollmethod could be called with a nullstartDownEventvalue. Starting in API 33, this parameter is marked as@NonNull, meaning that our Kotlin implementation must accept non-null parameters (trying to force the type as nullableMotionEvent?cause a compilation error.This PR uses a custom Java override where the annotation is replaced with
@Nullableto make Kotlin happy.Review checklist (to be filled by reviewers)