forked from mirror/monocles_chat_clean
play tones as music when silent only on android 12+
(cherry picked from commit c6b836f257f5b9e51974e131425f13c8e48f75b3)
This commit is contained in:
parent
fae0368e2f
commit
ce3c07fd2b
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,7 @@ package eu.siacs.conversations.xmpp.jingle;
|
|||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.media.ToneGenerator;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
@ -194,7 +195,8 @@ class ToneManager {
|
|||
|
||||
private static ToneGenerator getToneGenerator(final boolean ringerModeNormal) {
|
||||
try {
|
||||
if (ringerModeNormal) {
|
||||
// when silent and on Android 12+ use STREAM_MUSIC
|
||||
if (ringerModeNormal || Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
return new ToneGenerator(AudioManager.STREAM_VOICE_CALL,60);
|
||||
} else {
|
||||
return new ToneGenerator(AudioManager.STREAM_MUSIC,100);
|
||||
|
|
Loading…
Add table
Reference in a new issue