Added failsafe

pull/208/head
M66B 2 years ago
parent 7b68dbf54a
commit e070e08368

@ -85,11 +85,16 @@ public class MediaPlayerHelper {
if (am == null) if (am == null)
return false; return false;
try {
// This doesn't require READ_PHONE_STATE permission // This doesn't require READ_PHONE_STATE permission
int mode = am.getMode(); int mode = am.getMode();
EntityLog.log(context, "Audio mode=" + mode); Log.i("Audio mode=" + mode);
return (mode == AudioManager.MODE_RINGTONE || return (mode == AudioManager.MODE_RINGTONE ||
mode == AudioManager.MODE_IN_CALL || mode == AudioManager.MODE_IN_CALL ||
mode == AudioManager.MODE_IN_COMMUNICATION); mode == AudioManager.MODE_IN_COMMUNICATION);
} catch (Throwable ex) {
Log.e(ex);
return false;
}
} }
} }

Loading…
Cancel
Save