Bump the minimum supported SDK version to 24

Raise the minimum supported Android version from Android 5 (Lollipop) to Android 7 (Nougat).
This commit is contained in:
Fredia Huya-Kouadio 2025-05-07 12:00:20 -04:00
parent 8f78e7510d
commit c29545f793
15 changed files with 96 additions and 180 deletions

View file

@ -192,13 +192,11 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe
Manifest.permission.RECORD_AUDIO,
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
excludedPermissions.add(
// The REQUEST_INSTALL_PACKAGES permission is requested the first time we attempt to
// open an apk file.
Manifest.permission.REQUEST_INSTALL_PACKAGES,
)
}
excludedPermissions.add(
// The REQUEST_INSTALL_PACKAGES permission is requested the first time we attempt to
// open an apk file.
Manifest.permission.REQUEST_INSTALL_PACKAGES,
)
// XR runtime permissions should only be requested when the "xr/openxr/enabled" project setting
// is enabled.
@ -384,10 +382,8 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe
val launchPolicy = resolveLaunchPolicyIfNeeded(editorWindowInfo.launchPolicy)
if (launchPolicy == LaunchPolicy.ADJACENT) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Log.v(TAG, "Adding flag for adjacent launch")
newInstance.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)
}
Log.v(TAG, "Adding flag for adjacent launch")
newInstance.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)
}
return newInstance
}
@ -511,12 +507,7 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe
private fun resolveGameEmbedModeIfNeeded(embedMode: GameEmbedMode): GameEmbedMode {
return when (embedMode) {
GameEmbedMode.AUTO -> {
val inMultiWindowMode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
isInMultiWindowMode
} else {
false
}
if (inMultiWindowMode || isLargeScreen || isNativeXRDevice(applicationContext)) {
if (isInMultiWindowMode || isLargeScreen || isNativeXRDevice(applicationContext)) {
GameEmbedMode.DISABLED
} else {
GameEmbedMode.ENABLED
@ -534,12 +525,7 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe
private fun resolveLaunchPolicyIfNeeded(policy: LaunchPolicy): LaunchPolicy {
return when (policy) {
LaunchPolicy.AUTO -> {
val inMultiWindowMode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
isInMultiWindowMode
} else {
false
}
val defaultLaunchPolicy = if (inMultiWindowMode || isLargeScreen || isNativeXRDevice(applicationContext)) {
val defaultLaunchPolicy = if (isInMultiWindowMode || isLargeScreen || isNativeXRDevice(applicationContext)) {
LaunchPolicy.ADJACENT
} else {
LaunchPolicy.SAME

View file

@ -83,7 +83,7 @@ open class GodotGame : BaseGodotGame() {
}
override fun enterPiPMode() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && hasPiPSystemFeature()) {
if (hasPiPSystemFeature()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val builder = PictureInPictureParams.Builder().setSourceRectHint(gameViewSourceRectHint)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
@ -101,8 +101,7 @@ open class GodotGame : BaseGodotGame() {
* Returns true the if the device supports picture-in-picture (PiP).
*/
protected fun hasPiPSystemFeature(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)
return packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)
}
override fun shouldShowGameMenuBar(): Boolean {
@ -123,8 +122,7 @@ open class GodotGame : BaseGodotGame() {
override fun onStop() {
super.onStop()
val isInPiPMode = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isInPictureInPictureMode
if (isInPiPMode && !isFinishing) {
if (isInPictureInPictureMode && !isFinishing) {
// We get in this state when PiP is closed, so we terminate the activity.
finish()
}