diff options
| author | Pedro J. Estébanez | 2017-07-27 17:25:09 +0200 |
|---|---|---|
| committer | Pedro J. Estébanez | 2017-07-27 18:11:23 +0200 |
| commit | aea12b56bcbf65a0c8a2bcbbf564924f74ed4d12 (patch) | |
| tree | 95e940c10096576e658aad6abf8195a691a13e39 | |
| parent | bfa2024313f5ead20053f44f34e81d72d054bcb8 (diff) | |
| download | godot-aea12b56bcbf65a0c8a2bcbbf564924f74ed4d12.tar.gz godot-aea12b56bcbf65a0c8a2bcbbf564924f74ed4d12.tar.zst godot-aea12b56bcbf65a0c8a2bcbbf564924f74ed4d12.zip | |
| -rw-r--r-- | platform/android/export/export.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index e39c2d3a3..737a7c8f6 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -237,6 +237,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { String id; String name; String description; + int release; }; Vector<Device> devices; @@ -1494,6 +1495,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { if (ea->devices[j].id == ldevices[i]) { d.description = ea->devices[j].description; d.name = ea->devices[j].name; + d.release = ea->devices[j].release; } } @@ -1514,6 +1516,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { String vendor; String device; d.description + "Device ID: " + d.id + "\n"; + d.release = 0; for (int j = 0; j < props.size(); j++) { String p = props[j]; @@ -1524,7 +1527,9 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { } else if (p.begins_with("ro.build.display.id=")) { d.description += "Build: " + p.get_slice("=", 1).strip_edges() + "\n"; } else if (p.begins_with("ro.build.version.release=")) { - d.description += "Release: " + p.get_slice("=", 1).strip_edges() + "\n"; + const String release_str = p.get_slice("=", 1).strip_edges(); + d.description += "Release: " + release_str + "\n"; + d.release = release_str.to_int(); } else if (p.begins_with("ro.product.cpu.abi=")) { d.description += "CPU: " + p.get_slice("=", 1).strip_edges() + "\n"; } else if (p.begins_with("ro.product.manufacturer=")) { @@ -1647,15 +1652,19 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { if (use_adb_over_usb) { args.clear(); + args.push_back("-s"); + args.push_back(devices[p_device].id); args.push_back("reverse"); args.push_back("--remove-all"); err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); - int port = Globals::get_singleton()->get("network/debug_port"); + int dbg_port = (int)EditorSettings::get_singleton()->get("network/debug_port"); args.clear(); + args.push_back("-s"); + args.push_back(devices[p_device].id); args.push_back("reverse"); - args.push_back("tcp:" + itos(port)); - args.push_back("tcp:" + itos(port)); + args.push_back("tcp:" + itos(dbg_port)); + args.push_back("tcp:" + itos(dbg_port)); err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); print_line("Reverse result: " + itos(rv)); @@ -1663,6 +1672,8 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { int fs_port = EditorSettings::get_singleton()->get("file_server/port"); args.clear(); + args.push_back("-s"); + args.push_back(devices[p_device].id); args.push_back("reverse"); args.push_back("tcp:" + itos(fs_port)); args.push_back("tcp:" + itos(fs_port)); @@ -1678,7 +1689,10 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { args.push_back("shell"); args.push_back("am"); args.push_back("start"); - args.push_back("--user 0"); + if (bool(EDITOR_DEF("android/force_system_user", false)) && devices[p_device].release >= 17) { // Multi-user introduced in Android 17 + args.push_back("--user"); + args.push_back("0"); + } args.push_back("-a"); args.push_back("android.intent.action.MAIN"); args.push_back("-n"); @@ -1686,7 +1700,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); if (err || rv != 0) { - EditorNode::add_io_error("Could not execute ondevice."); + EditorNode::add_io_error("Could not execute on device."); device_lock->unlock(); return ERR_CANT_CREATE; } @@ -1831,6 +1845,7 @@ void register_android_exporter() { //EDITOR_DEF("android/release_keystore",""); //EDITOR_DEF("android/release_username",""); //EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/release_keystore",PROPERTY_HINT_GLOBAL_FILE,"*.keystore")); + EDITOR_DEF("android/force_system_user", false); EDITOR_DEF("android/timestamping_authority_url", ""); EDITOR_DEF("android/use_remote_debug_over_adb", false); EDITOR_DEF("android/shutdown_adb_on_exit", true); |
