Fix call not joined again if reconnecting while in pip mode

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 <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-09-18 14:01:12 +02:00
parent 53e3543839
commit c01c052181

View file

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