Fix copy-paste for some devices
On Honor Magic 5 Pro, the method to get the clipboard content has been modified in the framework. Adapt the call to make it work also on this device. Fixes #3885 <https://github.com/Genymobile/scrcpy/issues/3885>
This commit is contained in:
parent
2f9396e24a
commit
f77e1c474e
1 changed files with 10 additions and 3 deletions
|
@ -37,8 +37,13 @@ public class ClipboardManager {
|
|||
getPrimaryClipMethod = manager.getClass().getMethod("getPrimaryClip", String.class, String.class, int.class);
|
||||
getMethodVersion = 1;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
try {
|
||||
getPrimaryClipMethod = manager.getClass().getMethod("getPrimaryClip", String.class, String.class, int.class, int.class);
|
||||
getMethodVersion = 2;
|
||||
} catch (NoSuchMethodException e3) {
|
||||
getPrimaryClipMethod = manager.getClass().getMethod("getPrimaryClip", String.class, int.class, String.class);
|
||||
getMethodVersion = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +85,10 @@ public class ClipboardManager {
|
|||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, FakeContext.ROOT_UID);
|
||||
case 1:
|
||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID);
|
||||
default:
|
||||
case 2:
|
||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0);
|
||||
default:
|
||||
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, FakeContext.ROOT_UID, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue