mirror of https://github.com/Genymobile/scrcpy
Add clipboard workaround for Honor device
Fixes #5073 <https://github.com/Genymobile/scrcpy/issues/5073>
This commit is contained in:
parent
fe7494c492
commit
79242957a0
|
@ -82,9 +82,17 @@ public final class ClipboardManager {
|
||||||
// fall-through
|
// fall-through
|
||||||
}
|
}
|
||||||
|
|
||||||
getPrimaryClipMethod = manager.getClass()
|
try {
|
||||||
.getMethod("getPrimaryClip", String.class, String.class, String.class, String.class, int.class, int.class, boolean.class);
|
getPrimaryClipMethod = manager.getClass()
|
||||||
getMethodVersion = 5;
|
.getMethod("getPrimaryClip", String.class, String.class, String.class, String.class, int.class, int.class, boolean.class);
|
||||||
|
getMethodVersion = 5;
|
||||||
|
return getPrimaryClipMethod;
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
// fall-through
|
||||||
|
}
|
||||||
|
|
||||||
|
getPrimaryClipMethod = manager.getClass().getMethod("getPrimaryClip", String.class, String.class, int.class, int.class, String.class);
|
||||||
|
getMethodVersion = 6;
|
||||||
}
|
}
|
||||||
return getPrimaryClipMethod;
|
return getPrimaryClipMethod;
|
||||||
}
|
}
|
||||||
|
@ -145,8 +153,10 @@ public final class ClipboardManager {
|
||||||
case 4:
|
case 4:
|
||||||
// The last boolean parameter is "userOperate"
|
// The last boolean parameter is "userOperate"
|
||||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0, true);
|
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0, true);
|
||||||
default:
|
case 5:
|
||||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, null, null, FakeContext.ROOT_UID, 0, true);
|
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, null, null, FakeContext.ROOT_UID, 0, true);
|
||||||
|
default:
|
||||||
|
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue