mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 06:39:39 +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
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 11900
|
versionCode 11900
|
||||||
versionName "1.19-ws2"
|
versionName "1.19-ws3"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package com.genymobile.scrcpy.wrappers;
|
package com.genymobile.scrcpy.wrappers;
|
||||||
|
|
||||||
import com.genymobile.scrcpy.DisplayInfo;
|
import com.genymobile.scrcpy.DisplayInfo;
|
||||||
|
import com.genymobile.scrcpy.Ln;
|
||||||
import com.genymobile.scrcpy.Size;
|
import com.genymobile.scrcpy.Size;
|
||||||
|
|
||||||
import android.os.IInterface;
|
import android.os.IInterface;
|
||||||
|
import android.view.Display;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public final class DisplayManager {
|
public final class DisplayManager {
|
||||||
private final IInterface manager;
|
private final IInterface manager;
|
||||||
|
@ -34,6 +38,14 @@ public final class DisplayManager {
|
||||||
public int[] getDisplayIds() {
|
public int[] getDisplayIds() {
|
||||||
try {
|
try {
|
||||||
return (int[]) manager.getClass().getMethod("getDisplayIds").invoke(manager);
|
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) {
|
} catch (Exception e) {
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue