From 9fc583548535ceb2d517ca522189d9814e9d2c13 Mon Sep 17 00:00:00 2001 From: Simon Chan <1330321+yume-chan@users.noreply.github.com> Date: Mon, 14 Aug 2023 00:28:25 +0800 Subject: [PATCH] Fail-fast camera mirroring on Android 11 and older PR #4213 Co-authored-by: Romain Vimont Signed-off-by: Romain Vimont --- server/src/main/java/com/genymobile/scrcpy/Server.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index 4505a52331..9789f7f2eb 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -88,6 +88,12 @@ private static void initAndCleanUp(Options options) { private static void scrcpy(Options options) throws IOException, ConfigurationException { Ln.i("Device: [" + Build.MANUFACTURER + "] " + Build.BRAND + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")"); + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S && options.getVideoSource() == VideoSource.CAMERA) { + Ln.e("Camera mirroring is not supported before Android 12"); + throw new ConfigurationException("Camera mirroring is not supported"); + } + final Device device = new Device(options); Thread initThread = startInitThread(options);