diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java
index d9654b1be8..1822b68d73 100644
--- a/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java
+++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/WindowManager.java
@@ -59,6 +59,16 @@ private Method getFreezeDisplayRotationMethod() throws NoSuchMethodException {
return freezeDisplayRotationMethod;
}
+ // Android 15 preview and 14 QPR3 Beta introduces a new signature for freeze and thaw rotation
+ // methods which includes a String caller parameter for debugging:
+ //
+ private Method getFreezeDisplayRotationStringMethod() throws NoSuchMethodException {
+ if (freezeDisplayRotationMethod == null) {
+ freezeDisplayRotationMethod = manager.getClass().getMethod("freezeDisplayRotation", int.class, int.class, String.class);
+ }
+ return freezeDisplayRotationMethod;
+ }
+
private Method getIsRotationFrozenMethod() throws NoSuchMethodException {
if (isRotationFrozenMethod == null) {
isRotationFrozenMethod = manager.getClass().getMethod("isRotationFrozen");
@@ -91,6 +101,16 @@ private Method getThawDisplayRotationMethod() throws NoSuchMethodException {
return thawDisplayRotationMethod;
}
+ // Android 15 preview and 14 QPR3 Beta introduces a new signature for freeze and thaw rotation
+ // methods which includes a String caller parameter for debugging:
+ //
+ private Method getThawDisplayRotationStringMethod() throws NoSuchMethodException {
+ if (thawDisplayRotationMethod == null) {
+ thawDisplayRotationMethod = manager.getClass().getMethod("thawDisplayRotation", int.class, String.class);
+ }
+ return thawDisplayRotationMethod;
+ }
+
public int getRotation() {
try {
Method method = getGetRotationMethod();
@@ -104,8 +124,13 @@ public int getRotation() {
public void freezeRotation(int displayId, int rotation) {
try {
try {
- Method method = getFreezeDisplayRotationMethod();
- method.invoke(manager, displayId, rotation);
+ try {
+ Method method = getFreezeDisplayRotationStringMethod();
+ method.invoke(manager, displayId, rotation, "scrcpy#freezeRotation");
+ } catch (ReflectiveOperationException e) {
+ Method method = getFreezeDisplayRotationMethod();
+ method.invoke(manager, displayId, rotation);
+ }
} catch (ReflectiveOperationException e) {
if (displayId == 0) {
Method method = getFreezeRotationMethod();
@@ -142,8 +167,13 @@ public boolean isRotationFrozen(int displayId) {
public void thawRotation(int displayId) {
try {
try {
- Method method = getThawDisplayRotationMethod();
- method.invoke(manager, displayId);
+ try {
+ Method method = getThawDisplayRotationStringMethod();
+ method.invoke(manager, displayId, "scrcpy#thawRotation");
+ } catch (ReflectiveOperationException e) {
+ Method method = getThawDisplayRotationMethod();
+ method.invoke(manager, displayId);
+ }
} catch (ReflectiveOperationException e) {
if (displayId == 0) {
Method method = getThawRotationMethod();