mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-18 18:42:46 +00:00
Avoid crashing from unexpected enterPictureInPictureMode() exceptions
This commit is contained in:
parent
1fae816223
commit
71d463f063
@ -431,13 +431,20 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
if (prefConfig.enablePip && connected) {
|
if (prefConfig.enablePip && connected) {
|
||||||
enterPictureInPictureMode(
|
try {
|
||||||
new PictureInPictureParams.Builder()
|
// This has thrown all sorts of weird exceptions on Samsung devices
|
||||||
.setAspectRatio(new Rational(prefConfig.width, prefConfig.height))
|
// running Oreo. Just eat them and close gracefully on leave, rather
|
||||||
.setSourceRectHint(new Rect(
|
// than crashing.
|
||||||
streamView.getLeft(), streamView.getTop(),
|
enterPictureInPictureMode(
|
||||||
streamView.getRight(), streamView.getBottom()))
|
new PictureInPictureParams.Builder()
|
||||||
.build());
|
.setAspectRatio(new Rational(prefConfig.width, prefConfig.height))
|
||||||
|
.setSourceRectHint(new Rect(
|
||||||
|
streamView.getLeft(), streamView.getTop(),
|
||||||
|
streamView.getRight(), streamView.getBottom()))
|
||||||
|
.build());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user