Skip to content

Commit

Permalink
Add yet another copy-paste workaround
Browse files Browse the repository at this point in the history
For some Honor devices.

PR #4822 <#4822>

Signed-off-by: Romain Vimont <rom@rom1v.com>
  • Loading branch information
eiyooooo authored and rom1v committed Apr 7, 2024
1 parent d1a0f9b commit ad8b824
Showing 1 changed file with 12 additions and 4 deletions.
Expand Up @@ -76,9 +76,15 @@ private Method getGetPrimaryClipMethod() throws NoSuchMethodException {
} catch (NoSuchMethodException e) {
// 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;
} 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 @@ -135,8 +141,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 ad8b824

Please sign in to comment.