Revert "Fix Android deploy with Remote Debug or Network FS over Wi-Fi"

This commit is contained in:
Rémi Verschelde 2020-01-27 19:59:24 +01:00 committed by GitHub
parent 485180ee00
commit c317ac89bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,7 +247,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String name; String name;
String description; String description;
int api_level; int api_level;
bool usb;
}; };
struct APKExportData { struct APKExportData {
@ -274,20 +273,17 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String devices; String devices;
List<String> args; List<String> args;
args.push_back("devices"); args.push_back("devices");
args.push_back("-l");
int ec; int ec;
OS::get_singleton()->execute(adb, args, true, NULL, &devices, &ec); OS::get_singleton()->execute(adb, args, true, NULL, &devices, &ec);
Vector<String> ds = devices.split("\n"); Vector<String> ds = devices.split("\n");
Vector<String> ldevices; Vector<String> ldevices;
Vector<bool> ldevices_usbconnection;
for (int i = 1; i < ds.size(); i++) { for (int i = 1; i < ds.size(); i++) {
String d = ds[i]; String d = ds[i];
int dpos = d.find(" device "); int dpos = d.find("device");
if (dpos == -1) if (dpos == -1)
continue; continue;
ldevices_usbconnection.push_back(d.find(" usb:") != -1);
d = d.substr(0, dpos).strip_edges(); d = d.substr(0, dpos).strip_edges();
ldevices.push_back(d); ldevices.push_back(d);
} }
@ -318,7 +314,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
Device d; Device d;
d.id = ldevices[i]; d.id = ldevices[i];
d.usb = ldevices_usbconnection[i];
for (int j = 0; j < ea->devices.size(); j++) { for (int j = 0; j < ea->devices.size(); j++) {
if (ea->devices[j].id == ldevices[i]) { if (ea->devices[j].id == ldevices[i]) {
d.description = ea->devices[j].description; d.description = ea->devices[j].description;
@ -373,17 +368,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
} else if (p.begins_with("ro.opengles.version=")) { } else if (p.begins_with("ro.opengles.version=")) {
uint32_t opengl = p.get_slice("=", 1).to_int(); uint32_t opengl = p.get_slice("=", 1).to_int();
d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl)&0xFF) + "\n"; d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl)&0xFF) + "\n";
} else if (p.begins_with("ro.boot.serialno=")) {
d.description += "Serial: " + p.get_slice("=", 1).strip_edges() + "\n";
} }
} }
if (d.usb) {
d.description += "Connection: USB\n";
} else {
d.description += "Connection: " + d.id + "\n";
}
d.name = vendor + " " + device; d.name = vendor + " " + device;
if (device == String()) continue; if (device == String()) continue;
} }
@ -1516,9 +1503,7 @@ public:
} }
const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT); 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 && devices[p_device].usb; const bool use_reverse = devices[p_device].api_level >= 21;
// Note: Reverse can still fail if device is connected by both usb and network
// Ideally we'd know for sure whether adb reverse would work before we build the APK
if (use_reverse) if (use_reverse)
p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST; p_debug_flags |= DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST;
@ -1623,7 +1608,7 @@ public:
} }
} else { } else {
static const char *const msg = "--- Device API < 21 or no USB connection; debugging over Wi-Fi ---"; static const char *const msg = "--- Device API < 21; debugging over Wi-Fi ---";
EditorNode::get_singleton()->get_log()->add_message(msg, EditorLog::MSG_TYPE_EDITOR); EditorNode::get_singleton()->get_log()->add_message(msg, EditorLog::MSG_TYPE_EDITOR);
print_line(String(msg).to_upper()); print_line(String(msg).to_upper());
} }