Fix case where device lied about pip mode support.

This commit is contained in:
Alex Hart 2023-04-14 13:02:11 -03:00 committed by Greyson Parrelli
parent aff5c2aa16
commit ea6d1a9381

View file

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