From 95ae248dc9918fd06df01801021d66e943c616fe Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 9 Dec 2025 20:20:14 +0100 Subject: [PATCH] wip-zoom-range --- .../com/genymobile/scrcpy/util/LogUtils.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/server/src/main/java/com/genymobile/scrcpy/util/LogUtils.java b/server/src/main/java/com/genymobile/scrcpy/util/LogUtils.java index 61e708bc..9e01e4e7 100644 --- a/server/src/main/java/com/genymobile/scrcpy/util/LogUtils.java +++ b/server/src/main/java/com/genymobile/scrcpy/util/LogUtils.java @@ -23,6 +23,7 @@ import android.media.MediaCodecList; import android.os.Build; import android.util.Range; +import java.text.DecimalFormat; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -172,8 +173,22 @@ public final class LogUtils { Ln.w("Could not get available frame rates for camera " + id, e); } + if (Build.VERSION.SDK_INT >= AndroidVersions.API_30_ANDROID_11) { + try { + Range zoomRange = characteristics.get(CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE); + if (zoomRange != null) { + String zoom = getFormattedZoomRange(zoomRange); + builder.append(", zoom-range=").append(zoom); + } + } catch (Exception e) { + Ln.w("Could not get available zoom ranges for camera " + id, e); + } + } + builder.append(')'); + + if (includeSizes) { StreamConfigurationMap configs = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); @@ -226,6 +241,11 @@ public final class LogUtils { return builder.toString(); } + private static String getFormattedZoomRange(Range range) { + DecimalFormat format = new DecimalFormat("#.##"); + return "[" + format.format(range.getLower()) + ", " + format.format(range.getUpper()) + "]"; + } + public static String buildAppListMessage() { List apps = Device.listApps(); return buildAppListMessage("List of apps:", apps);