diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 932db064..538e89d8 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -185,6 +185,12 @@ public class Game extends Activity implements SurfaceHolder.Callback, prefConfig = PreferenceConfiguration.readPreferences(this); tombstonePrefs = Game.this.getSharedPreferences("DecoderTombstone", 0); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && prefConfig.stretchVideo) { + // Allow the activity to layout under notches if the fill-screen option + // was turned on by the user + getWindow().getAttributes().layoutInDisplayCutoutMode = + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } // Listen for events on the game surface streamView = findViewById(R.id.surfaceView); diff --git a/app/src/main/java/com/limelight/utils/UiHelper.java b/app/src/main/java/com/limelight/utils/UiHelper.java index f2e49617..592def20 100644 --- a/app/src/main/java/com/limelight/utils/UiHelper.java +++ b/app/src/main/java/com/limelight/utils/UiHelper.java @@ -7,7 +7,9 @@ import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.os.Build; import android.view.View; +import android.view.WindowManager; import com.limelight.R; import com.limelight.preferences.PreferenceConfiguration; @@ -57,6 +59,16 @@ public class UiHelper { rootView.setPadding(horizontalPaddingPixels, verticalPaddingPixels, horizontalPaddingPixels, verticalPaddingPixels); } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + // Allow this non-streaming activity to layout under notches. + // + // We should NOT do this for the Game activity unless + // the user specifically opts in, because it can obscure + // parts of the streaming surface. + activity.getWindow().getAttributes().layoutInDisplayCutoutMode = + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } } public static void showDecoderCrashDialog(Activity activity) {