diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-02 10:58:31 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-11 21:34:45 +0200 |
commit | 27c5c200b4c0c809b66701fad5b924206ecfbd2d (patch) | |
tree | 661db37dbffd748922be17f32ca490ba5548d562 | |
parent | 3a73ea74182f33ca9397784cef7423ee75c51225 (diff) |
catch platform bug when getting ringer mode
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 9209c399c..eed8d34c6 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -719,10 +719,15 @@ public class XmppConnectionService extends Service { private boolean isPhoneSilenced() { AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); - if (treatVibrateAsSilent()) { - return audioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL; - } else { - return audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT; + try { + if (treatVibrateAsSilent()) { + return audioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL; + } else { + return audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT; + } + } catch (Throwable throwable) { + Log.d(Config.LOGTAG,"platform bug in isPhoneSilenced ("+ throwable.getMessage()+")"); + return false; } } |