Poll for Android devices only when a runnable Android export preset is configured

This commit is contained in:
Fredia Huya-Kouadio 2026-02-20 10:52:39 -08:00
parent 0df713417b
commit 51eb1a3013
2 changed files with 19 additions and 5 deletions

View file

@ -469,11 +469,27 @@ void EditorExportPlatformAndroid::_update_preset_status() {
bool has_runnable = EditorExport::get_singleton()->get_runnable_preset_for_platform(this).is_valid();
if (has_runnable) {
has_runnable_preset.set();
_start_check_for_changes_poll_thread();
} else {
has_runnable_preset.clear();
_stop_check_for_changes_poll_thread();
}
devices_changed.set();
}
void EditorExportPlatformAndroid::_start_check_for_changes_poll_thread() {
quit_request.clear();
if (!check_for_changes_thread.is_started()) {
check_for_changes_thread.start(_check_for_changes_poll_thread, this);
}
}
void EditorExportPlatformAndroid::_stop_check_for_changes_poll_thread() {
quit_request.set();
if (check_for_changes_thread.is_started()) {
check_for_changes_thread.wait_to_finish();
}
}
#endif
String EditorExportPlatformAndroid::get_project_name(const Ref<EditorExportPreset> &p_preset, const String &p_name) const {
@ -4427,7 +4443,6 @@ void EditorExportPlatformAndroid::initialize() {
devices_changed.set();
_create_editor_debug_keystore_if_needed();
_update_preset_status();
check_for_changes_thread.start(_check_for_changes_poll_thread, this);
use_scrcpy = EditorSettings::get_singleton()->get_project_metadata("android", "use_scrcpy", false);
#else // ANDROID_ENABLED
android_editor_gradle_runner = memnew(AndroidEditorGradleRunner);
@ -4437,10 +4452,7 @@ void EditorExportPlatformAndroid::initialize() {
EditorExportPlatformAndroid::~EditorExportPlatformAndroid() {
#ifndef ANDROID_ENABLED
quit_request.set();
if (check_for_changes_thread.is_started()) {
check_for_changes_thread.wait_to_finish();
}
_stop_check_for_changes_poll_thread();
#else
if (android_editor_gradle_runner) {
memdelete(android_editor_gradle_runner);