ws-scrcpy
ws-scrcpy copied to clipboard
Android 13. Only default display used.
From https://github.com/NetrisTV/ws-scrcpy/issues/208:
07-23 15:29:13.572 6186 6215 D scrcpy : /// START ws-scrcpy/issues/208 07-23 15:29:13.573 6186 6215 D scrcpy : Failed to get display ids 07-23 15:29:13.574 6186 6215 D scrcpy : getDisplayIds parameters: 07-23 15:29:13.575 6186 6215 D scrcpy : boolean 07-23 15:29:13.575 6186 6215 D scrcpy : Return type: [I 07-23 15:29:13.575 6186 6215 D scrcpy : /// END ws-scrcpy/issues/208
Yep. Google has added a boolean parameter, before Android 13 this method had no parameters.
I am going to leave it as is: on Android 13 return only default display id. Until I can properly investigate what this new integer argument is responsible for.
This method is undocumented and the source code is not available yet (and also I don't have a physical device with Android 13 to play with).
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/hardware/display/IDisplayManager.aidl#39
int[] getDisplayIds(boolean includeDisabled);
This works for me (Tested on Android 13 emulator):
public int[] getDisplayIds() {
Method method;
String methodName = "getDisplayIds";
try {
if (Build.VERSION.SDK_INT < 33) {
method = manager.getClass().getMethod(methodName);
return (int[]) method.invoke(manager);
} else {
method = manager.getClass().getMethod(methodName, Boolean.TYPE);
return (int[]) method.invoke(manager, false);
}
} catch (Exception e) {
throw new AssertionError(e);
}
}
My latest attempt looks like this: https://github.com/drauggres/scrcpy/commit/f931585932673911b5d603581cd59a9fa4a336d1.
I don't work at @NetrisTV and can't add features and fix bugs (maybe only critical). But if you will send a PR I will try to review and merge it (to this repo and to https://github.com/NetrisTV/scrcpy).
tried on real device and not working. Build server from branch wip/websocket-v1.24.x and renamed to "scrcpy-server.jar" and replaced with current ws-scrcpy and not working.
tried on real device and not working. Build server from branch wip/websocket-v1.24.x and renamed to "scrcpy-server.jar" and replaced with current ws-scrcpy and not working.
@krishtoautomate Did you also update version? https://github.com/NetrisTV/ws-scrcpy/blob/e53e0aa24e9ec6277126e0f712055ff4af7bc1b0/src/common/Constants.ts#L3
It should match this https://github.com/drauggres/scrcpy/blob/f931585932673911b5d603581cd59a9fa4a336d1/server/build.gradle#L10
worked after version set to '1.24-ws0'. thanks
worked after version set to '1.24-ws0'. thanks
Keep in mind, this version was not finished. It may (and probably does) have problems. But this issue with default display should be fixed.
@drauggres ay idea how scrcpy is using it?
@drauggres ay idea how scrcpy is using it?
What do you mean (version string/display id/something else)?
@drauggres yes, how scrcpy is handling display id?
@drauggres yes, how scrcpy is handling display id?
Original scrcpy expects that you will provide display id in command line as an argument: https://github.com/Genymobile/scrcpy/blob/72ba913324d65cded8672dca7a57415cb82da095/server/src/main/java/com/genymobile/scrcpy/Server.java#L214-L216
It will check available displays only if it can't receive info for provided display id: https://github.com/Genymobile/scrcpy/blob/72ba913324d65cded8672dca7a57415cb82da095/server/src/main/java/com/genymobile/scrcpy/Device.java#L68-L73
Ws-scrcpy on the other hand asks for available displays (i.e. calls public int[] getDisplayIds()
) every time you click Configure stream
.