Try newer display API first
The old createDisplay() API has been removed from Android. Try the newer API first, since more and more devices will use that version. PR #5008 <https://github.com/Genymobile/scrcpy/pull/5008>
This commit is contained in:
parent
30e42af2d4
commit
592ca0b59b
@ -45,18 +45,18 @@ public class ScreenCapture extends SurfaceCapture implements Device.RotationList
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
display = createDisplay();
|
|
||||||
setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
|
|
||||||
Ln.d("Display: using SurfaceControl API");
|
|
||||||
} catch (Exception surfaceControlException) {
|
|
||||||
Rect videoRect = screenInfo.getVideoSize().toRect();
|
Rect videoRect = screenInfo.getVideoSize().toRect();
|
||||||
try {
|
|
||||||
virtualDisplay = ServiceManager.getDisplayManager()
|
virtualDisplay = ServiceManager.getDisplayManager()
|
||||||
.createVirtualDisplay("scrcpy", videoRect.width(), videoRect.height(), device.getDisplayId(), surface);
|
.createVirtualDisplay("scrcpy", videoRect.width(), videoRect.height(), device.getDisplayId(), surface);
|
||||||
Ln.d("Display: using DisplayManager API");
|
Ln.d("Display: using DisplayManager API");
|
||||||
} catch (Exception displayManagerException) {
|
} catch (Exception displayManagerException) {
|
||||||
Ln.e("Could not create display using SurfaceControl", surfaceControlException);
|
try {
|
||||||
|
display = createDisplay();
|
||||||
|
setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
|
||||||
|
Ln.d("Display: using SurfaceControl API");
|
||||||
|
} catch (Exception surfaceControlException) {
|
||||||
Ln.e("Could not create display using DisplayManager", displayManagerException);
|
Ln.e("Could not create display using DisplayManager", displayManagerException);
|
||||||
|
Ln.e("Could not create display using SurfaceControl", surfaceControlException);
|
||||||
throw new AssertionError("Could not create display");
|
throw new AssertionError("Could not create display");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user