Pārlūkot izejas kodu

android: unmute microphone on the ConnectionService handler

This shouldn't be needed, as ConnectionService should take care of it, but we
suspect some devices don't do it since we got reports of people not hearing
users, and the problem went away when CS was disabled.
master
Saúl Ibarra Corretgé 5 gadus atpakaļ
vecāks
revīzija
87821eb2c0

+ 18
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/AudioDeviceHandlerConnectionService.java Parādīt failu

@@ -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
 }

Notiek ielāde…
Atcelt
Saglabāt