From 7374e7ee236b99ca458956efefcf982ec29752d3 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Tue, 2 May 2023 09:50:04 -0300 Subject: [PATCH] Fix PiP crash on devices that lie about support. Fixes #12924 --- .../org/thoughtcrime/securesms/WebRtcCallActivity.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java index e191d18d26..0a7b575388 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -281,7 +281,7 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan if (viewModel.canEnterPipMode()) { try { enterPictureInPictureMode(pipBuilderParams.build()); - } catch (IllegalStateException e) { + } catch (Exception e) { Log.w(TAG, "Device lied to us about supporting PiP.", e); return false; } @@ -380,7 +380,11 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan pipBuilderParams.setAutoEnterEnabled(true); } if (Build.VERSION.SDK_INT >= 26) { - setPictureInPictureParams(pipBuilderParams.build()); + try { + setPictureInPictureParams(pipBuilderParams.build()); + } catch (Exception e) { + Log.w(TAG, "System lied about having PiP available.", e); + } } } }