From c01c05218115a7507264899d87936904dd4cdd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sun, 18 Sep 2022 14:01:12 +0200 Subject: [PATCH] Fix call not joined again if reconnecting while in pip mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a publisher fails during a call a reconnection is triggered, which first leaves the call and then initiates it again. Initiating a video call first request the permissions, but it seems that the request hangs when done while in PiP mode. Due to this if the publisher fails while in PiP mode and the call is initiated again the call will be simply left, without reconnecting to it. The problem is specific to video calls, as in voice only calls "onMicrophoneClick" is used instead, and it explicitly checks if the permissions are already granted. Checking if the permissions are already granted before requesting them is also recommended in the Android developer guide, and as the permissions are requested during the original call initialization it is expected that they will be already granted if the call is changed to PiP mode, so the problem is work arounded that way (but if the permissions are not granted when the publisher fails in PiP mode the problem would still happen, although that should be quite uncommon). Signed-off-by: Daniel Calviño Sánchez --- .../main/java/com/nextcloud/talk/activities/CallActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java index 0f691f353..de9895953 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java @@ -700,7 +700,9 @@ public class CallActivity extends CallBaseActivity { if (isVoiceOnlyCall) { onMicrophoneClick(); } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CALL)) { + onPermissionsGranted(); + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermissions(PERMISSIONS_CALL, 100); } else { onRequestPermissionsResult(100, PERMISSIONS_CALL, new int[]{1, 1});