You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Fix issue causing the Android editor to crash when creating a new AudioStreamMicrophone
Fixes https://github.com/godotengine/godot/issues/73801
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="29"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
||||
@@ -81,7 +81,9 @@ open class GodotEditor : FullScreenGodotApp() {
|
||||
private val commandLineParams = ArrayList<String>()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
PermissionsUtil.requestManifestPermissions(this)
|
||||
// We exclude certain permissions from the set we request at startup, as they'll be
|
||||
// requested on demand based on use-cases.
|
||||
PermissionsUtil.requestManifestPermissions(this, setOf(Manifest.permission.RECORD_AUDIO))
|
||||
|
||||
val params = intent.getStringArrayExtra(COMMAND_LINE_PARAMS)
|
||||
updateCommandLineParams(params)
|
||||
@@ -98,6 +100,8 @@ open class GodotEditor : FullScreenGodotApp() {
|
||||
val longPressEnabled = enableLongPressGestures()
|
||||
val panScaleEnabled = enablePanAndScaleGestures()
|
||||
|
||||
checkForProjectPermissionsToEnable()
|
||||
|
||||
runOnUiThread {
|
||||
// Enable long press, panning and scaling gestures
|
||||
godotFragment?.renderView?.inputHandler?.apply {
|
||||
@@ -107,6 +111,17 @@ open class GodotEditor : FullScreenGodotApp() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for project permissions to enable
|
||||
*/
|
||||
protected open fun checkForProjectPermissionsToEnable() {
|
||||
// Check for RECORD_AUDIO permission
|
||||
val audioInputEnabled = java.lang.Boolean.parseBoolean(GodotLib.getGlobal("audio/driver/enable_input"));
|
||||
if (audioInputEnabled) {
|
||||
PermissionsUtil.requestPermission(Manifest.permission.RECORD_AUDIO, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateCommandLineParams(args: Array<String>?) {
|
||||
// Update the list of command line params with the new args
|
||||
commandLineParams.clear()
|
||||
|
||||
@@ -39,4 +39,9 @@ class GodotGame : GodotEditor() {
|
||||
override fun enableLongPressGestures() = false
|
||||
|
||||
override fun enablePanAndScaleGestures() = false
|
||||
|
||||
override fun checkForProjectPermissionsToEnable() {
|
||||
// Nothing to do.. by the time we get here, the project permissions will have already
|
||||
// been requested by the Editor window.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,4 +37,9 @@ package org.godotengine.editor
|
||||
* Upon selection of a project, this activity (via its parent logic) starts the
|
||||
* [GodotEditor] activity.
|
||||
*/
|
||||
class GodotProjectManager : GodotEditor()
|
||||
class GodotProjectManager : GodotEditor() {
|
||||
override fun checkForProjectPermissionsToEnable() {
|
||||
// Nothing to do here.. we have yet to select a project to load.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user