|
@@ -17,6 +17,7 @@
|
17
|
17
|
package org.jitsi.meet.sdk;
|
18
|
18
|
|
19
|
19
|
import android.content.Context;
|
|
20
|
+import android.media.AudioManager;
|
20
|
21
|
import android.os.Build;
|
21
|
22
|
import android.telecom.CallAudioState;
|
22
|
23
|
import androidx.annotation.RequiresApi;
|
|
@@ -38,6 +39,11 @@ class AudioDeviceHandlerConnectionService implements
|
38
|
39
|
|
39
|
40
|
private final static String TAG = AudioDeviceHandlerConnectionService.class.getSimpleName();
|
40
|
41
|
|
|
42
|
+ /**
|
|
43
|
+ * {@link AudioManager} instance used to interact with the Android audio subsystem.
|
|
44
|
+ */
|
|
45
|
+ private AudioManager audioManager;
|
|
46
|
+
|
41
|
47
|
/**
|
42
|
48
|
* Reference to the main {@code AudioModeModule}.
|
43
|
49
|
*/
|
|
@@ -134,6 +140,8 @@ class AudioDeviceHandlerConnectionService implements
|
134
|
140
|
JitsiMeetLogger.i("Using " + TAG + " as the audio device handler");
|
135
|
141
|
|
136
|
142
|
module = audioModeModule;
|
|
143
|
+ audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
|
|
144
|
+
|
137
|
145
|
RNConnectionService rcs = ReactInstanceManagerHolder.getNativeModule(RNConnectionService.class);
|
138
|
146
|
if (rcs != null) {
|
139
|
147
|
rcs.setCallAudioStateListener(this);
|
|
@@ -160,6 +168,16 @@ class AudioDeviceHandlerConnectionService implements
|
160
|
168
|
|
161
|
169
|
@Override
|
162
|
170
|
public boolean setMode(int mode) {
|
|
171
|
+ if (mode != AudioModeModule.DEFAULT) {
|
|
172
|
+ // This shouldn't be needed when using ConnectionService, but some devices have been
|
|
173
|
+ // observed not doing it.
|
|
174
|
+ try {
|
|
175
|
+ audioManager.setMicrophoneMute(false);
|
|
176
|
+ } catch (Throwable tr) {
|
|
177
|
+ JitsiMeetLogger.w(tr, TAG + " Failed to unmute the microphone");
|
|
178
|
+ }
|
|
179
|
+ }
|
|
180
|
+
|
163
|
181
|
return true;
|
164
|
182
|
}
|
165
|
183
|
}
|