Skip to content

Commit

Permalink
Restore lock state check to fix VoiceNotePlaybackService crash
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Sep 27, 2024
1 parent b7f1e11 commit 851c249
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ private void onAttachmentDeleted() {
* @return the built MediaSession, or null if the session cannot be built.
*/
private @Nullable MediaSession buildMediaSession(boolean isRetry) {
if (KeyCachingService.isLocked()) {
Log.i(TAG, "Refuse to create media session when app is locked.");
return null;
}
try {
return new MediaSession.Builder(this, player).setCallback(voiceNotePlayerCallback).setId(SESSION_ID).build();
} catch (IllegalStateException | IllegalArgumentException e) {
Expand Down

0 comments on commit 851c249

Please sign in to comment.