Always use non-empty arguments

The client passes parameters to the server via "adb shell" arguments.

Use "-" instead of "" when no crop is specified to avoid empty
arguments, which are not handled the same way on all devices.

Fixed <https://github.com/Genymobile/scrcpy/issues/337>.
This commit is contained in:
Romain Vimont 2018-11-16 18:36:17 +01:00
parent d81729ba39
commit 1e22ebcac2
2 changed files with 2 additions and 2 deletions

View file

@ -93,7 +93,7 @@ static process_t execute_server(const char *serial,
max_size_string, max_size_string,
bit_rate_string, bit_rate_string,
tunnel_forward ? "true" : "false", tunnel_forward ? "true" : "false",
crop ? crop : "''", crop ? crop : "-",
send_frame_meta ? "true" : "false", send_frame_meta ? "true" : "false",
}; };
return adb_execute(serial, cmd, sizeof(cmd) / sizeof(cmd[0])); return adb_execute(serial, cmd, sizeof(cmd) / sizeof(cmd[0]));

View file

@ -71,7 +71,7 @@ public final class Server {
} }
private static Rect parseCrop(String crop) { private static Rect parseCrop(String crop) {
if (crop.isEmpty()) { if ("-".equals(crop)) {
return null; return null;
} }
// input format: "width:height:x:y" // input format: "width:height:x:y"