From 77632add4e13704e4823fbcc67079fb5b2674531 Mon Sep 17 00:00:00 2001 From: William Spacefire Date: Mon, 11 Jan 2021 22:18:41 -0300 Subject: [PATCH] Show picture-in-picture only when in video call --- .../thoughtcrime/securesms/WebRtcCallActivity.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java index ad288be4b65..a7ad8eb9496 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -178,7 +178,11 @@ protected void onUserLeaveHint() { @Override public void onBackPressed() { - if (!enterPipModeIfPossible()) { + if (enableVideoIfAvailable) { + if (!enterPipModeIfPossible()) { + super.onBackPressed(); + } + } else { super.onBackPressed(); } } @@ -194,10 +198,8 @@ private boolean enterPipModeIfPossible() { PictureInPictureParams params = new PictureInPictureParams.Builder() .setAspectRatio(new Rational(9, 16)) .build(); - enterPictureInPictureMode(params); CallParticipantsListDialog.dismiss(getSupportFragmentManager()); - - return true; + return enterPictureInPictureMode(params); } return false; } @@ -328,6 +330,7 @@ private void handleSetMuteAudio(boolean enabled) { } private void handleSetMuteVideo(boolean muted) { + enableVideoIfAvailable = !muted; Recipient recipient = viewModel.getRecipient().get(); if (!recipient.equals(Recipient.UNKNOWN)) {