mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-22 04:25:01 +00:00
fix: workaround for getDisplayIds on Android 13
This commit is contained in:
parent
451ebee56f
commit
ac7ffeb91c
2 changed files with 13 additions and 1 deletions
|
@ -7,7 +7,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 11900
|
||||
versionName "1.19-ws2"
|
||||
versionName "1.19-ws3"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package com.genymobile.scrcpy.wrappers;
|
||||
|
||||
import com.genymobile.scrcpy.DisplayInfo;
|
||||
import com.genymobile.scrcpy.Ln;
|
||||
import com.genymobile.scrcpy.Size;
|
||||
|
||||
import android.os.IInterface;
|
||||
import android.view.Display;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public final class DisplayManager {
|
||||
private final IInterface manager;
|
||||
|
@ -34,6 +38,14 @@ public final class DisplayManager {
|
|||
public int[] getDisplayIds() {
|
||||
try {
|
||||
return (int[]) manager.getClass().getMethod("getDisplayIds").invoke(manager);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Ln.d("Failed to get display ids");
|
||||
Ln.d("Available methods:");
|
||||
for (Method m: manager.getClass().getMethods()) {
|
||||
Ln.d(m.getName());
|
||||
}
|
||||
Ln.d("///");
|
||||
return new int[]{Display.DEFAULT_DISPLAY};
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue