mirror of
https://github.com/Genymobile/scrcpy
synced 2025-08-22 09:57:30 +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.
This commit is contained in:
parent
d63182ed38
commit
92661c4a70
@ -115,7 +115,8 @@ public final class DisplayManager {
|
||||
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) {
|
||||
getDisplayInfoMethod = manager.getClass().getMethod("getDisplayInfo", int.class);
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ public final class ServiceManager {
|
||||
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) {
|
||||
displayManager = DisplayManager.create();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user