소스 검색

[RN] Make AudioMode more resilient on Android

Some devices may give an error stating that INTERACT_ACROSS_USERS_FULL
permission is neeced. This permission can only be achieved by signing the
application with the same key as the system, which is never going to happen so
deal with it by catching any exceptions setting the mode may cause and failing
as gracefully as we can.

Ref:
http://stackoverflow.com/questions/34172575/audiomanager-setmode-securityexception-on-huawei-android-4
j8
Saúl Ibarra Corretgé 8 년 전
부모
커밋
5d50792a56
1개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 13
    2
      android/app/src/main/java/org/jitsi/meet/audiomode/AudioModeModule.java

+ 13
- 2
android/app/src/main/java/org/jitsi/meet/audiomode/AudioModeModule.java 파일 보기

@@ -188,13 +188,24 @@ public class AudioModeModule extends ReactContextBaseJavaModule {
188 188
         Runnable r = new Runnable() {
189 189
             @Override
190 190
             public void run() {
191
-                if (updateAudioRoute(mode)) {
191
+                boolean success;
192
+
193
+                try {
194
+                    success = updateAudioRoute(mode);
195
+                } catch (Throwable e) {
196
+                    success = false;
197
+                    Log.e(
198
+                            TAG,
199
+                            "Failed to update audio route for mode: " + mode,
200
+                            e);
201
+                }
202
+                if (success) {
192 203
                     AudioModeModule.this.mode = mode;
193 204
                     promise.resolve(null);
194 205
                 } else {
195 206
                     promise.reject(
196 207
                             "setMode",
197
-                            "Failed to set the requested audio mode");
208
+                            "Failed to set audio mode to " + mode);
198 209
                 }
199 210
             }
200 211
         };

Loading…
취소
저장