|
@@ -24,6 +24,8 @@ import com.facebook.react.bridge.Callback;
|
24
|
24
|
import com.facebook.react.bridge.ReactContext;
|
25
|
25
|
import com.facebook.react.modules.core.PermissionListener;
|
26
|
26
|
|
|
27
|
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
|
|
28
|
+
|
27
|
29
|
/**
|
28
|
30
|
* Helper class to encapsulate the work which needs to be done on
|
29
|
31
|
* {@link Activity} lifecycle methods in order for the React side to be aware of
|
|
@@ -177,6 +179,16 @@ public class JitsiMeetActivityDelegate {
|
177
|
179
|
|
178
|
180
|
public static void requestPermissions(Activity activity, String[] permissions, int requestCode, PermissionListener listener) {
|
179
|
181
|
permissionListener = listener;
|
180
|
|
- activity.requestPermissions(permissions, requestCode);
|
|
182
|
+
|
|
183
|
+ // The RN Permissions module calls this in a non-UI thread. What we observe is a crash in ViewGroup.dispatchCancelPendingInputEvents,
|
|
184
|
+ // which is called on the calling (ie, non-UI) thread. This doesn't look very safe, so try to avoid a crash by pretending the permission
|
|
185
|
+ // was denied.
|
|
186
|
+
|
|
187
|
+ try {
|
|
188
|
+ activity.requestPermissions(permissions, requestCode);
|
|
189
|
+ } catch (Exception e) {
|
|
190
|
+ JitsiMeetLogger.e(e, "Error requesting permissions");
|
|
191
|
+ onRequestPermissionsResult(requestCode, permissions, new int[0]);
|
|
192
|
+ }
|
181
|
193
|
}
|
182
|
194
|
}
|