mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-06 16:18:59 +00:00
Synchronize access to DisplayManager
The DisplayManager and its method getDisplayInfo() may be used from both the Controller thread and the video (main) thread. PR #6009 <https://github.com/Genymobile/scrcpy/pull/6009>
This commit is contained in:
parent
ee414231ed
commit
7a3fe830d4
2 changed files with 4 additions and 2 deletions
|
@ -115,7 +115,8 @@ public final class DisplayManager {
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Method getGetDisplayInfoMethod() throws NoSuchMethodException {
|
// getDisplayInfo() may be used from both the Controller thread and the video (main) thread
|
||||||
|
private synchronized Method getGetDisplayInfoMethod() throws NoSuchMethodException {
|
||||||
if (getDisplayInfoMethod == null) {
|
if (getDisplayInfoMethod == null) {
|
||||||
getDisplayInfoMethod = manager.getClass().getMethod("getDisplayInfo", int.class);
|
getDisplayInfoMethod = manager.getClass().getMethod("getDisplayInfo", int.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ public final class ServiceManager {
|
||||||
return windowManager;
|
return windowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DisplayManager getDisplayManager() {
|
// The DisplayManager may be used from both the Controller thread and the video (main) thread
|
||||||
|
public static synchronized DisplayManager getDisplayManager() {
|
||||||
if (displayManager == null) {
|
if (displayManager == null) {
|
||||||
displayManager = DisplayManager.create();
|
displayManager = DisplayManager.create();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue