Log display sizes in display list

This is more convenient than just the display id alone.
This commit is contained in:
Romain Vimont 2023-02-23 23:12:24 +01:00
parent b65301f672
commit a205ff6c8b

View file

@ -1,5 +1,6 @@
package com.genymobile.scrcpy; package com.genymobile.scrcpy;
import com.genymobile.scrcpy.wrappers.DisplayManager;
import com.genymobile.scrcpy.wrappers.ServiceManager; import com.genymobile.scrcpy.wrappers.ServiceManager;
import java.util.List; import java.util.List;
@ -40,12 +41,21 @@ public final class LogUtils {
public static String buildDisplayListMessage() { public static String buildDisplayListMessage() {
StringBuilder builder = new StringBuilder("List of displays:"); StringBuilder builder = new StringBuilder("List of displays:");
int[] displayIds = ServiceManager.getDisplayManager().getDisplayIds(); DisplayManager displayManager = ServiceManager.getDisplayManager();
int[] displayIds = displayManager.getDisplayIds();
if (displayIds == null || displayIds.length == 0) { if (displayIds == null || displayIds.length == 0) {
builder.append("\n (none)"); builder.append("\n (none)");
} else { } else {
for (int id : displayIds) { for (int id : displayIds) {
builder.append("\n --display=").append(id); builder.append("\n --display=").append(id).append(" (");
DisplayInfo displayInfo = displayManager.getDisplayInfo(id);
if (displayInfo != null) {
Size size = displayInfo.getSize();
builder.append(size.getWidth()).append("x").append(size.getHeight());
} else {
builder.append("size unknown");
}
builder.append(")");
} }
} }
return builder.toString(); return builder.toString();