aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-08-02 10:58:31 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-08-02 10:58:31 +0200
commitd02e24248f0d38e084336e463da559fedc3ac896 (patch)
treef9250265c3382c314a428dafb00547f407950120
parent8b331895d13653b6bb5f808489b428f5cfcd81a0 (diff)
catch platform bug when getting ringer mode
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index ed0b32fb..cf850b9b 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -721,10 +721,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;
}
}