mirror of
https://github.com/Genymobile/scrcpy
synced 2024-11-17 03:25:38 +00:00
Register rotation watcher only when possible
Old Android versions may not be able to register a rotation watcher for a secondary display. In that case, report the error instead of registering a rotation watcher for the default display. Refs <https://github.com/Genymobile/scrcpy/pull/4740#issuecomment-2051245633> Suggested by: Kaiming Hu <huxxx1234@gmail.com>
This commit is contained in:
parent
a73bf932d6
commit
bd8b945bb3
@ -189,6 +189,10 @@ public final class WindowManager {
|
||||
cls.getMethod("watchRotation", IRotationWatcher.class, int.class).invoke(manager, rotationWatcher, displayId);
|
||||
} catch (NoSuchMethodException e) {
|
||||
// old version
|
||||
if (displayId != 0) {
|
||||
Ln.e("Secondary display rotation not supported on this device");
|
||||
return;
|
||||
}
|
||||
cls.getMethod("watchRotation", IRotationWatcher.class).invoke(manager, rotationWatcher);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
Loading…
Reference in New Issue
Block a user