From 89518f49adb59dfa961f76be3f4414bffdc22cc5 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 10 Nov 2024 09:08:49 +0100 Subject: [PATCH] Revert "Disable broken options on Android 14" This reverts commit d62fa8880e03e8823057a5d4d9659d5f19132806. These options will be reimplemented differently. Refs #4011 Refs #4162 PR #5455 --- app/src/cli.c | 3 +-- app/src/options.h | 2 -- .../java/com/genymobile/scrcpy/Options.java | 6 +----- .../main/java/com/genymobile/scrcpy/Server.java | 17 ----------------- .../com/genymobile/scrcpy/device/Device.java | 2 -- .../com/genymobile/scrcpy/video/ScreenInfo.java | 2 +- 6 files changed, 3 insertions(+), 29 deletions(-) diff --git a/app/src/cli.c b/app/src/cli.c index ebf0f6f6..e67192bf 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -2856,8 +2856,7 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[], SC_LOCK_VIDEO_ORIENTATION_UNLOCKED) { LOGI("Video orientation is locked for v4l2 sink. " "See --lock-video-orientation."); - opts->lock_video_orientation = - SC_LOCK_VIDEO_ORIENTATION_INITIAL_AUTO; + opts->lock_video_orientation = SC_LOCK_VIDEO_ORIENTATION_INITIAL; } // V4L2 could not handle size change. diff --git a/app/src/options.h b/app/src/options.h index 5662719a..9236c3f8 100644 --- a/app/src/options.h +++ b/app/src/options.h @@ -134,8 +134,6 @@ enum sc_lock_video_orientation { SC_LOCK_VIDEO_ORIENTATION_UNLOCKED = -1, // lock the current orientation when scrcpy starts SC_LOCK_VIDEO_ORIENTATION_INITIAL = -2, - // like SC_LOCK_VIDEO_ORIENTATION_INITIAL, but set automatically - SC_LOCK_VIDEO_ORIENTATION_INITIAL_AUTO = -3, SC_LOCK_VIDEO_ORIENTATION_0 = 0, SC_LOCK_VIDEO_ORIENTATION_90 = 3, SC_LOCK_VIDEO_ORIENTATION_180 = 2, diff --git a/server/src/main/java/com/genymobile/scrcpy/Options.java b/server/src/main/java/com/genymobile/scrcpy/Options.java index 54888827..c1620432 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Options.java +++ b/server/src/main/java/com/genymobile/scrcpy/Options.java @@ -32,7 +32,7 @@ public class Options { private int videoBitRate = 8000000; private int audioBitRate = 128000; private float maxFps; - private int lockVideoOrientation = Device.LOCK_VIDEO_ORIENTATION_UNLOCKED; + private int lockVideoOrientation = -1; private boolean tunnelForward; private Rect crop; private boolean control = true; @@ -259,10 +259,6 @@ public class Options { return sendCodecMeta; } - public void resetLockVideoOrientation() { - this.lockVideoOrientation = Device.LOCK_VIDEO_ORIENTATION_UNLOCKED; - } - @SuppressWarnings("MethodLength") public static Options parse(String... args) { if (args.length < 1) { diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index ca53d861..eb8b533a 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -85,23 +85,6 @@ public final class Server { throw new ConfigurationException("New virtual display is not supported"); } - if (Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14) { - int lockVideoOrientation = options.getLockVideoOrientation(); - if (lockVideoOrientation != Device.LOCK_VIDEO_ORIENTATION_UNLOCKED) { - if (lockVideoOrientation != Device.LOCK_VIDEO_ORIENTATION_INITIAL_AUTO) { - Ln.e("--lock-video-orientation is broken on Android >= 14: "); - throw new ConfigurationException("--lock-video-orientation is broken on Android >= 14"); - } else { - // If the flag has been set automatically (because v4l2 sink is enabled), do not fail - Ln.w("--lock-video-orientation is ignored on Android >= 14: "); - } - } - if (options.getCrop() != null) { - Ln.e("--crop is broken on Android >= 14: "); - throw new ConfigurationException("Crop is not broken on Android >= 14"); - } - } - CleanUp cleanUp = null; if (options.getCleanup()) { diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Device.java b/server/src/main/java/com/genymobile/scrcpy/device/Device.java index e7a743f8..09c7d2b6 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Device.java @@ -42,8 +42,6 @@ public final class Device { public static final int LOCK_VIDEO_ORIENTATION_UNLOCKED = -1; public static final int LOCK_VIDEO_ORIENTATION_INITIAL = -2; - // like SC_LOCK_VIDEO_ORIENTATION_INITIAL, but set automatically - public static final int LOCK_VIDEO_ORIENTATION_INITIAL_AUTO = -3; private Device() { // not instantiable diff --git a/server/src/main/java/com/genymobile/scrcpy/video/ScreenInfo.java b/server/src/main/java/com/genymobile/scrcpy/video/ScreenInfo.java index 602bd8ab..cc82a654 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/ScreenInfo.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/ScreenInfo.java @@ -64,7 +64,7 @@ public final class ScreenInfo { } public static ScreenInfo computeScreenInfo(int rotation, Size deviceSize, Rect crop, int maxSize, int lockedVideoOrientation) { - if (lockedVideoOrientation == Device.LOCK_VIDEO_ORIENTATION_INITIAL || lockedVideoOrientation == Device.LOCK_VIDEO_ORIENTATION_INITIAL_AUTO) { + if (lockedVideoOrientation == Device.LOCK_VIDEO_ORIENTATION_INITIAL) { // The user requested to lock the video orientation to the current orientation lockedVideoOrientation = rotation; }