catch platform bug when getting ringer mode

This commit is contained in:
Daniel Gultsch 2016-08-02 10:58:31 +02:00
parent 8b331895d1
commit d02e24248f
1 changed files with 9 additions and 4 deletions

View File

@ -721,11 +721,16 @@ public class XmppConnectionService extends Service {
private boolean isPhoneSilenced() { private boolean isPhoneSilenced() {
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
try {
if (treatVibrateAsSilent()) { if (treatVibrateAsSilent()) {
return audioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL; return audioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL;
} else { } else {
return audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT; return audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT;
} }
} catch (Throwable throwable) {
Log.d(Config.LOGTAG,"platform bug in isPhoneSilenced ("+ throwable.getMessage()+")");
return false;
}
} }
private void resetAllAttemptCounts(boolean reallyAll) { private void resetAllAttemptCounts(boolean reallyAll) {