diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index e8efa523e6..0132aac85f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -7,6 +7,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Rect; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.SparseIntArray; @@ -17,6 +18,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; +import android.view.WindowManager; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; @@ -373,6 +375,19 @@ public final class EmulationActivity extends AppCompatActivity { super.onResume(); + // Only android 9+ support this feature. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) + { + WindowManager.LayoutParams attributes = getWindow().getAttributes(); + + attributes.layoutInDisplayCutoutMode = + BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA.getBoolean(mSettings) ? + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES : + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER; + + getWindow().setAttributes(attributes); + } + updateOrientation(); if (NativeLibrary.IsGameMetadataValid()) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java index 82004d80c8..83fccc95d1 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java @@ -42,6 +42,8 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_DSP_JIT(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "EnableJIT", true), + MAIN_EXPAND_TO_CUTOUT_AREA(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE, + "ExpandToCutoutArea", false), MAIN_USE_PANIC_HANDLERS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE, "UsePanicHandlers", true), MAIN_OSD_MESSAGES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE, diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index 58869a9e95..6991891bcd 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -4,6 +4,7 @@ package org.dolphinemu.dolphinemu.features.settings.ui; import android.content.Context; import android.content.pm.PackageManager; +import android.os.Build; import android.os.Bundle; import android.text.TextUtils; @@ -292,6 +293,13 @@ public final class SettingsFragmentPresenter R.array.orientationValues)); } + // Only android 9+ supports this feature. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) + { + sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA, + R.string.expand_to_cutout_area, R.string.expand_to_cutout_area_description)); + } + sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_USE_PANIC_HANDLERS, R.string.panic_handlers, R.string.panic_handlers_description)); sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_OSD_MESSAGES, R.string.osd_messages, diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 301e336481..6561b3389c 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -155,8 +155,6 @@ Fallback Region Enable Savestates WARNING: Savestates may not be compatible with future versions of Dolphin and can make it impossible to create normal saves in some cases. Never use savestates as the only way of saving your progress. - Lock screen to landscape - Some touch controls will require additional tweaking if played in portrait Enable usage statistics reporting If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings. Generate a New Statistics Identity @@ -165,6 +163,8 @@ Interface Screen Orientation During Emulation + Expand to Cutout Area + Expands the display area to include the cutout (or notch) area. Use Panic Handlers Show a message box when a potentially serious error has occurred. Disabling this may avoid annoying and non-fatal messages, but it may result in major crashes having no explanation at all. Show On-Screen Display Messages