mirror of
https://github.com/Genymobile/scrcpy
synced 2025-08-31 06:15:25 +00:00
Register DisplayFoldListener only for Android 10+
This listener does not exist on Android < 10, and it makes scrcpy fail.
This commit is contained in:
@@ -99,6 +99,7 @@ public final class Device {
|
|||||||
}
|
}
|
||||||
}, displayId);
|
}, displayId);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
ServiceManager.getWindowManager().registerDisplayFoldListener(new IDisplayFoldListener.Stub() {
|
ServiceManager.getWindowManager().registerDisplayFoldListener(new IDisplayFoldListener.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onDisplayFoldChanged(int displayId, boolean folded) {
|
public void onDisplayFoldChanged(int displayId, boolean folded) {
|
||||||
@@ -118,6 +119,7 @@ public final class Device {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (options.getControl() && options.getClipboardAutosync()) {
|
if (options.getControl() && options.getClipboardAutosync()) {
|
||||||
// If control and autosync are enabled, synchronize Android clipboard to the computer automatically
|
// If control and autosync are enabled, synchronize Android clipboard to the computer automatically
|
||||||
|
@@ -2,6 +2,7 @@ package com.genymobile.scrcpy.wrappers;
|
|||||||
|
|
||||||
import com.genymobile.scrcpy.Ln;
|
import com.genymobile.scrcpy.Ln;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.os.IInterface;
|
import android.os.IInterface;
|
||||||
import android.view.IRotationWatcher;
|
import android.view.IRotationWatcher;
|
||||||
import android.view.IDisplayFoldListener;
|
import android.view.IDisplayFoldListener;
|
||||||
@@ -110,6 +111,7 @@ public final class WindowManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(29)
|
||||||
public void registerDisplayFoldListener(IDisplayFoldListener foldListener) {
|
public void registerDisplayFoldListener(IDisplayFoldListener foldListener) {
|
||||||
try {
|
try {
|
||||||
Class<?> cls = manager.getClass();
|
Class<?> cls = manager.getClass();
|
||||||
|
Reference in New Issue
Block a user