Skip to content

fix: init Amplituda lib causing NullPointerException on some devices [WPB-17405] #4020

Merged
MohamadJaara merged 2 commits intodevelopfrom
mo/fix/init-Amplituda-crash-on-some-devices
May 13, 2025
Merged

fix: init Amplituda lib causing NullPointerException on some devices [WPB-17405] #4020
MohamadJaara merged 2 commits intodevelopfrom
mo/fix/init-Amplituda-crash-on-some-devices

Conversation

@MohamadJaara
Copy link
Member

@MohamadJaara MohamadJaara commented May 13, 2025

BugWPB-17405 [Android] crash when init Amplituda lib


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

some devices in the play store are crashing with NullPointerException on Amplituda lib init
was unable to repro but try catching the init and handling this case by not generating an audio wave should take care of it

Solutions

try catch

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a NullPointerException occurring during the initialization of the Amplituda library by introducing safe calls and exception handling, as well as upgrading the library version. Key changes include:

  • Upgrading the Amplituda library version from 2.2.2 to 2.3.0 in the Gradle configuration.
  • Propagating nullability for the wave mask through AudioMessageType, RecordAudioMessagePlayer, AudioWavesMaskHelper, and AudioState.
  • Implementing lazy initialization for Amplituda with exception handling to bypass initialization failures.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gradle/libs.versions.toml Updated Amplituda version to 2.3.0
AudioMessageType.kt Made waveMask nullable and ensured a default mask is applied
RecordAudioMessagePlayer.kt Emitted wave mask only if available via a safe call
AudioWavesMaskHelper.kt Wrapped Amplituda injection in Lazy and added null-safe processing
AudioState.kt Updated wavesMask field to be nullable and adjusted default
AppModule.kt Updated Amplituda import to the new package path

@codecov
Copy link

codecov bot commented May 13, 2025

Codecov Report

Attention: Patch coverage is 13.04348% with 20 lines in your changes missing coverage. Please review.

Project coverage is 45.99%. Comparing base (06bea9d) to head (87ceb2d).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...android/media/audiomessage/AudioWavesMaskHelper.kt 0.00% 15 Missing ⚠️
...oid/media/audiomessage/RecordAudioMessagePlayer.kt 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4020      +/-   ##
===========================================
- Coverage    46.01%   45.99%   -0.02%     
===========================================
  Files          520      520              
  Lines        18120    18127       +7     
  Branches      3046     3053       +7     
===========================================
  Hits          8338     8338              
- Misses        8917     8924       +7     
  Partials       865      865              
Files with missing lines Coverage Δ
.../com/wire/android/media/audiomessage/AudioState.kt 59.52% <100.00%> (ø)
...tions/model/messagetypes/audio/AudioMessageType.kt 0.00% <ø> (ø)
...oid/media/audiomessage/RecordAudioMessagePlayer.kt 1.11% <0.00%> (-0.03%) ⬇️
...android/media/audiomessage/AudioWavesMaskHelper.kt 3.03% <0.00%> (-0.55%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06bea9d...87ceb2d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MohamadJaara MohamadJaara requested review from Garzas and removed request for saleniuk May 13, 2025 08:55
@sonarqubecloud
Copy link

@MohamadJaara MohamadJaara enabled auto-merge May 13, 2025 09:03
@MohamadJaara MohamadJaara added this pull request to the merge queue May 13, 2025
Merged via the queue into develop with commit c1c63de May 13, 2025
12 of 13 checks passed
@MohamadJaara MohamadJaara deleted the mo/fix/init-Amplituda-crash-on-some-devices branch May 13, 2025 09:30
@github-actions
Copy link
Contributor

Built wire-android-staging-compat-pr-4020.apk is available for download

@github-actions
Copy link
Contributor

Built wire-android-dev-debug-pr-4020.apk is available for download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants