浏览代码

android fix: do not enter PiP mode when the permissions alert is shown

Entering PiP mode while the permissions dialog is display will not only
fail, but also mess up the Activity lifecycle on some OS versions.
We may end up with two activity/fragment instances and a situation where
the onStop callback was not called yet on the instance #1 while
the onResume has been already called on instance #2.
master
paweldomas 6 年前
父节点
当前提交
0889ffdf27

+ 9
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivityDelegate.java 查看文件

@@ -40,6 +40,15 @@ public class JitsiMeetActivityDelegate {
40 40
     private static PermissionListener permissionListener;
41 41
     private static Callback permissionsCallback;
42 42
 
43
+    /**
44
+     * Tells whether or not the permissions request is currently in progress.
45
+     *
46
+     * @return {@code true} if the permssions are being requested or {@code false} otherwise.
47
+     */
48
+    static boolean arePermissionsBeingRequested() {
49
+        return permissionListener != null;
50
+    }
51
+
43 52
     /**
44 53
      * {@link Activity} lifecycle method which should be called from
45 54
      * {@code Activity#onActivityResult} so we are notified about results of external intents

+ 1
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java 查看文件

@@ -123,6 +123,7 @@ public class JitsiMeetView extends BaseReactView<JitsiMeetViewListener> {
123 123
                 PictureInPictureModule.class);
124 124
         if (pipModule != null
125 125
                 && PictureInPictureModule.isPictureInPictureSupported()
126
+                && !JitsiMeetActivityDelegate.arePermissionsBeingRequested()
126 127
                 && this.url != null) {
127 128
             try {
128 129
                 pipModule.enterPictureInPicture();

正在加载...
取消
保存