Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Add option to always use WiFi to connect to remote debug #79504

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion editor/export/editor_export_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
String host = EDITOR_GET("network/debug/remote_host");
int remote_port = (int)EDITOR_GET("network/debug/remote_port");

if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) {
if (EditorSettings::get_singleton()->has_setting("export/android/use_wifi_for_remote_debug") && EDITOR_GET("export/android/use_wifi_for_remote_debug")) {
host = EDITOR_GET("export/android/wifi_remote_debug_host");
} else if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) {
host = "localhost";
}

Expand Down
3 changes: 3 additions & 0 deletions platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ void register_android_exporter() {
EDITOR_DEF("export/android/shutdown_adb_on_exit", true);

EDITOR_DEF("export/android/one_click_deploy_clear_previous_install", false);

EDITOR_DEF("export/android/use_wifi_for_remote_debug", false);
EDITOR_DEF("export/android/wifi_remote_debug_host", "localhost");
#endif

Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>(memnew(EditorExportPlatformAndroid));
Expand Down
8 changes: 6 additions & 2 deletions platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1954,8 +1954,9 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
return ERR_SKIP;
}

const bool use_wifi_for_remote_debug = EDITOR_GET("export/android/use_wifi_for_remote_debug");
const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
const bool use_reverse = devices[p_device].api_level >= 21;
const bool use_reverse = devices[p_device].api_level >= 21 && !use_wifi_for_remote_debug;

if (use_reverse) {
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
Expand Down Expand Up @@ -2068,7 +2069,10 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
print_line("Reverse result2: " + itos(rv));
}
} else {
static const char *const msg = "--- Device API < 21; debugging over Wi-Fi ---";
Pingar5 marked this conversation as resolved.
Show resolved Hide resolved
static const char *const api_version_msg = "--- Device API < 21; debugging over Wi-Fi ---";
static const char *const manual_override_msg = "--- Wi-Fi remote debug enabled in project settings; debugging over Wi-Fi ---";

const char *const msg = use_wifi_for_remote_debug ? manual_override_msg : api_version_msg;
EditorNode::get_singleton()->get_log()->add_message(msg, EditorLog::MSG_TYPE_EDITOR);
print_line(String(msg).to_upper());
}
Expand Down