Skip to content

Commit

Permalink
Add clipboard workaround for Honor device
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1v authored and Gottox committed Sep 29, 2024
1 parent 5f345ac commit 6f271a4
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ private Method getGetPrimaryClipMethod() throws NoSuchMethodException {
// fall-through
}

getPrimaryClipMethod = manager.getClass()
.getMethod("getPrimaryClip", String.class, String.class, String.class, String.class, int.class, int.class, boolean.class);
getMethodVersion = 5;
try {
getPrimaryClipMethod = manager.getClass()
.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;
}
Expand Down Expand Up @@ -145,8 +153,10 @@ private static ClipData getPrimaryClip(Method method, int methodVersion, IInterf
case 4:
// The last boolean parameter is "userOperate"
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);
default:
return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, FakeContext.ROOT_UID, 0, null);
}
}

Expand Down

0 comments on commit 6f271a4

Please sign in to comment.