File tree 3 files changed +12
-3
lines changed
vector/src/main/java/im/vector/app/core/services
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change
1
+ Tentative fix for the speaker being used instead of earpiece for the outgoing call ringtone on lineage os
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ import android.os.VibrationEffect
28
28
import android.os.Vibrator
29
29
import androidx.core.content.getSystemService
30
30
import im.vector.app.R
31
+ import im.vector.app.features.call.audio.CallAudioManager.Mode
32
+ import im.vector.app.features.call.webrtc.WebRtcCallManager
31
33
import im.vector.app.features.notifications.NotificationUtils
32
34
import org.matrix.android.sdk.api.extensions.orFalse
33
35
import timber.log.Timber
@@ -94,15 +96,16 @@ class CallRingPlayerIncoming(
94
96
}
95
97
96
98
class CallRingPlayerOutgoing (
97
- context : Context
99
+ context : Context ,
100
+ private val callManager : WebRtcCallManager
98
101
) {
99
102
100
103
private val applicationContext = context.applicationContext
101
104
102
105
private var player: MediaPlayer ? = null
103
106
104
107
fun start () {
105
- applicationContext.getSystemService< AudioManager >()?.mode = AudioManager . MODE_IN_COMMUNICATION
108
+ callManager.setAudioModeToCallType()
106
109
player?.release()
107
110
player = createPlayer()
108
111
if (player != null ) {
@@ -120,6 +123,11 @@ class CallRingPlayerOutgoing(
120
123
}
121
124
}
122
125
126
+ private fun WebRtcCallManager.setAudioModeToCallType () {
127
+ val callMode = if (currentCall.get()?.mxCall?.isVideoCall.orFalse()) Mode .VIDEO_CALL else Mode .AUDIO_CALL
128
+ audioManager.setMode(callMode)
129
+ }
130
+
123
131
fun stop () {
124
132
player?.release()
125
133
player = null
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ class CallService : VectorService() {
84
84
super .onCreate()
85
85
notificationManager = NotificationManagerCompat .from(this )
86
86
callRingPlayerIncoming = CallRingPlayerIncoming (applicationContext, notificationUtils)
87
- callRingPlayerOutgoing = CallRingPlayerOutgoing (applicationContext)
87
+ callRingPlayerOutgoing = CallRingPlayerOutgoing (applicationContext, callManager )
88
88
}
89
89
90
90
override fun onDestroy () {
You can’t perform that action at this time.
0 commit comments