log "getDisplayIds" methods parameters

This commit is contained in:
Sergey Volkov 2022-07-23 18:02:17 +03:00
commit 428c4eef5d
2 changed files with 19 additions and 3 deletions

View file

@ -7,7 +7,7 @@ android {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 11900 versionCode 11900
versionName "1.19-ws3" versionName "1.19-ws4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {

View file

@ -4,6 +4,7 @@ import com.genymobile.scrcpy.DisplayInfo;
import com.genymobile.scrcpy.Ln; import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.Size; import com.genymobile.scrcpy.Size;
import android.os.Build;
import android.os.IInterface; import android.os.IInterface;
import android.view.Display; import android.view.Display;
@ -36,13 +37,28 @@ public final class DisplayManager {
} }
public int[] getDisplayIds() { public int[] getDisplayIds() {
Method method;
String methodName = "getDisplayIds";
try { try {
return (int[]) manager.getClass().getMethod("getDisplayIds").invoke(manager); method = manager.getClass().getMethod(methodName);
return (int[]) method.invoke(manager);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
Ln.d("Failed to get display ids"); Ln.d("Failed to get display ids");
Ln.d("Available methods:"); Ln.d("Available methods:");
for (Method m: manager.getClass().getMethods()) { for (Method m: manager.getClass().getMethods()) {
Ln.d(m.getName()); Ln.d(m.getName() + " parameters:");
if (m.getName().equals(methodName)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (m.getParameterCount() > 0) {
for (Class c : m.getParameterTypes()) {
Ln.d(c.getName());
}
} else {
Ln.d("No parameters");
}
}
}
Ln.d("Return type: " + m.getReturnType().getName());
} }
Ln.d("///"); Ln.d("///");
return new int[]{Display.DEFAULT_DISPLAY}; return new int[]{Display.DEFAULT_DISPLAY};