From cad8ff766a58d330e2b1f083711dc10c874c6099 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Mon, 2 Nov 2015 14:53:30 -0800 Subject: [PATCH] Don't set media volume to zero. Not sure what SOA was thinking with this one. Fixes #4201 // FREEBIE --- src/org/thoughtcrime/redphone/audio/IncomingRinger.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/org/thoughtcrime/redphone/audio/IncomingRinger.java b/src/org/thoughtcrime/redphone/audio/IncomingRinger.java index 1f1e4a1cd7..b74b5d2eba 100644 --- a/src/org/thoughtcrime/redphone/audio/IncomingRinger.java +++ b/src/org/thoughtcrime/redphone/audio/IncomingRinger.java @@ -18,6 +18,7 @@ package org.thoughtcrime.redphone.audio; import android.annotation.SuppressLint; +import android.annotation.TargetApi; import android.content.Context; import android.media.AudioManager; import android.media.MediaPlayer; @@ -94,7 +95,6 @@ public class IncomingRinger { } if (player != null && ringerMode == AudioManager.RINGER_MODE_NORMAL ) { - audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0); audioManager.setMode(AudioManager.MODE_RINGTONE); try { if(!player.isPlaying()) { @@ -104,10 +104,7 @@ public class IncomingRinger { } else { Log.d(TAG, "Ringtone is already playing, declining to restart."); } - } catch (IllegalStateException e) { - Log.w(TAG, e); - player = null; - } catch (IOException e) { + } catch (IllegalStateException | IOException e) { Log.w(TAG, e); player = null; } @@ -136,7 +133,7 @@ public class IncomingRinger { return shouldVibrateOld(context); } - @SuppressLint("NewApi") + @TargetApi(Build.VERSION_CODES.HONEYCOMB) private boolean shouldVibrateNew(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);