diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java
index 9928abb81..8192df706 100644
--- a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java
+++ b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java
@@ -203,6 +203,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
updateRequestedOrientation();
updateControllers();
updateSustainedPerformanceMode();
+ updateDisplayInCutout();
}
private void applySettings() {
@@ -296,6 +297,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
// Sort out rotation.
updateOrientation();
updateSustainedPerformanceMode();
+ updateDisplayInCutout();
// Hook up controller input.
updateControllers();
@@ -425,6 +427,24 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
mContentView.requestFocus();
}
+ private void updateDisplayInCutout() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
+ return;
+
+ final boolean shouldExpand = getBooleanSetting("Display/ExpandToCutout", false);
+ final boolean isExpanded = getWindow().getAttributes().layoutInDisplayCutoutMode ==
+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
+
+ if (shouldExpand == isExpanded)
+ return;
+
+ WindowManager.LayoutParams attribs = getWindow().getAttributes();
+ attribs.layoutInDisplayCutoutMode = shouldExpand ?
+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES :
+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
+ getWindow().setAttributes(attribs);
+ }
+
private static final int REQUEST_CODE_SETTINGS = 0;
private static final int REQUEST_IMPORT_PATCH_CODES = 1;
private static final int REQUEST_CHANGE_DISC_FILE = 2;
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 545fcef50..e3ddc5a3a 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -363,4 +363,6 @@
Apply Image Patches
Automatically applies patches to disc images when they are present, currently only PPF is supported.
Force Scoped Storage
+ Expand To Cutout Area
+ Expands the display area to include the cutout (or notch) area.
diff --git a/android/app/src/main/res/xml/display_preferences.xml b/android/app/src/main/res/xml/display_preferences.xml
index e63c0bf77..ea9293892 100644
--- a/android/app/src/main/res/xml/display_preferences.xml
+++ b/android/app/src/main/res/xml/display_preferences.xml
@@ -81,6 +81,14 @@
app:summary="@string/settings_summary_display_stretch"
app:iconSpaceReserved="false" />
+
+