Apply volume keys to ringtone volume when call is coming in and to in-call volume during call
This commit is contained in:
@ -518,6 +518,7 @@ class BaresipService: Service() {
|
|||||||
val vidMode = intent.getIntExtra("video", Api.VIDMODE_OFF)
|
val vidMode = intent.getIntExtra("video", Api.VIDMODE_OFF)
|
||||||
stopRinging()
|
stopRinging()
|
||||||
stopMediaPlayer()
|
stopMediaPlayer()
|
||||||
|
am.mode = MODE_IN_COMMUNICATION
|
||||||
setCallVolume()
|
setCallVolume()
|
||||||
proximitySensing(true)
|
proximitySensing(true)
|
||||||
Api.ua_answer(uap, callp, vidMode)
|
Api.ua_answer(uap, callp, vidMode)
|
||||||
@ -1304,6 +1305,7 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun startRinging() {
|
private fun startRinging() {
|
||||||
|
am.mode = AudioManager.MODE_RINGTONE
|
||||||
rt!!.isLooping = true
|
rt!!.isLooping = true
|
||||||
rt!!.play()
|
rt!!.play()
|
||||||
if (shouldVibrate()) {
|
if (shouldVibrate()) {
|
||||||
|
|||||||
@ -2333,7 +2333,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
val stream = if (am.mode == AudioManager.MODE_RINGTONE)
|
val stream = if (am.mode == AudioManager.MODE_RINGTONE)
|
||||||
AudioManager.STREAM_RING
|
AudioManager.STREAM_RING
|
||||||
else
|
else
|
||||||
AudioManager.STREAM_MUSIC
|
AudioManager.STREAM_VOICE_CALL
|
||||||
when (keyCode) {
|
when (keyCode) {
|
||||||
KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP -> {
|
KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||||
am.adjustStreamVolume(stream,
|
am.adjustStreamVolume(stream,
|
||||||
|
|||||||
Reference in New Issue
Block a user