Refactoring

This commit is contained in:
M66B 2022-06-17 22:00:21 +02:00
parent 9244fdffda
commit 855cf39d2a
1 changed files with 7 additions and 3 deletions

View File

@ -88,12 +88,16 @@ public class MediaPlayerHelper {
// This doesn't require READ_PHONE_STATE permission
int mode = am.getMode();
Log.i("Audio mode=" + mode);
return (mode == AudioManager.MODE_RINGTONE ||
mode == AudioManager.MODE_IN_CALL ||
mode == AudioManager.MODE_IN_COMMUNICATION);
return isInCall(mode);
} catch (Throwable ex) {
Log.e(ex);
return false;
}
}
static boolean isInCall(int mode) {
return (mode == AudioManager.MODE_RINGTONE ||
mode == AudioManager.MODE_IN_CALL ||
mode == AudioManager.MODE_IN_COMMUNICATION);
}
}