1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Enable automatic install of export apks for the Android editor

This commit is contained in:
Fredia Huya-Kouadio
2024-09-29 18:06:11 -07:00
parent 08f9cba0fb
commit af2423ba4d
7 changed files with 42 additions and 10 deletions

View File

@@ -25,6 +25,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:allowBackup="false"

View File

@@ -390,7 +390,7 @@ abstract class BaseGodotEditor : GodotActivity() {
* If the launch policy is [LaunchPolicy.AUTO], resolve it into a specific policy based on the
* editor setting or device and screen metrics.
*
* If the launch policy is [LaunchPolicy.PIP] but PIP is not supported, fallback to the default
* If the launch policy is [LaunchPolicy.SAME_AND_LAUNCH_IN_PIP_MODE] but PIP is not supported, fallback to the default
* launch policy.
*/
private fun resolveLaunchPolicyIfNeeded(policy: LaunchPolicy): LaunchPolicy {
@@ -453,9 +453,9 @@ abstract class BaseGodotEditor : GodotActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
// Check if we got the MANAGE_EXTERNAL_STORAGE permission
if (requestCode == PermissionsUtil.REQUEST_MANAGE_EXTERNAL_STORAGE_REQ_CODE) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!Environment.isExternalStorageManager()) {
when (requestCode) {
PermissionsUtil.REQUEST_MANAGE_EXTERNAL_STORAGE_REQ_CODE -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !Environment.isExternalStorageManager()) {
Toast.makeText(
this,
R.string.denied_storage_permission_error_msg,
@@ -463,6 +463,16 @@ abstract class BaseGodotEditor : GodotActivity() {
).show()
}
}
PermissionsUtil.REQUEST_INSTALL_PACKAGES_REQ_CODE -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !packageManager.canRequestPackageInstalls()) {
Toast.makeText(
this,
R.string.denied_install_packages_permission_error_msg,
Toast.LENGTH_LONG
).show()
}
}
}
}
@@ -514,7 +524,7 @@ abstract class BaseGodotEditor : GodotActivity() {
override fun supportsFeature(featureTag: String): Boolean {
if (featureTag == "xr_editor") {
return isNativeXRDevice();
return isNativeXRDevice()
}
if (featureTag == "horizonos") {

View File

@@ -2,5 +2,6 @@
<resources>
<string name="godot_game_activity_name">Godot Play window</string>
<string name="denied_storage_permission_error_msg">Missing storage access permission!</string>
<string name="denied_install_packages_permission_error_msg">Missing install packages permission!</string>
<string name="pip_button_description">Button used to toggle picture-in-picture mode for the Play window</string>
</resources>