From ea6d1a93815c635f669190fcd39be189102f1a82 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Fri, 14 Apr 2023 13:02:11 -0300 Subject: [PATCH] Fix case where device lied about pip mode support. --- .../org/thoughtcrime/securesms/WebRtcCallActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java index 3df081a2c6..fdefc65cc5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -35,6 +35,7 @@ import android.view.WindowManager; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.core.util.Consumer; import androidx.lifecycle.ViewModelProvider; @@ -279,7 +280,13 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan private boolean enterPipModeIfPossible() { if (isSystemPipEnabledAndAvailable()) { if (viewModel.canEnterPipMode()) { - enterPictureInPictureMode(pipBuilderParams.build()); + try { + enterPictureInPictureMode(pipBuilderParams.build()); + } catch (IllegalStateException e) { + Log.w(TAG, "Device lied to us about supporting PiP.", e); + return false; + } + CallParticipantsListDialog.dismiss(getSupportFragmentManager()); return true;