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:
brumsel 2015-11-17 00:06:09 +01:00 committed by Moxie Marlinspike
parent a8f4dadaf5
commit 64ee669728

View File

@ -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() {