Fix PiP crash on devices that lie about support.

Fixes #12924
This commit is contained in:
Alex Hart
2023-05-02 09:50:04 -03:00
parent 3c9c0e244a
commit 7374e7ee23

View File

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