Fix StrictMode violations in AudioRecordingController#6036
Merged
Fix StrictMode violations in AudioRecordingController#6036
StrictMode violations in AudioRecordingController#6036Conversation
Contributor
SDK Size Comparison 📏
|
andremion
approved these changes
Dec 11, 2025
andremion
reviewed
Dec 11, 2025
Contributor
andremion
left a comment
There was a problem hiding this comment.
If possible, try to add unit tests to AudioRecordingController at least
Contributor
Author
Added tests here: 672f73a |
|
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.


🎯 Goal
Fixes several
StrictModeviolations from theAudioRecordingControllerrelated to accessing the disk on main thread.🛠 Implementation details
AudioRecordingControllerstartRecording,stopRecordingandcompleteRecordingsuspendstartRecording: wrapmediaRecorder.startAudioRecordingwithwithContext(DispatcherProvider.IO)to ensure it is run on IOstopRecording: wrapmediaRecorder.stopRecording()withwithContext(DispatcherProvider.IO)to ensure it is run on IOcompleteRecording: wrapmediaRecorder.stopRecording()withwithContext(DispatcherProvider.IO)to ensure it is run on IO and post state updates onMainto ensure they are processed in ordercompleteRecordingSync: Introduce a new method which returns theResultof the recording instead of updating the internal state. This was required to ensure theMessageComposerController.sendRecording()works properly, because it previously relied on the sequential execution ofcompleteRecording(which is no longer the case)MessageComposerControllerNote: The corresponding methods from
StreamMediaRecorderwere not changed tosuspendbecause it is public API.🎨 UI Changes
Run the following tests, ensuring that nothing is broken + there are no related
StrictModeviolations in the LogCat (bothcomposeandxml)Stop, thenSend-> sends the recording in chatSend-> sends the recording in chatChatTheme.messageComposerTheme.audioRecording.sendOnCompletetofalse- re-run the same tests: For cases 2 and 3, the recording should first be added to the composer, and sent only when tapping theSendbutton.