Display and control your Android device
Rename "rotation" to "device rotation"
Romain Vimontc5f5d1e45669
diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.javaindex c60761cf..1eebc679 100644--- a/server/src/main/java/com/genymobile/scrcpy/Device.java+++ b/server/src/main/java/com/genymobile/scrcpy/Device.java@@ -34,7 +34,7 @@ public final class Device {@Overridepublic void onRotationChanged(int rotation) throws RemoteException {synchronized (Device.this) {- screenInfo = screenInfo.withRotation(rotation);+ screenInfo = screenInfo.withDeviceRotation(rotation);// notifyif (rotationListener != null) {@@ -83,7 +83,7 @@ public final class Device {ScreenInfo screenInfo = getScreenInfo(); // read with synchronizationSize videoSize = screenInfo.getVideoSize();- int deviceRotation = screenInfo.getRotation();+ int deviceRotation = screenInfo.getDeviceRotation();int reverseVideoRotation = getReverseVideoRotation(deviceRotation);// reverse the video rotation to apply the eventsPosition devicePosition = position.rotate(reverseVideoRotation);diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.javaindex 0ef61e9a..61bccc93 100644--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java@@ -67,7 +67,7 @@ public class ScreenEncoder implements Device.RotationListener {ScreenInfo screenInfo = device.getScreenInfo();Rect contentRect = screenInfo.getContentRect();Rect videoRect = screenInfo.getVideoSize().toRect();- int videoRotation = device.getVideoRotation(screenInfo.getRotation());+ int videoRotation = device.getVideoRotation(screenInfo.getDeviceRotation());setSize(format, videoRotation, videoRect.width(), videoRect.height());configure(codec, format);Surface surface = codec.createInputSurface();diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.javaindex 6dd8460c..3e7cadc3 100644--- a/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java@@ -16,12 +16,12 @@ public final class ScreenInfo {/*** Device rotation, related to the natural device orientation (0, 1, 2 or 3)*/- private final int rotation;+ private final int deviceRotation;- public ScreenInfo(Rect contentRect, Size videoSize, int rotation) {+ public ScreenInfo(Rect contentRect, Size videoSize, int deviceRotation) {this.contentRect = contentRect;this.videoSize = videoSize;- this.rotation = rotation;+ this.deviceRotation = deviceRotation;}public Rect getContentRect() {@@ -32,16 +32,16 @@ public final class ScreenInfo {return videoSize;}- public int getRotation() {- return rotation;+ public int getDeviceRotation() {+ return deviceRotation;}- public ScreenInfo withRotation(int newRotation) {- if (newRotation == rotation) {+ public ScreenInfo withDeviceRotation(int newDeviceRotation) {+ if (newDeviceRotation == deviceRotation) {return this;}// true if changed between portrait and landscape- boolean orientationChanged = (rotation + newRotation) % 2 != 0;+ boolean orientationChanged = (deviceRotation + newDeviceRotation) % 2 != 0;Rect newContentRect;Size newVideoSize;if (orientationChanged) {@@ -51,7 +51,7 @@ public final class ScreenInfo {newContentRect = contentRect;newVideoSize = videoSize;}- return new ScreenInfo(newContentRect, newVideoSize, newRotation);+ return new ScreenInfo(newContentRect, newVideoSize, newDeviceRotation);}public static ScreenInfo computeScreenInfo(DisplayInfo displayInfo, Rect crop, int maxSize) {