mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Reset audio mode on incoming ringer stop
Don't request audio focus in IncomingRinger either. Fixes #4548 Closes #4567 // FREEBIE
This commit is contained in:
parent
a8f4dadaf5
commit
64ee669728
@ -29,6 +29,8 @@ import android.os.Vibrator;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,13 +76,7 @@ public class IncomingRinger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
|
AudioManager audioManager = ServiceUtil.getAudioManager(context);
|
||||||
audioManager.requestAudioFocus(new AudioManager.OnAudioFocusChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onAudioFocusChange(int focusChange) {}
|
|
||||||
},
|
|
||||||
AudioManager.STREAM_MUSIC,
|
|
||||||
AudioManager.AUDIOFOCUS_GAIN);
|
|
||||||
|
|
||||||
if(player == null) {
|
if(player == null) {
|
||||||
//retry player creation to pick up changed ringtones or audio server restarts
|
//retry player creation to pick up changed ringtones or audio server restarts
|
||||||
@ -120,6 +116,9 @@ public class IncomingRinger {
|
|||||||
}
|
}
|
||||||
Log.d(TAG, "Cancelling vibrator");
|
Log.d(TAG, "Cancelling vibrator");
|
||||||
vibrator.cancel();
|
vibrator.cancel();
|
||||||
|
|
||||||
|
AudioManager audioManager = ServiceUtil.getAudioManager(context);
|
||||||
|
audioManager.setMode(AudioManager.MODE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldVibrate() {
|
private boolean shouldVibrate() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user